diff --git a/ui-ci/.gitignore b/ui-ci/.gitignore
new file mode 100644
index 0000000..6405eb7
--- /dev/null
+++ b/ui-ci/.gitignore
@@ -0,0 +1,2 @@
+/bin/
+test-output/
\ No newline at end of file
diff --git a/ui-ci/hs_err_pid10052.log b/ui-ci/hs_err_pid10052.log
new file mode 100644
index 0000000..3475f92
--- /dev/null
+++ b/ui-ci/hs_err_pid10052.log
@@ -0,0 +1,389 @@
+#
+# A fatal error has been detected by the Java Runtime Environment:
+#
+#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006f70a0a5, pid=10052, tid=0x0000000000001f50
+#
+# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
+# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode windows-amd64 compressed oops)
+# Problematic frame:
+# V  [jvm.dll+0x12a0a5]
+#
+# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
+#
+# If you would like to submit a bug report, please visit:
+#   http://bugreport.java.com/bugreport/crash.jsp
+#
+
+---------------  T H R E A D  ---------------
+
+Current thread (0x000000001d458800):  JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=8016, stack(0x000000001e150000,0x000000001e250000)]
+
+siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff
+
+Registers:
+RAX=0x000000001e24f201, RBX=0x000000001d458800, RCX=0x293b676e69727453, RDX=0x0000000000000000
+RSP=0x000000001e24f290, RBP=0x293b676e69727453, RSI=0x000000001e24f3a8, RDI=0x000000000237c720
+R8 =0x000000001d458800, R9 =0x000000000000ff00, R10=0x0000000000000000, R11=0x004e596502bc0041
+R12=0x0000000000000000, R13=0x000000001d451788, R14=0x0000000000000000, R15=0x0000000000000000
+RIP=0x000000006f70a0a5, EFLAGS=0x0000000000010206
+
+Top of Stack: (sp=0x000000001e24f290)
+0x000000001e24f290:   000000001d458800 000000001fbdbe40
+0x000000001e24f2a0:   000000001e24f358 000000006f912f0b
+0x000000001e24f2b0:   000000001d458800 000000006f92f76d
+0x000000001e24f2c0:   0000000000000000 0000000055559155
+0x000000001e24f2d0:   000000001f30efd8 000000005556291e
+0x000000001e24f2e0:   000000001d458800 0000000000000000
+0x000000001e24f2f0:   0000000000000000 0000000000000000
+0x000000001e24f300:   293b676e69727453 0000000055561a15
+0x000000001e24f310:   000000001e24f3a8 000000001e24f380
+0x000000001e24f320:   0000000000000001 000000001f30efd8
+0x000000001e24f330:   293b676e69727453 00000000555453b3
+0x000000001e24f340:   000000001e24f470 0000000000000001
+0x000000001e24f350:   0000000000000001 000000001f30efd8
+0x000000001e24f360:   00000000f000100a 0000000000000000
+0x000000001e24f370:   0000000000000000 0000000000000000
+0x000000001e24f380:   0000000000000001 0000000055545571 
+
+Instructions: (pc=0x000000006f70a0a5)
+0x000000006f70a085:   cc cc cc cc cc cc cc cc cc cc cc 48 83 ec 28 48
+0x000000006f70a095:   85 c9 75 07 33 c0 48 83 c4 28 c3 48 89 5c 24 20
+0x000000006f70a0a5:   48 8b 19 48 85 db 74 20 48 83 fb 37 74 1a 48 8b
+0x000000006f70a0b5:   13 48 8b cb ff 52 10 84 c0 74 0d 48 8b c3 48 8b 
+
+
+Register to memory mapping:
+
+RAX=0x000000001e24f201 is pointing into the stack for thread: 0x000000001d458800
+RBX=0x000000001d458800 is a thread
+RCX=0x293b676e69727453 is an unknown value
+RDX=0x0000000000000000 is an unknown value
+RSP=0x000000001e24f290 is pointing into the stack for thread: 0x000000001d458800
+RBP=0x293b676e69727453 is an unknown value
+RSI=0x000000001e24f3a8 is pointing into the stack for thread: 0x000000001d458800
+RDI=0x000000000237c720 is an unknown value
+R8 =0x000000001d458800 is a thread
+R9 =0x000000000000ff00 is an unknown value
+R10=0x0000000000000000 is an unknown value
+R11=0x004e596502bc0041 is an unknown value
+R12=0x0000000000000000 is an unknown value
+R13=0x000000001d451788 is an unknown value
+R14=0x0000000000000000 is an unknown value
+R15=0x0000000000000000 is an unknown value
+
+
+Stack: [0x000000001e150000,0x000000001e250000],  sp=0x000000001e24f290,  free space=1020k
+Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
+V  [jvm.dll+0x12a0a5]
+V  [jvm.dll+0x34f76d]
+C  [jdwp.dll+0x21a15]
+C  [jdwp.dll+0x53b3]
+C  [jdwp.dll+0x5571]
+C  [jdwp.dll+0xf0a8]
+C  [jdwp.dll+0x1f2d5]
+C  [jdwp.dll+0x1f4aa]
+V  [jvm.dll+0x1bd258]
+V  [jvm.dll+0x2451a4]
+V  [jvm.dll+0x29c18a]
+C  [msvcr100.dll+0x21d9f]
+C  [msvcr100.dll+0x21e3b]
+C  [kernel32.dll+0x159cd]
+C  [ntdll.dll+0x2a2e1]
+
+
+---------------  P R O C E S S  ---------------
+
+Java Threads: ( => current thread )
+  0x000000001f2a0000 JavaThread "Thread-25" daemon [_thread_in_native, id=11400, stack(0x0000000024be0000,0x0000000024ce0000)]
+  0x000000001f29f000 JavaThread "Thread-24" daemon [_thread_in_native, id=1112, stack(0x00000000243d0000,0x00000000244d0000)]
+  0x000000001f29e800 JavaThread "Thread-23" [_thread_in_native, id=2452, stack(0x0000000022cc0000,0x0000000022dc0000)]
+  0x000000001f93d000 JavaThread "ReaderThread" [_thread_in_native, id=11720, stack(0x0000000021250000,0x0000000021350000)]
+  0x000000001d4e8800 JavaThread "Service Thread" daemon [_thread_blocked, id=10596, stack(0x000000001e6f0000,0x000000001e7f0000)]
+  0x000000001d474800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=8028, stack(0x000000001e3d0000,0x000000001e4d0000)]
+  0x000000001d471000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5140, stack(0x000000001e4f0000,0x000000001e5f0000)]
+  0x000000001d46d000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=12216, stack(0x000000001dd90000,0x000000001de90000)]
+  0x000000001d45f800 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=7520, stack(0x000000001e2d0000,0x000000001e3d0000)]
+  0x000000001d45e000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2652, stack(0x000000001df60000,0x000000001e060000)]
+=>0x000000001d458800 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_in_vm, id=8016, stack(0x000000001e150000,0x000000001e250000)]
+  0x000000001d444800 JavaThread "Attach Listener" daemon [_thread_blocked, id=7364, stack(0x000000001d200000,0x000000001d300000)]
+  0x000000001bfff000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=9460, stack(0x000000001d850000,0x000000001d950000)]
+  0x000000001bfe6800 JavaThread "Finalizer" daemon [_thread_blocked, id=7944, stack(0x000000001d340000,0x000000001d440000)]
+  0x000000001bf9d000 JavaThread "Reference Handler" daemon [_thread_blocked, id=6028, stack(0x000000001d080000,0x000000001d180000)]
+  0x0000000002381000 JavaThread "main" [_thread_blocked, id=12148, stack(0x0000000002480000,0x0000000002580000)]
+
+Other Threads:
+  0x000000001bf95800 VMThread [stack: 0x000000001cf80000,0x000000001d080000] [id=8456]
+  0x000000001d537000 WatcherThread [stack: 0x000000001e840000,0x000000001e940000] [id=5808]
+
+VM state:not at safepoint (normal execution)
+
+VM Mutex/Monitor currently owned by a thread: None
+
+Heap:
+ PSYoungGen      total 144896K, used 11229K [0x000000076c700000, 0x0000000776d80000, 0x00000007c0000000)
+  eden space 143360K, 6% used [0x000000076c700000,0x000000076d087050,0x0000000775300000)
+  from space 1536K, 95% used [0x0000000775d00000,0x0000000775e70540,0x0000000775e80000)
+  to   space 9216K, 0% used [0x0000000776480000,0x0000000776480000,0x0000000776d80000)
+ ParOldGen       total 93184K, used 6916K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5ac1178,0x00000006caf00000)
+ Metaspace       used 26524K, capacity 27092K, committed 27264K, reserved 1073152K
+  class space    used 3209K, capacity 3367K, committed 3456K, reserved 1048576K
+
+Card table byte_map: [0x0000000011cf0000,0x00000000124d0000] byte_map_base: 0x000000000e6c6000
+
+Marking Bits: (ParMarkBitMap*) 0x000000006fdfa6d0
+ Begin Bits: [0x00000000130c0000, 0x0000000016f70000)
+ End Bits:   [0x0000000016f70000, 0x000000001ae20000)
+
+Polling page: 0x0000000000370000
+
+CodeCache: size=245760Kb used=14912Kb max_used=14912Kb free=230848Kb
+ bounds [0x0000000002930000, 0x00000000037d0000, 0x0000000011930000]
+ total_blobs=4013 nmethods=3595 adapters=338
+ compilation: enabled
+
+Compilation events (10 events):
+Event: 131.300 Thread 0x000000001d474800 4189   !   3       com.google.gson.JsonParser::parse (100 bytes)
+Event: 131.302 Thread 0x000000001d474800 nmethod 4189 0x00000000037cce10 code [0x00000000037cd120, 0x00000000037ceb08]
+Event: 131.303 Thread 0x000000001d474800 4190   !   3       com.google.gson.internal.Streams::parse (68 bytes)
+Event: 131.304 Thread 0x000000001d474800 nmethod 4190 0x00000000037a77d0 code [0x00000000037a79e0, 0x00000000037a81d8]
+Event: 131.304 Thread 0x000000001d474800 4191       3       com.google.gson.internal.bind.TypeAdapters$25::read (6 bytes)
+Event: 131.304 Thread 0x000000001d474800 nmethod 4191 0x00000000037a7390 code [0x00000000037a7500, 0x00000000037a7728]
+Event: 131.313 Thread 0x000000001d474800 4192       1       java.lang.StackTraceElement::getClassName (5 bytes)
+Event: 131.313 Thread 0x000000001d474800 nmethod 4192 0x00000000037a4c90 code [0x00000000037a4de0, 0x00000000037a4ef0]
+Event: 131.313 Thread 0x000000001d474800 4193   !   3       sun.nio.cs.StreamEncoder::flushBuffer (42 bytes)
+Event: 131.313 Thread 0x000000001d474800 nmethod 4193 0x00000000037a6910 code [0x00000000037a6ac0, 0x00000000037a7098]
+
+GC Heap History (10 events):
+Event: 98.293 GC heap before
+{Heap before GC invocations=12 (full 1):
+ PSYoungGen      total 169472K, used 169111K [0x000000076c700000, 0x0000000778200000, 0x00000007c0000000)
+  eden space 167424K, 100% used [0x000000076c700000,0x0000000776a80000,0x0000000776a80000)
+  from space 2048K, 82% used [0x0000000778000000,0x00000007781a5ff0,0x0000000778200000)
+  to   space 10752K, 0% used [0x0000000776d00000,0x0000000776d00000,0x0000000777780000)
+ ParOldGen       total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000)
+ Metaspace       used 26364K, capacity 26900K, committed 27008K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+Event: 98.299 GC heap after
+Heap after GC invocations=12 (full 1):
+ PSYoungGen      total 164352K, used 1859K [0x000000076c700000, 0x0000000778080000, 0x00000007c0000000)
+  eden space 162304K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000776580000)
+  from space 2048K, 90% used [0x0000000776d00000,0x0000000776ed0fe0,0x0000000776f00000)
+  to   space 10752K, 0% used [0x0000000777600000,0x0000000777600000,0x0000000778080000)
+ ParOldGen       total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000)
+ Metaspace       used 26364K, capacity 26900K, committed 27008K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+}
+Event: 112.449 GC heap before
+{Heap before GC invocations=13 (full 1):
+ PSYoungGen      total 164352K, used 164163K [0x000000076c700000, 0x0000000778080000, 0x00000007c0000000)
+  eden space 162304K, 100% used [0x000000076c700000,0x0000000776580000,0x0000000776580000)
+  from space 2048K, 90% used [0x0000000776d00000,0x0000000776ed0fe0,0x0000000776f00000)
+  to   space 10752K, 0% used [0x0000000777600000,0x0000000777600000,0x0000000778080000)
+ ParOldGen       total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000)
+ Metaspace       used 26410K, capacity 26964K, committed 27264K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+Event: 112.470 GC heap after
+Heap after GC invocations=13 (full 1):
+ PSYoungGen      total 158720K, used 1461K [0x000000076c700000, 0x0000000777780000, 0x00000007c0000000)
+  eden space 157184K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000776080000)
+  from space 1536K, 95% used [0x0000000777600000,0x000000077776d550,0x0000000777780000)
+  to   space 10240K, 0% used [0x0000000776380000,0x0000000776380000,0x0000000776d80000)
+ ParOldGen       total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000)
+ Metaspace       used 26410K, capacity 26964K, committed 27264K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+}
+Event: 114.140 GC heap before
+{Heap before GC invocations=14 (full 1):
+ PSYoungGen      total 158720K, used 158645K [0x000000076c700000, 0x0000000777780000, 0x00000007c0000000)
+  eden space 157184K, 100% used [0x000000076c700000,0x0000000776080000,0x0000000776080000)
+  from space 1536K, 95% used [0x0000000777600000,0x000000077776d550,0x0000000777780000)
+  to   space 10240K, 0% used [0x0000000776380000,0x0000000776380000,0x0000000776d80000)
+ ParOldGen       total 93184K, used 6900K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abd178,0x00000006caf00000)
+ Metaspace       used 26418K, capacity 26964K, committed 27264K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+Event: 114.143 GC heap after
+Heap after GC invocations=14 (full 1):
+ PSYoungGen      total 154624K, used 1655K [0x000000076c700000, 0x0000000777680000, 0x00000007c0000000)
+  eden space 152576K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000775c00000)
+  from space 2048K, 80% used [0x0000000776380000,0x000000077651dff0,0x0000000776580000)
+  to   space 9728K, 0% used [0x0000000776d00000,0x0000000776d00000,0x0000000777680000)
+ ParOldGen       total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000)
+ Metaspace       used 26418K, capacity 26964K, committed 27264K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+}
+Event: 115.355 GC heap before
+{Heap before GC invocations=15 (full 1):
+ PSYoungGen      total 154624K, used 154231K [0x000000076c700000, 0x0000000777680000, 0x00000007c0000000)
+  eden space 152576K, 100% used [0x000000076c700000,0x0000000775c00000,0x0000000775c00000)
+  from space 2048K, 80% used [0x0000000776380000,0x000000077651dff0,0x0000000776580000)
+  to   space 9728K, 0% used [0x0000000776d00000,0x0000000776d00000,0x0000000777680000)
+ ParOldGen       total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000)
+ Metaspace       used 26418K, capacity 26964K, committed 27264K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+Event: 115.360 GC heap after
+Heap after GC invocations=15 (full 1):
+ PSYoungGen      total 150016K, used 1591K [0x000000076c700000, 0x0000000776f00000, 0x00000007c0000000)
+  eden space 147968K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000775780000)
+  from space 2048K, 77% used [0x0000000776d00000,0x0000000776e8dff0,0x0000000776f00000)
+  to   space 9216K, 0% used [0x0000000775d00000,0x0000000775d00000,0x0000000776600000)
+ ParOldGen       total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000)
+ Metaspace       used 26418K, capacity 26964K, committed 27264K, reserved 1073152K
+  class space    used 3204K, capacity 3367K, committed 3456K, reserved 1048576K
+}
+Event: 127.014 GC heap before
+{Heap before GC invocations=16 (full 1):
+ PSYoungGen      total 150016K, used 149559K [0x000000076c700000, 0x0000000776f00000, 0x00000007c0000000)
+  eden space 147968K, 100% used [0x000000076c700000,0x0000000775780000,0x0000000775780000)
+  from space 2048K, 77% used [0x0000000776d00000,0x0000000776e8dff0,0x0000000776f00000)
+  to   space 9216K, 0% used [0x0000000775d00000,0x0000000775d00000,0x0000000776600000)
+ ParOldGen       total 93184K, used 6908K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5abf178,0x00000006caf00000)
+ Metaspace       used 26464K, capacity 27028K, committed 27264K, reserved 1073152K
+  class space    used 3205K, capacity 3367K, committed 3456K, reserved 1048576K
+Event: 127.033 GC heap after
+Heap after GC invocations=16 (full 1):
+ PSYoungGen      total 144896K, used 1473K [0x000000076c700000, 0x0000000776d80000, 0x00000007c0000000)
+  eden space 143360K, 0% used [0x000000076c700000,0x000000076c700000,0x0000000775300000)
+  from space 1536K, 95% used [0x0000000775d00000,0x0000000775e70540,0x0000000775e80000)
+  to   space 9216K, 0% used [0x0000000776480000,0x0000000776480000,0x0000000776d80000)
+ ParOldGen       total 93184K, used 6916K [0x00000006c5400000, 0x00000006caf00000, 0x000000076c700000)
+  object space 93184K, 7% used [0x00000006c5400000,0x00000006c5ac1178,0x00000006caf00000)
+ Metaspace       used 26464K, capacity 27028K, committed 27264K, reserved 1073152K
+  class space    used 3205K, capacity 3367K, committed 3456K, reserved 1048576K
+}
+
+Deoptimization events (10 events):
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x0000000003181274 method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 116.483 Thread 0x0000000002381000 Uncommon trap: reason=range_check action=none pc=0x00000000032857bc method=sun.reflect.generics.parser.SignatureParser.current()C @ 34
+Event: 131.311 Thread 0x0000000002381000 Uncommon trap: reason=unstable_if action=reinterpret pc=0x0000000003324434 method=org.codehaus.jackson.impl.ReaderBasedParser.nextToken()Lorg/codehaus/jackson/JsonToken; @ 37
+
+Internal exceptions (10 events):
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 28> (0x0000000774722590) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 39> (0x0000000774723398) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 28> (0x0000000774724040) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 31> (0x0000000774724d40) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 29> (0x00000007747259e8) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 28> (0x00000007747266e0) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 32> (0x0000000774727458) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 32> (0x0000000774728060) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 116.483 Thread 0x0000000002381000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 31> (0x0000000774728c58) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
+Event: 119.647 Thread 0x0000000002381000 Exception <a 'java/net/ConnectException': Connection refused: connect> (0x0000000774aedd18) thrown at [C:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u101\7261\hotspot\src\share\vm\prims\jni.cpp, line 735]
+
+Events (10 events):
+Event: 2632.158 Executing VM operation: EnterInterpOnlyMode
+Event: 2632.158 Executing nested VM operation: Deoptimize
+Event: 2632.159 Executing nested VM operation: Deoptimize done
+Event: 2632.159 Executing VM operation: EnterInterpOnlyMode done
+Event: 2632.159 Executing VM operation: ChangeSingleStep
+Event: 2632.159 Executing VM operation: ChangeSingleStep done
+Event: 2632.160 Executing VM operation: ChangeSingleStep
+Event: 2632.160 Executing VM operation: ChangeSingleStep done
+Event: 2632.193 Executing VM operation: RedefineClasses
+Event: 2632.229 Executing VM operation: RedefineClasses done
+
+
+Dynamic libraries:
+0x000000013fd10000 - 0x000000013fd47000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\javaw.exe
+0x0000000077510000 - 0x00000000776ba000 	C:\WINDOWS\SYSTEM32\ntdll.dll
+0x00000000773f0000 - 0x000000007750f000 	C:\WINDOWS\system32\kernel32.dll
+0x000007fefd2e0000 - 0x000007fefd34a000 	C:\WINDOWS\system32\KERNELBASE.dll
+0x000007fefd600000 - 0x000007fefd6db000 	C:\WINDOWS\system32\ADVAPI32.dll
+0x000007fefe3e0000 - 0x000007fefe47f000 	C:\WINDOWS\system32\msvcrt.dll
+0x000007fefe480000 - 0x000007fefe49f000 	C:\WINDOWS\SYSTEM32\sechost.dll
+0x000007fefe510000 - 0x000007fefe63d000 	C:\WINDOWS\system32\RPCRT4.dll
+0x00000000772f0000 - 0x00000000773ea000 	C:\WINDOWS\system32\USER32.dll
+0x000007fefe4a0000 - 0x000007fefe507000 	C:\WINDOWS\system32\GDI32.dll
+0x000007feff730000 - 0x000007feff73e000 	C:\WINDOWS\system32\LPK.dll
+0x000007fefe820000 - 0x000007fefe8ea000 	C:\WINDOWS\system32\USP10.dll
+0x000007fefb4c0000 - 0x000007fefb6b4000 	C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_fa3b1e3d17594757\COMCTL32.dll
+0x000007fefd9e0000 - 0x000007fefda51000 	C:\WINDOWS\system32\SHLWAPI.dll
+0x000007fefd9b0000 - 0x000007fefd9de000 	C:\WINDOWS\system32\IMM32.DLL
+0x000007fefdff0000 - 0x000007fefe0f9000 	C:\WINDOWS\system32\MSCTF.dll
+0x000007fef9c10000 - 0x000007fef9c9a000 	C:\WINDOWS\system32\VSMAPIMon.dll
+0x000007fef27e0000 - 0x000007fef2887000 	C:\Program Files\McAfee\Host Intrusion Prevention\HcApi.dll
+0x00000000705b0000 - 0x00000000705bb000 	C:\Program Files\McAfee\Host Intrusion Prevention\HcThe.dll
+0x0000000055580000 - 0x0000000055652000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\msvcr100.dll
+0x000000006f5e0000 - 0x000000006fe7a000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\server\jvm.dll
+0x000007fefbda0000 - 0x000007fefbda9000 	C:\WINDOWS\system32\WSOCK32.dll
+0x000007feff6e0000 - 0x000007feff72d000 	C:\WINDOWS\system32\WS2_32.dll
+0x000007fefdfc0000 - 0x000007fefdfc8000 	C:\WINDOWS\system32\NSI.dll
+0x000007fefaee0000 - 0x000007fefaf1b000 	C:\WINDOWS\system32\WINMM.dll
+0x000007fefc5f0000 - 0x000007fefc5fc000 	C:\WINDOWS\system32\VERSION.dll
+0x00000000776e0000 - 0x00000000776e7000 	C:\WINDOWS\system32\PSAPI.DLL
+0x00000000711e0000 - 0x00000000711ef000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\verify.dll
+0x0000000065240000 - 0x0000000065269000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\java.dll
+0x0000000055540000 - 0x0000000055575000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\jdwp.dll
+0x00000000711d0000 - 0x00000000711d8000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\npt.dll
+0x00000000003b0000 - 0x00000000003c6000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\zip.dll
+0x000007fefe8f0000 - 0x000007feff67a000 	C:\WINDOWS\system32\SHELL32.dll
+0x000007fefdae0000 - 0x000007fefdce3000 	C:\WINDOWS\system32\ole32.dll
+0x000007fefd240000 - 0x000007fefd24f000 	C:\WINDOWS\system32\profapi.dll
+0x00000000711c0000 - 0x00000000711c9000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\dt_socket.dll
+0x000007fefaa20000 - 0x000007fefaa35000 	C:\WINDOWS\system32\NLAapi.dll
+0x000007fef7bc0000 - 0x000007fef7bd5000 	C:\WINDOWS\system32\napinsp.dll
+0x000007fef7ba0000 - 0x000007fef7bb9000 	C:\WINDOWS\system32\pnrpnsp.dll
+0x000007fefca20000 - 0x000007fefca75000 	C:\WINDOWS\System32\mswsock.dll
+0x000007fefc8a0000 - 0x000007fefc8fb000 	C:\WINDOWS\system32\DNSAPI.dll
+0x000007fef7b90000 - 0x000007fef7b9b000 	C:\WINDOWS\System32\winrnr.dll
+0x000007fef7b80000 - 0x000007fef7b90000 	C:\WINDOWS\system32\wshbth.dll
+0x000007fefa330000 - 0x000007fefa357000 	C:\WINDOWS\system32\IPHLPAPI.DLL
+0x000007fefa320000 - 0x000007fefa32b000 	C:\WINDOWS\system32\WINNSI.DLL
+0x000007fef95a0000 - 0x000007fef95f3000 	C:\WINDOWS\System32\fwpuclnt.dll
+0x000007fef7010000 - 0x000007fef7018000 	C:\WINDOWS\system32\rasadhlp.dll
+0x000007fefc2d0000 - 0x000007fefc2d7000 	C:\WINDOWS\System32\wshtcpip.dll
+0x000000006f380000 - 0x000000006f39a000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\net.dll
+0x000007fefca10000 - 0x000007fefca17000 	C:\WINDOWS\System32\wship6.dll
+0x000007fefca80000 - 0x000007fefca98000 	C:\WINDOWS\system32\CRYPTSP.dll
+0x000007fefc780000 - 0x000007fefc7c7000 	C:\WINDOWS\system32\rsaenh.dll
+0x000007fefd400000 - 0x000007fefd41e000 	C:\WINDOWS\system32\USERENV.dll
+0x000007fefd180000 - 0x000007fefd18f000 	C:\WINDOWS\system32\CRYPTBASE.dll
+0x000007fef9550000 - 0x000007fef9561000 	C:\WINDOWS\system32\dhcpcsvc6.DLL
+0x000007fef98c0000 - 0x000007fef98d8000 	C:\WINDOWS\system32\dhcpcsvc.DLL
+0x000000006f300000 - 0x000000006f311000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\nio.dll
+0x000007fefd120000 - 0x000007fefd177000 	C:\WINDOWS\system32\apphelp.dll
+0x0000000051ba0000 - 0x0000000051bc4000 	C:\Program Files\Java\jdk1.8.0_101\jre\bin\sunec.dll
+0x000007fef68d0000 - 0x000007fef69f5000 	C:\WINDOWS\system32\dbghelp.dll
+
+VM Arguments:
+jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:65399 -ea -Dlogback.configurationFile=src/test/resources/logback-test.xml -Dfile.encoding=Cp1252 
+java_command: org.testng.remote.RemoteTestNG -serport 65394 -protocol json -d C:\Users\md9897\Projects\d2-sdnc\ui-ci\test-output C:\Users\md9897\AppData\Local\Temp\testng-eclipse-914658768\testng-customsuite.xml
+java_class_path (initial): C:\Users\md9897\Desktop\eclipse\plugins\org.testng.eclipse_6.9.13.201609291640\lib\testng-remote.jar;C:\Users\md9897\Projects\d2-sdnc\ui-ci\target\test-classes;C:\Users\md9897\Projects\d2-sdnc\ui-ci\target\classes;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-java\2.45.0\selenium-java-2.45.0.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-chrome-driver\2.45.0\selenium-chrome-driver-2.45.0.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-remote-driver\2.45.0\selenium-remote-driver-2.45.0.jar;C:\Users\md9897\.m2\repository\cglib\cglib-nodep\2.1_3\cglib-nodep-2.1_3.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-api\2.45.0\selenium-api-2.45.0.jar;C:\Users\md9897\.m2\repository\org\seleniumhq\selenium\selenium-htmlunit-driver\2.45.0\selenium-htmlunit-driver-2.45.0.jar;C:\Users\md9897\.m2\repository\net\sourceforge\htmlunit\htmlunit\2.15\htmlunit-2.15.jar;C:\Users\md9897\.m2\repository\xalan\xalan\2.7.1\xalan-2.7.1.jar;C:\Users\md9897\.m2\repository\xalan\serializer\2.7.1\serializer-2.7.1.jar;C:\Users\md9897\.m2\repository\net\sourceforge\htmlunit\htmlunit-core-js\2.15\htmlunit-core-js-2.15.jar;C:\Users\md9897\.m2\repository\xerces\xercesImpl\2.11.0\xercesImpl-2.11.0.jar;C:\Users\md9897\.m2\repository\net\sourceforge\nekohtml\nekohtml\1.9.21\nekohtml-1.9.21.jar;C:\Users\md9897\.m2\repository\net\sourceforge\cssparser\cssparser\0.9.14\cssparser-0.9.14.jar;C:\Users\md9897\.m2\repository\org\w3c\css\sac\1.3\sac-1.3.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-websocket\8.1.15.v20140411\jetty-websocket-8.1.15.v20140411.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-util\8.1.15.v20140411\jetty-util-8.1.15.v20140411.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-io\8.1.15.v20140411\jetty-io-8.1.15.v20140411.jar;C:\Users\md9897\.m2\repository\org\eclipse\jetty\jetty-http\8.1.15.v20140411\jetty-http-8.1.15.v20140411.jar;C:\Users\md9897\.
+Launcher Type: SUN_STANDARD
+
+Environment Variables:
+PATH=C:\Program Files\Java\jdk1.8.0_101\jre\bin;C:/Program Files/Java/jre1.8.0_101/bin/server;C:/Program Files/Java/jre1.8.0_101/bin;C:/Program Files/Java/jre1.8.0_101/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\RSA SecurID Token Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\GitExtensions\;C:\HashiCorp\Vagrant\bin;C:\Program Files (x86)\WinSCP\;C:\Program Files (x86)\PuTTY\;C:\Program Files\nodejs\;C:\Users\md9897\AppData\Roaming\npm;C:\Users\md9897\Desktop\eclipse;
+USERNAME=md9897
+OS=Windows_NT
+PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
+
+
+
+---------------  S Y S T E M  ---------------
+
+OS: Windows 7 , 64 bit Build 7601 (6.1.7601.23543)
+
+CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 78 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx
+
+Memory: 4k page, physical 16432244k(7214352k free), swap 32862628k(23040548k free)
+
+vm_info: Java HotSpot(TM) 64-Bit Server VM (25.101-b13) for windows-amd64 JRE (1.8.0_101-b13), built on Jun 22 2016 01:21:29 by "java_re" with MS VC++ 10.0 (VS2010)
+
+time: Wed Nov 09 17:56:52 2016
+elapsed time: 2632 seconds (0d 0h 43m 52s)
+
diff --git a/ui-ci/pom.xml b/ui-ci/pom.xml
new file mode 100644
index 0000000..072a610
--- /dev/null
+++ b/ui-ci/pom.xml
@@ -0,0 +1,357 @@
+<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>
+
+	<artifactId>ui-ci</artifactId>
+	<description>Selenium tests for the SDnC Application</description>
+
+	<parent>
+		<groupId>org.openecomp.sdc</groupId>
+		<artifactId>sdc-main</artifactId>
+		<version>1.1.0-SNAPSHOT</version>
+	</parent>
+
+	<dependencies>
+		<dependency>
+			<groupId>com.google.guava</groupId>
+			<artifactId>guava</artifactId>
+			<version>${guava.version}</version>
+			<scope>compile</scope>
+		</dependency>
+	
+		<dependency>
+			<groupId>org.seleniumhq.selenium</groupId>
+			<artifactId>selenium-java</artifactId>
+			<version>2.53.1</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.seleniumhq.selenium</groupId>
+			<artifactId>selenium-server</artifactId>
+			<version>2.53.1</version>
+			<scope>runtime</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>commons-net</groupId>
+			<artifactId>commons-net</artifactId>
+			<version>3.3</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>2.4</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.openecomp.sdc</groupId>
+			<artifactId>test-apis-ci</artifactId>
+			<version>${project.version}</version>
+			<!--  <classifier>jar-with-dependencies</classifier> -->
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.yaml</groupId>
+			<artifactId>snakeyaml</artifactId>
+			<version>${snakeyaml.version}</version>
+			<scope>compile</scope>
+		</dependency>
+	    <dependency>
+			<groupId>org.functionaljava</groupId>
+			<artifactId>functionaljava</artifactId>
+			<version>${functionaljava.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+			<version>${gson.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- http client -->
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpclient</artifactId>
+            <version>${httpclient.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpmime</artifactId>
+            <version>${httpclient.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>commons-logging</groupId>
+			<artifactId>commons-logging</artifactId>
+            <version>${commons-logging}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+            <version>${slf4j-api.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>ch.qos.logback</groupId>
+			<artifactId>logback-classic</artifactId>
+            <version>${logback.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>ch.qos.logback</groupId>
+			<artifactId>logback-core</artifactId>
+            <version>${logback.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- http core -->
+		<dependency>
+			<groupId>org.apache.httpcomponents</groupId>
+			<artifactId>httpcore</artifactId>
+			<version>${httpcore.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- TITAN -->
+		<dependency>
+			<groupId>com.thinkaurelius.titan</groupId>
+			<artifactId>titan-core</artifactId>
+			<version>${titan.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.thinkaurelius.titan</groupId>
+			<artifactId>titan-cassandra</artifactId>
+			<version>${titan.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.codehaus.jackson</groupId>
+			<artifactId>jackson-mapper-asl</artifactId>
+			<version>1.9.2</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>2.3.1</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-core</artifactId>
+			<version>2.3.1</version>
+			<scope>compile</scope>
+		</dependency>
+		
+		<dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-annotations</artifactId>
+			<version>${jackson.annotations.version}</version>
+            <scope>compile</scope>
+       </dependency>
+
+		<dependency>
+			<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
+			<artifactId>sdc-distribution-client</artifactId>
+			<version>1.1.9-SNAPSHOT</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testng</groupId>
+			<artifactId>testng</artifactId>
+			<version>${testng.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>xml-apis</groupId>
+			<artifactId>xml-apis</artifactId>
+			<version>1.4.01</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.googlecode.json-simple</groupId>
+			<artifactId>json-simple</artifactId>
+			<version>${json-simple.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-jci-core</artifactId>
+			<version>${commons-jci-core.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.sikuli</groupId>
+			<artifactId>sikuli-api</artifactId>
+			<version>1.2.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.sikuli</groupId>
+			<artifactId>sikuli-core</artifactId>
+			<version>1.2.2</version>
+		</dependency>
+
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+            <version>${commons-codec}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+  			<groupId>com.aventstack</groupId>
+  			<artifactId>extentreports</artifactId>
+  			<version>3.0.6</version>
+  			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+            <groupId>net.lightbody.bmp</groupId>
+            <!-- To use the legacy, Jetty-based implementation, 
+             change the artifactId to browsermob-core -->
+            <artifactId>browsermob-core</artifactId>
+            <version>2.1.4</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>com.github.markusbernhardt</groupId>
+            <artifactId>proxy-vole</artifactId>
+            <version>1.0.2</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>com.paulhammant</groupId>
+            <artifactId>ngwebdriver</artifactId>
+            <version>0.9.7</version>
+            <scope>compile</scope>
+        </dependency>
+        	
+	</dependencies>
+
+	<build>
+		<plugins>
+
+			<!-- ================================================== -->
+			<!-- Get the next versions from the properties file. -->
+			<!-- ================================================== -->
+			<!--<plugin>-->
+				<!--<groupId>org.codehaus.mojo</groupId>-->
+				<!--<artifactId>properties-maven-plugin</artifactId>-->
+				<!--<version>1.0-alpha-1</version>-->
+				<!--<inherited>false</inherited>-->
+
+				<!--<executions>-->
+					<!--<execution>-->
+						<!--<id>ui-ci</id>-->
+						<!--<phase>initialize</phase>-->
+						<!--<goals>-->
+							<!--<goal>read-project-properties</goal>-->
+						<!--</goals>-->
+
+						<!--<configuration>-->
+							<!--<files>-->
+								<!--<file>../target/FullReleaseVersion.properties</file>-->
+							<!--</files>-->
+						<!--</configuration>-->
+					<!--</execution>-->
+				<!--</executions>-->
+			<!--</plugin>-->
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-deploy-plugin</artifactId>
+				<version>2.7</version>
+				<configuration>
+					<skip>true</skip>
+				</configuration>
+			</plugin>
+
+			<!-- ============================================= -->
+			<!-- Create the JAR file with its dependencies -->
+			<!-- ============================================= -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<version>2.5.5</version>
+				<executions>
+					<execution>
+						<id>create.jar.with.dependencies</id>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+						<configuration>
+							<archive>
+								<manifest>
+									<mainClass>org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest</mainClass>
+								</manifest>
+							</archive>
+							<descriptorRefs>
+								<descriptorRef>jar-with-dependencies</descriptorRef>
+							</descriptorRefs>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+	<profiles>
+		<profile>
+			<id>Fortify</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+			</activation>
+
+			<build>
+				<plugins>
+
+					<!-- =========================== -->
+					<!-- HP Fortify scanner -->
+					<!-- =========================== -->
+					<plugin>
+						<groupId>com.fortify.ps.maven.plugin</groupId>
+						<artifactId>sca-maven-plugin</artifactId>
+						<version>4.30</version>
+						<configuration>
+							<scanEnabled>false</scanEnabled>
+							<skip>true</skip>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+</project>
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
new file mode 100644
index 0000000..a8e6501
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/AddComponentInstancesArtifactsInCsar.java
@@ -0,0 +1,415 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+
+public class AddComponentInstancesArtifactsInCsar extends SetupCDTest {
+	
+	private String filePath;
+	@BeforeClass
+	public void beforeClass(){
+		filePath = System.getProperty("filepath");
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath() + "AddComponentInstancesArtifactsInCsar"+ File.separator;
+		}
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "AddComponentInstancesArtifactsInCsar"+ File.separator;
+		}
+	}
+	
+	// US847439 - Story [BE] - Add Component Instance's artifacts in CSAR
+	// TC1521795 - VF CSAR - The Flow
+	@Test
+	public void vfAndServicerCsarTheFlow() throws Exception{
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		String vnfFile = "FDNT.zip";
+		String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
+		
+		OnboardingUtils.createVendorLicense(getUser());
+		Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+		String vspName = createVSP.left;
+		resourceMetaData.setName(vspName);
+		Map<String, String> resourceMeta = createVSP.right;
+		String vspid = resourceMeta.get("vspId");
+		OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
+		OnboardingUtils.prepareVspForUse(getUser(), vspid);
+
+		HomePage.showVspRepository();
+		OnboardingUtils.importVSP(createVSP);
+		resourceMetaData.setVersion("0.1");
+		Resource vfResource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), resourceMetaData.getVersion());
+
+		
+		Map<String, Object> artifacts = getArtifactsOfComponentAndComponentsInstance(vfResource);
+
+		List<ImmutablePair<ComponentInstance, ArtifactDefinition>> artifactsUploadedToComponentInstance = new LinkedList<>();
+		Random random = new Random();
+		for(int i=0; i<random.nextInt(10) + 10; i++) {
+			ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomVfc = uploadArtifactOnRandomRI(vfResource);
+
+			if(uploadArtifactOnRandomVfc.getRight().getArtifactName() != null) {
+				artifactsUploadedToComponentInstance.add(uploadArtifactOnRandomVfc);
+			}
+		}
+		
+		if(artifactsUploadedToComponentInstance.size() > 0) {
+			Map<String, Object> artifactsOfResourceInstance = getArtifactsOfResourceInstance(artifactsUploadedToComponentInstance);
+			artifacts.put("Resources", artifactsOfResourceInstance);
+		}
+		
+		
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		ToscaArtifactsPage.downloadCsar();
+		File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		Map<String, Object> combineHeatArtifacstWithFolderArtifacsToMap = ArtifactFromCsar.getVFCArtifacts(latestFilefromDir.getAbsolutePath());
+		
+		compareArtifactFromFileStructureToArtifactsFromJavaObject(artifacts, combineHeatArtifacstWithFolderArtifacsToMap);
+		
+		
+//		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//		
+//		// Submit for testing + certify
+//		DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+//
+//		reloginWithNewRole(UserRoleEnum.TESTER);
+//		GeneralUIUtils.findComponentAndClick(vspName);
+//		TesterOperationPage.certifyComponent(vspName);
+//
+//		reloginWithNewRole(UserRoleEnum.DESIGNER);
+//		// create service
+//		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+//		ServiceUIUtils.createService(serviceMetadata, getUser());
+//		serviceMetadata.setVersion("0.1");
+//		
+//		
+//		// Upload informationl artifact to service
+//		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+//		
+//		String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+//		String DESCRIPTION = "kuku";
+//		String ARTIFACT_LABEL = "artifact3";
+//		
+//		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+//		CompositionPage.showDeploymentArtifactTab();
+//		CompositionPage.clickAddArtifactButton();
+//		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+//		
+//		ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+//		CompositionPage.showInformationArtifactTab();
+//		CompositionPage.clickAddArtifactButton();
+//		ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact, CompositionPage.artifactPopup());
+//		
+//		
+//		
+//		// Add component instance to canvas of the service
+//		CompositionPage.searchForElement(vspName);
+//		CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+//		CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+//		
+//		Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+//		
+////		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", "OTHER", true, false);
+////		RestResponse restResponse = ArtifactRestUtils.externalAPIUploadArtifactOfTheAsset(service, getUser(), artifactReqDetails);
+////		Integer responseCode = restResponse.getErrorCode();
+////		Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
+////		
+////		service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+//		
+//		Map<String, Object> artifactsService = getArtifactsOfComponentAndComponentsInstance(service);
+//		
+//		System.out.println("12354");
+//		
+//		artifactsService.put(vfResource.getToscaResourceName(), artifacts);
+//		
+//		System.out.println("1234");
+
+	}
+	
+	public void compareArtifactFromFileStructureToArtifactsFromJavaObject(Map<String, Object> artifactFromJavaObject, Map<String, Object> artifactsFromFileStructure) {
+		for(String key: artifactFromJavaObject.keySet()) {
+			if((!key.equals("Deployment")) && (!key.equals("Informational"))) {
+				Map<String, Object> newArtifactFromJavaObject = (Map<String, Object>) artifactFromJavaObject.get(key);
+				Map<String, Object> newArtifactsFromFileStructure = (Map<String, Object>) artifactsFromFileStructure.get(key);
+				compareArtifactFromFileStructureToArtifactsFromJavaObject(newArtifactFromJavaObject, newArtifactsFromFileStructure);
+			} else {
+				compareArtifacts(artifactFromJavaObject.get(key), artifactsFromFileStructure.get(key));
+			}
+			
+			
+			
+			
+		}
+	}
+	
+	
+	private void compareArtifacts(Object artifactFromJavaObject, Object artifactsFromFileStructure) {	
+		Map<String, List<String>> artifactsMap = (Map<String, List<String>>) artifactFromJavaObject;
+		List<HeatMetaFirstLevelDefinition> artifactsList = (List<HeatMetaFirstLevelDefinition>) artifactsFromFileStructure;
+
+		for(HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition: artifactsList) {
+			Assert.assertTrue(artifactsMap.get(heatMetaFirstLevelDefinition.getType()).contains(heatMetaFirstLevelDefinition.getFileName()), 
+					"Expected that artifacts will be the same. Not exists: " + heatMetaFirstLevelDefinition.getFileName() + " of type: " + heatMetaFirstLevelDefinition.getType());
+		}
+		
+		for(String key: artifactsMap.keySet()) {
+			List<String> artifacts = artifactsMap.get(key);
+			
+			for(HeatMetaFirstLevelDefinition heatMetaFirstLevelDefinition: artifactsList) {
+				if(heatMetaFirstLevelDefinition.getType().equals(key)) {
+					if(artifacts.contains(heatMetaFirstLevelDefinition.getFileName())) {
+						artifacts.remove(heatMetaFirstLevelDefinition.getFileName());
+					}
+				}
+			}
+			
+			Assert.assertEquals(artifacts.size(), 0, "Expected that all artifacts equal. There is artifacts which not equal: " + artifacts.toString());
+		}
+	}
+	
+
+	public Map<String, Object> getArtifactsOfResourceInstance(List<ImmutablePair<ComponentInstance, ArtifactDefinition>> riList) {
+		Map<String, Object> artifacts = new HashMap<>();
+		
+		for(ImmutablePair<ComponentInstance, ArtifactDefinition> ri: riList) {
+			ArtifactDefinition artifactDefinition = ri.getRight();
+			ComponentInstance componentInstance = ri.getLeft();
+			if(artifacts.containsKey(componentInstance.getNormalizedName())) {
+				if( ((Map<String, ArrayList<String>>)((Map<String, Object>)artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).containsKey(artifactDefinition.getArtifactType()) ) {
+
+					((Map<String, ArrayList<String>>)((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).get(artifactDefinition.getArtifactType()).add(artifactDefinition.getArtifactName());
+
+				} else {
+					ArrayList<String> list = new ArrayList<String>();
+					list.add(artifactDefinition.getArtifactName());				
+					((Map<String, ArrayList<String>>)((Map<String, Object>) artifacts.get(componentInstance.getNormalizedName())).get("Deployment")).put(artifactDefinition.getArtifactType(), list);
+				}	
+		
+			} else {
+				try {
+					
+					
+					ArrayList<String> list = new ArrayList<String>();
+					list.add(artifactDefinition.getArtifactName());
+					
+					Map<String, ArrayList<String>> map = new HashMap<>();
+					map.put(artifactDefinition.getArtifactType(), list);
+					
+					Map<String, Map<String, ArrayList<String>>> addMap = new HashMap<>();
+					addMap.put("Deployment", map);
+					
+					artifacts.put(componentInstance.getNormalizedName(), addMap);
+					
+//					if(artifacts.size() == 0) {
+//						artifacts.put("Deployment", addMap);
+//					} else {
+//						((Map<String, Map<String, ArrayList<String>>>) artifacts.get("Deployment")).putAll(addMap);
+//					}
+				} catch (Exception e) {
+					Assert.fail("Artifact name is null for componentInstance: " + componentInstance.getNormalizedName());
+				}
+			}
+		}
+		return artifacts;
+	}
+	
+	public Map<String, Object> getArtifactsOfComponentAndComponentsInstance(Component component) {
+		Map<String, Object> artifacts = getArtifacstOfComponent(component);
+		
+		for(ComponentInstance componentInstance: component.getComponentInstances()) {
+			Map<String, Object> artifacstOfComponentInstance = getArtifacstOfComponentInstance(componentInstance);
+			if(artifacstOfComponentInstance.size() > 0) {
+				artifacts.put(componentInstance.getToscaComponentName() + "." + componentInstance.getComponentVersion(), artifacstOfComponentInstance);
+			}
+		}
+		
+		return artifacts;
+	}
+	
+	public Map<String, Object> getArtifacstOfComponentInstance(ComponentInstance componentInstance) {
+		Map<String, Object> map = new HashMap<>();
+		
+		if(componentInstance.getArtifacts() != null) {
+			Map<String, Object> informationalArtifacts = getArtifacts(componentInstance.getArtifacts());
+			if(informationalArtifacts.size() > 0) {
+				map.put("Informational", informationalArtifacts);
+			}
+		}
+		
+		if(componentInstance.getDeploymentArtifacts() != null) {
+			Map<String, Object> deploymentArtifacts = getArtifacts(componentInstance.getDeploymentArtifacts());
+			if(deploymentArtifacts.size() > 0) {
+				map.put("Deployment", deploymentArtifacts);
+			}
+		}
+		
+		return map;
+	}
+	
+	public Map<String, Object> getArtifacstOfComponent(Component component) {
+		Map<String, Object> map = new HashMap<>();
+		
+		if(component.getArtifacts() != null) {
+			Map<String, Object> informationalArtifacts = getArtifacts(component.getArtifacts());
+			if(informationalArtifacts.size() > 0) {
+				map.put("Informational", informationalArtifacts);
+			}
+		}
+		
+		if(component.getDeploymentArtifacts() != null) {
+			Map<String, Object> deploymentArtifacts = getArtifacts(component.getDeploymentArtifacts());
+			if(deploymentArtifacts.size() > 0) {
+				map.put("Deployment", deploymentArtifacts);
+			}
+		}
+		
+		return map;
+	}
+	
+	public Map<String, Object> getArtifacts(Map<String, ArtifactDefinition> artifacts) {
+		Map<String, Object> map = new HashMap<>();
+		
+		for(String artifact: artifacts.keySet()) {
+			ArtifactDefinition artifactDefinition = artifacts.get(artifact);
+			if((artifactDefinition.getEsId() != null) && (!artifactDefinition.getEsId().equals("")) && (!artifactDefinition.getArtifactType().equals("HEAT_ENV"))) {
+				if(map.containsKey(artifactDefinition.getArtifactType())) {
+					((List<String>) map.get(artifactDefinition.getArtifactType())).add(artifactDefinition.getArtifactName());
+				} else {
+					ArrayList<String> list = new ArrayList<String>();
+					list.add(artifactDefinition.getArtifactName());
+					map.put(artifactDefinition.getArtifactType(), list);
+				}
+			}
+		}
+		
+		return map;
+	}
+	
+	public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Component component) throws IOException, Exception {
+		ArtifactReqDetails artifactReqDetails = getRandomArtifact();
+		Random random = new Random();
+		int randInt = random.nextInt(component.getComponentInstances().size());
+		User defaultUser = ElementFactory.getDefaultUser(getRole());
+		ComponentInstance componentInstance = component.getComponentInstances().get(randInt);
+		
+		RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(component, defaultUser, artifactReqDetails, componentInstance);
+		
+		// Check response of external API
+		Integer responseCode = uploadArtifactRestResponse.getErrorCode();
+		Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
+		
+		ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ArtifactRestUtils.getArtifactDataFromJson(uploadArtifactRestResponse.getResponse()));
+	
+		return pair;
+	}
+	
+	public ImmutablePair<ComponentInstance, ArtifactDefinition> uploadArtifactOnRandomRI(Resource resource) throws IOException, Exception {
+		ArtifactReqDetails artifactReqDetails = getRandomVfcArtifact();
+		Random random = new Random();
+		int randInt = random.nextInt(resource.getComponentInstances().size());
+		User defaultUser = ElementFactory.getDefaultUser(getRole());
+		ComponentInstance componentInstance = resource.getComponentInstances().get(randInt);
+		
+		RestResponse uploadArtifactRestResponse = ArtifactRestUtils.externalAPIUploadArtifactOfComponentInstanceOnAsset(resource, defaultUser, artifactReqDetails, componentInstance);
+		
+		
+		
+		// Check response of external API
+		Integer responseCode = uploadArtifactRestResponse.getErrorCode();
+		
+		if(responseCode.equals(404)) {
+			getExtendTest().log(Status.SKIP, String.format("DE271521"));
+			throw new SkipException("DE271521");			
+		}
+		
+		Assert.assertEquals(responseCode, (Integer)200, "Response code is not correct.");
+		
+		ImmutablePair<ComponentInstance, ArtifactDefinition> pair = ImmutablePair.of(componentInstance, ArtifactRestUtils.getArtifactDataFromJson(uploadArtifactRestResponse.getResponse()));
+	
+		return pair;
+	}
+	
+	public ArtifactReqDetails getRandomArtifact() throws IOException, Exception {
+		List<String> artifactsTypeList = Arrays.asList("Other");
+		return getRandomArtifact(artifactsTypeList);
+	}
+	
+	public ArtifactReqDetails getRandomVfcArtifact() throws IOException, Exception {
+		List<String> vfcArtifactsTypeList = Arrays.asList("DCAE_INVENTORY_TOSCA", "DCAE_INVENTORY_JSON", "DCAE_INVENTORY_POLICY", "DCAE_INVENTORY_DOC",
+				"DCAE_INVENTORY_BLUEPRINT", "DCAE_INVENTORY_EVENT", "SNMP_POLL", "SNMP_TRAP");
+		return getRandomArtifact(vfcArtifactsTypeList);
+	}
+	
+	public ArtifactReqDetails getRandomArtifact(List<String> artifactType) throws IOException, Exception {
+		Random random = new Random();
+		
+		ArtifactReqDetails artifactReqDetails = ElementFactory.getArtifactByType("ci", artifactType.get(random.nextInt(artifactType.size())), true, false);
+		return artifactReqDetails;
+	}
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java
new file mode 100644
index 0000000..913064b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/ImportUpdateInformationalDeploymentArtifacts.java
@@ -0,0 +1,343 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+import org.testng.SkipException;
+import org.testng.annotations.Test;
+
+public class ImportUpdateInformationalDeploymentArtifacts extends SetupCDTest {
+	
+	private String folder ="US747946";
+
+	// US747946 - Import artifacts to component instances
+	// TC1407822 - 	Import VFC Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
+	@Test
+	public void importVfvArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+		
+		if(true){
+			throw new SkipException("Open bug 197126");			
+		}
+		
+		String filePath = FileHandling.getFilePath(folder);
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		String fileName = "TC1407822.csar";
+		
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+		
+		List<String> snmpPollArtifactList = Stream
+				.of("base_cgi_frwl.mib", "base_vIECCF_volume.yml", "node_userdata_script.sh", "vendor-license-model.xml")
+				.collect(Collectors.toList());
+		List<String> snmpTrapArtifactList = Stream
+				.of("module_1_ixlt.mib", "module_1_ixlt.yaml")
+				.collect(Collectors.toList());
+		
+	
+		List<ArtifactDefinition> filteredArtifactNames = 
+				//Stream of component Instances
+				resource.getComponentInstances().stream()
+					//Stream of all the artifacts on all the component instances
+					.flatMap( e -> e.getDeploymentArtifacts().values().stream())
+					//filter relevant artifact types
+					.filter( e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()) || e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType()))
+					//collect to list
+					.collect(Collectors.toList());
+
+		
+		assertTrue("Not contain all SNMP TRAP artifacts.", filteredArtifactNames.stream()
+				.filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_TRAP.getType()))
+				.map(e -> e.getArtifactName())
+				.collect(Collectors.toList())
+				.containsAll(snmpTrapArtifactList));
+		
+		assertTrue("Not contain all SNMP POLL artifacts.", filteredArtifactNames.stream()
+				.filter(e -> e.getArtifactType().equals(ArtifactTypeEnum.SNMP_POLL.getType()))
+				.map(e -> e.getArtifactName())
+				.collect(Collectors.toList())
+				.containsAll(snmpPollArtifactList));
+		
+		filteredArtifactNames.stream()
+			.map(e->e.getArtifactDisplayName())
+			.collect(Collectors.toList())
+			.forEach(e -> {
+				assertTrue("Wrong artifact appear on deployment artifact UI page.", 
+						!GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + e));
+			});
+		
+	}
+	
+	
+	
+	// US747946 - Import artifacts to component instances
+	// TC1408044 - Import VFC Artifacts - Informational Artifacts on Single VFC
+	@Test
+	public void importVfcArtifactsInformationalArtifactsOnSingleVfc() throws Exception {
+		
+		if(true){
+			throw new SkipException("Open bug 197126");			
+		}
+		
+		String filePath = FileHandling.getFilePath(folder);
+		String fileName = "TC1408044.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+		
+		resource.getComponentInstances().forEach(e -> {
+			
+			if(e.getToscaComponentName().endsWith("heat.ltm")) {
+				Map<String, List<String>> artifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("module_1_ldsa.yaml", "vendor-license-model.xml"));
+						put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("module_2_ldsa.yaml", "vf-license-model.xml"));
+					}
+				};
+					
+				validateInformationalArtifactOnComponetInstance(e, artifactsMap, "heat.ltm");
+			}
+		});
+	}
+	
+	// TODO: Note there is performance issue with this CSAR
+	// US747946 - Import artifacts to component instances
+	// TC1407998 - Import VFC Artifacts - Deployment & Informational Artifacts - Multiple VFCs
+	@Test
+	public void importVfcArtifactsDeploymentAndInformationalArtifactsMultipleVfcs() throws Exception {
+		
+		if(true){
+			throw new SkipException("Open bug 197126");			
+		}
+		
+		String filePath = FileHandling.getFilePath(folder);
+		String fileName = "TC1407998.csar";
+			
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		
+//		resourceMetaData.setName("TC1407998");
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+			
+		resource.getComponentInstances().forEach(e -> {
+				
+			if(e.getToscaComponentName().endsWith("heat.ps")) {
+				Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("PS_DEPL_Poll1.mib", "PS_DEPL_Poll2.xml", "PS_DEPL_Poll3.yaml"));
+						put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("PS_DEPL_Trap1.mib", "PS_DEPL_Trap2.xml", "PS_DEPL_Trap3.sh", "PS_DEPL_Trap4.yml"));
+					}
+				};
+				validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ps");
+				
+				Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("PS_INFO_GUIDE1.yaml", "PS_INFO_GUIDE2.xml"));
+						put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("PS_INFO_OTHER1.yaml", "PS_INFO_OTHER2.xml"));
+					}
+				};
+				validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ps");
+				
+				
+			} else if (e.getToscaComponentName().endsWith("heat.sm")) {
+				Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("SM_DEPL_Poll1.mib", "SM_DEPL_Poll2.mib", "SM_DEPL_Poll3.xml"));
+						put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("SM_DEPL_Trap1.mib", "SM_DEPL_Trap2.xml"));
+					}
+				};
+				validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.sm");
+				
+				Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("SM_INFO_GUIDE1.yaml", "SM_INFO_GUIDE2.xml"));
+						put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("SM_INFO_OTHER1.yaml", "SM_INFO_OTHER2.xml"));
+					}
+				};
+				validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.sm");
+			}
+		});
+			
+	}
+	
+	// US747946 - Import artifacts to component instances
+	// TC1410352 - Import VFC Artifacts - Deployment Artifacts - Extra folder Under VFC-Identification
+	@Test
+	public void importVfcArtifactsDeploymentArtifactsExtraFolderUnderVfcIdentification() throws Exception {
+		
+		if(true){
+			throw new SkipException("Open bug 197126");			
+		}
+		
+		String filePath = FileHandling.getFilePath(folder);
+		String fileName = "TC1410352.csar";
+			
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		
+//		resourceMetaData.setName("TC1410352");
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+			
+		resource.getComponentInstances().forEach(e -> {
+				
+			if(e.getToscaComponentName().endsWith("heat.ltm")) {
+				Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("Poll1.mib", "Poll2.xml", "Poll3.sh", "Poll4.yml"));
+						put(ArtifactTypeEnum.SNMP_TRAP.getType(), Arrays.asList("Trap1.mib", "Trap2.yaml"));
+					}
+				};
+				validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm");
+				
+				Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("GUIDE1.yaml", "GUIDE2.xml"));
+						put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("OTHER1.yaml", "OTHER2.xml"));
+					}
+				};
+				validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ltm");
+			}
+		});
+	}
+	
+	
+	// US747946 - Import artifacts to component instances
+	// TC1410352 - Import VFC Artifacts - Deployment Artifacts - Invalid Artifact Type
+	@Test
+	public void importVfcArtifactsDeploymentArtifactsInvalidArtifactType() throws Exception {
+		
+		if(true){
+			throw new SkipException("Open bug 197126");			
+		}
+		
+		String filePath = FileHandling.getFilePath(folder);
+		String fileName = "TC1425032.csar";
+				
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+				
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+			
+//		resourceMetaData.setName("TC1425032");
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+				
+		resource.getComponentInstances().forEach(e -> {
+					
+			if(e.getToscaComponentName().endsWith("heat.ltm")) {
+				Map<String, List<String>> deployArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.SNMP_POLL.getType(), Arrays.asList("DeploySNMPPoll1.mib", "DeploySNMPPoll2.yml", "DeploySNMPPoll3.sh", "DeploySNMPPoll4.xml"));
+						put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("DeploySNMPTrapB1.mib", "DeploySNMPTrapB2.yaml"));
+					}
+				};
+				validateDeploymentArtifactOnComponetInstance(e, deployArtifactsMap, "heat.ltm");
+					
+				Map<String, List<String>> infoArtifactsMap = new HashMap<String, List<String>>() {
+					{
+						put(ArtifactTypeEnum.GUIDE.getType(), Arrays.asList("InfoGuide1.yaml", "InfoGuide2.xml"));
+						put(ArtifactTypeEnum.OTHER.getType(), Arrays.asList("InfoOther1.yaml", "InfoOther2.xml", "InfoInvalid1.yaml"));
+					}
+				};
+				validateInformationalArtifactOnComponetInstance(e, infoArtifactsMap, "heat.ltm");
+			}
+		});
+	}
+	
+	
+	private void validateInformationalArtifactOnComponetInstance(ComponentInstance instacne, Map<String, List<String>> artifactsMap, String endswith){
+		if(instacne.getToscaComponentName().endsWith(endswith) ){
+			Set<String> types = artifactsMap.keySet();
+
+			Map<String, List<ArtifactDefinition>> collect = instacne.getArtifacts().values().stream()
+					.filter( a -> types.contains(a.getArtifactType()))
+					.collect(Collectors.groupingBy( e -> e.getArtifactType()));
+				
+			types.forEach(m -> {
+				if(collect.containsKey(m)){
+					List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList());
+					boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found);
+					assertTrue("Not contain all artifact of type: " + m, isValid);
+				} else{
+					assertTrue("Contains informational artifact which not in provided list", false);
+				}
+			});
+		}
+	}
+	
+	private void validateDeploymentArtifactOnComponetInstance(ComponentInstance instacne, Map<String, List<String>> artifactsMap, String endswith){
+		if(instacne.getToscaComponentName().endsWith(endswith) ){
+			Set<String> types = artifactsMap.keySet();
+
+			Map<String, List<ArtifactDefinition>> collect = instacne.getDeploymentArtifacts().values().stream()
+					.filter( a -> types.contains(a.getArtifactType()))
+					.collect(Collectors.groupingBy( e -> e.getArtifactType()));
+		
+			types.forEach(m -> {
+				if(collect.containsKey(m)){
+					List<String> found = collect.get(m).stream().map(e -> e.getArtifactName()).collect(Collectors.toList());
+					boolean isValid = found.containsAll(artifactsMap.get(m)) && artifactsMap.get(m).containsAll(found);
+					assertTrue("Not contain all artifact of type: " + m, isValid);
+				} else{
+					assertTrue("Contains deployment artifact which not in provided list", false);
+				}
+			});
+		}
+	}
+	
+	
+
+	
+	
+	
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java
new file mode 100644
index 0000000..dff10db
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Inputs.java
@@ -0,0 +1,226 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertyPopup;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.TestException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+public class Inputs extends SetupCDTest {
+	
+	private static final String DESCRIPTION = "kuku";
+	private static final String ARTIFACT_LABEL = "artifact3";
+	private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+	private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+	private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+	private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+	private String filePath;
+	
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = FileHandling.getFilePath("");
+	}
+	
+	// TODO: There is defect that imported VFC checkin not appear in service until refresh
+	// TODO: add support for CP (there is no normative CP's with complex properties which can be selected - import one) - importVFCWithComplexProperty.yml
+	// TC1508249
+	// Delete Input declared from VLi/CPi in service level - Deleting an Input that was declared from Complex property.
+	@Test
+	public void  deletingAnInputThatWasDeclaredFromComplexProperty() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		Map<String, List<String>> resourceInstanceToProperty = new HashMap<>();
+		CompositionPage.searchForElement("ExtVL");
+		CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL");
+		canvasManager.clickOnCanvaElement(computeElement);
+		resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), Arrays.asList("network_homing", "instance_node_target"));
+		
+//		CompositionPage.searchForElement("ExtCP");
+//		computeElement = canvasManager.createElementOnCanvas("ExtCP");
+//		canvasManager.clickOnCanvaElement(computeElement);
+//		resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order");
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+		
+		
+		for(String element: resourceInstanceToProperty.keySet()) {
+			String propertyName = resourceInstanceToProperty.get(element).get(0);
+			String innerPropertyName = resourceInstanceToProperty.get(element).get(1);
+			String dataTestIdPropertyCheckbox = DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + propertyName;
+			
+			GeneralUIUtils.clickOnElementByText(element);
+			GeneralUIUtils.ultimateWait();
+			
+			InputsPage.clickOnProperty(propertyName);
+			
+			PropertyPopup propertyPopup = new PropertyPopup();
+			propertyPopup.selectPropertyRadioButton(innerPropertyName);
+			propertyPopup.clickSave();
+			
+			InputsPage.clickOnAddInputButton();
+			
+			// Verify that input checkbox selected
+			verifyPropertyCheckBoxSelected(dataTestIdPropertyCheckbox);
+			
+			InputsPage.deleteServiceInput(element, propertyName + "_" + innerPropertyName);
+			
+			// Trying to find deleted service input
+			try{
+				InputsPage.getServiceInput(element, propertyName + "_" + innerPropertyName);
+				assert(false);
+			} catch(TestException e){	
+				System.out.println("Verfied that service input deleted");
+			}
+			
+			// Verify that input checkbox not selected
+			verifyPropertyCheckBoxNotSelected(dataTestIdPropertyCheckbox);
+			
+			GeneralUIUtils.clickOnElementByText(element);
+			GeneralUIUtils.ultimateWait();
+		}
+		
+	}
+
+	
+	// TC1508248
+	// Delete inputs who come from CP/VL properties
+	@Test
+	public void  deleteInputsWhoComeFromCpVlProperties() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		Map<String, String> resourceInstanceToProperty = new HashMap<>();
+		CompositionPage.searchForElement("ExtVL");
+		CanvasElement computeElement = canvasManager.createElementOnCanvas("ExtVL");
+		canvasManager.clickOnCanvaElement(computeElement);
+		resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "network_role");
+		
+		CompositionPage.searchForElement("ExtCP");
+		computeElement = canvasManager.createElementOnCanvas("ExtCP");
+		canvasManager.clickOnCanvaElement(computeElement);
+		resourceInstanceToProperty.put(CompositionPage.getSelectedInstanceName(), "order");
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+		
+		
+		for(String element: resourceInstanceToProperty.keySet()) {
+			GeneralUIUtils.clickOnElementByText(element);
+			GeneralUIUtils.ultimateWait();
+			
+			WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+			InputsPage.clickOnVFInputCheckbox(webElementByTestID);
+			
+			InputsPage.clickOnAddInputButton();
+			
+			// Verify that input checkbox selected
+			verifyPropertyCheckBoxSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+			
+			InputsPage.deleteServiceInput(element, resourceInstanceToProperty.get(element));
+			
+			// Trying to find deleted service input
+			try{
+				InputsPage.getServiceInput(element, resourceInstanceToProperty.get(element));
+				assert(false);
+			} catch(TestException e){	
+				System.out.println("Verfied that service input deleted");
+			}
+			
+			// Verify that input checkbox not selected
+			verifyPropertyCheckBoxNotSelected(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_CHECKBOX.getValue() + resourceInstanceToProperty.get(element));
+			
+			GeneralUIUtils.clickOnElementByText(element);
+			GeneralUIUtils.ultimateWait();
+		}
+		
+	}
+	
+	
+	
+	
+	
+	
+	
+	public String verifyPropertyCheckBox(String dataTestId) {
+		WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(dataTestId);
+		webElementByTestID = webElementByTestID.findElement(By.className("tlv-checkbox-i"));
+		if(webElementByTestID.getAttribute("checked") == null) {
+			return "false";
+		}
+		return "true";
+	}
+	
+	public void verifyPropertyCheckBoxSelected(String dataTestId) {
+		if(!verifyPropertyCheckBox(dataTestId).equals("true")) {
+			Assert.assertEquals(true, false, "Expected that checkbox will be selected.");
+		}
+	}
+	
+	public void verifyPropertyCheckBoxNotSelected(String dataTestId) {
+		if(!verifyPropertyCheckBox(dataTestId).equals("false")) {
+			Assert.assertEquals(false, true, "Expected that checkbox will not be selected.");
+		}
+	}
+
+	public String getNormalizedName(String notNormalizedName) {
+		String normalizedName = notNormalizedName.toLowerCase();
+		normalizedName = normalizedName.replaceAll(" ", "");
+		
+		return normalizedName;
+	}
+	
+
+
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java
new file mode 100644
index 0000000..fb1798d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/LocalGeneralUtilities.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.json.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+
+import com.clearspring.analytics.util.Pair;
+
+public class LocalGeneralUtilities {
+
+	public LocalGeneralUtilities() {
+		// TODO Auto-generated constructor stub
+	}
+	public static final String FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\VNFs\\";
+	public static final String Env_FILE_PATH = FileHandling.getBasePath() + "\\src\\main\\resources\\Files\\Env_files\\";
+	public static String downloadPath = "C:\\Users\\th0695\\Downloads";
+
+public static String getValueFromJsonResponse(String response, String fieldName) {
+	try {
+		JSONObject jsonResp = (JSONObject) JSONValue.parse(response);
+		Object fieldValue = jsonResp.get(fieldName);
+		return fieldValue.toString();
+
+	} catch (Exception e) {
+		return null;
+	}
+
+}
+
+public static List<String> getValuesFromJsonArray(RestResponse message) throws Exception {
+	List<String> artifactTypesArrayFromApi = new ArrayList<String>();
+
+	org.json.JSONObject responseObject = new org.json.JSONObject(message.getResponse());
+	JSONArray jArr = responseObject.getJSONArray("componentInstances");
+
+	for (int i = 0; i < jArr.length(); i++) {
+		org.json.JSONObject jObj = jArr.getJSONObject(i);
+		String value = jObj.get("uniqueId").toString();
+
+		artifactTypesArrayFromApi.add(value);
+	}
+	return artifactTypesArrayFromApi;
+}
+
+public static String simpleOnBoarding(String fileName, String filePath,User user) throws Exception {
+	OnboardingUtils.createVendorLicense(user);
+	Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils
+			.createVendorSoftwareProduct(fileName, filePath, user);
+	String vspName = createVendorSoftwareProduct.left;
+	HomePage.showVspRepository();
+	OnboardingUtils.importVSP(createVendorSoftwareProduct);
+	GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()).click();
+	GeneralUIUtils.waitForLoader();
+	return vspName;
+}
+
+//check if file downloaded successfully.
+public static boolean isFileDownloaded(String downloadPath, String fileName) {
+	boolean flag = false;
+	File dir = new File(downloadPath);
+	File[] dir_contents = dir.listFiles();
+	for (int i = 0; i < dir_contents.length; i++) {
+		if (dir_contents[i].getName().equals(fileName))
+			return flag = true;
+	}
+	return flag;
+}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
new file mode 100644
index 0000000..949a20b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MIBsArtifactsOnResourceInstance.java
@@ -0,0 +1,269 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ArtifactRestUtils;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+public class MIBsArtifactsOnResourceInstance extends SetupCDTest {
+	
+	private String folder ="";
+	
+	@DataProvider(name="mibsArtifactCRUDUi") 
+	public static Object[][] dataProviderMibsArtifactCRUDUi() {
+		return new Object[][] {
+			{"mibsvFW_VFC.yml", ResourceTypeEnum.VFC},
+			{"mibsVL.yml", ResourceTypeEnum.VL},
+			{"mibsCP.yml", ResourceTypeEnum.CP}
+			};
+	}
+	
+	// US820414
+	// Artifact UI CRUD on VFC/VL/CP 
+	// TODO: Change download validation from download artifact via external API to UI
+	@Test(dataProvider="mibsArtifactCRUDUi")
+	public void mibsArtifactCRUDUi(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+		setLog("mibsArtifactCRUDUi");
+		String filePath = FileHandling.getFilePath(folder);
+		
+		if(true){
+			throw new SkipException("Open bug 197101");			
+		}
+		
+		// import Resource
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+		ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+		
+		// get resourceUUID from BE
+		String resourceUUID = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1").getUUID();
+		
+		// 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+			
+			assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+			
+			String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText();
+			ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "1", deploymentArtifact.getArtifactType(), true, true, true, false);
+			
+			// Verify that uploaded correct file by download artifact via external api
+			RestResponse restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString());
+			File file = new File(deploymentArtifact.getFilepath() + deploymentArtifact.getFilename());
+			String readFileToString = FileUtils.readFileToString(file);
+			Assert.assertEquals(restResponse.getResponse(), readFileToString);
+			
+			DeploymentArtifactPage.clickEditArtifact(deploymentArtifact.getArtifactLabel());
+			UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+			artifactPopup.loadFile(filePath, "CP.yml");
+			artifactPopup.clickDoneButton();
+			
+			assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+			Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText(), artifactUUID);
+			ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(deploymentArtifact.getArtifactLabel(), null, "2", deploymentArtifact.getArtifactType(), true, true, true, false);
+				
+			// Verify that updated correct file by download artifact via external api
+			artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + deploymentArtifact.getArtifactLabel()).getText();
+			restResponse = ArtifactRestUtils.getResourceDeploymentArtifactExternalAPI(resourceUUID, artifactUUID, ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER), ComponentTypeEnum.RESOURCE.toString());
+			file = new File(deploymentArtifact.getFilepath() + "CP.yml");
+			readFileToString = FileUtils.readFileToString(file);
+			Assert.assertEquals(restResponse.getResponse(), readFileToString);
+			
+			DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifact.getArtifactLabel());
+			DeploymentArtifactPage.clickOK();
+			
+			assertTrue("No artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(0));
+		}
+		
+	}
+
+	@DataProvider(name="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption") 
+	public static Object[][] dataProviderMibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption() {
+		return new Object[][] {
+			{"mibs1vFW_VFC.yml", ResourceTypeEnum.VFC},
+			// TODO: delete comment below when we will have support for VL on canvas
+//			{"mibs1VL.yml", ResourceTypeEnum.VL},
+			{"mibs1CP.yml", ResourceTypeEnum.CP}
+			};
+	}
+	
+	// US820414
+	// Import VFC/VL/CP, upload MIBs artifacts then drag it on VF & verify that deployment artifact have only download option
+	@Test(dataProvider="mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption")
+	public void mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption(String fileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
+
+		setLog("mibsArtifacsOnResourceInstanceShouldOnlyHaveDownloadOption");
+		
+		String filePath = FileHandling.getFilePath(folder);
+
+		// import Resource
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+		ResourceUIUtils.importVfc(resourceMetaData, filePath, fileName, getUser());
+		
+		// 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+		}
+		assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+		
+		// 3. Check-in DataProvider resource.
+		ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+		
+		// 4. Create VF.
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		// 5. Click on composition.
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		// 6. Drag created DataProvider resource to canvas.
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(resourceMetaData.getName());
+		CanvasElement resourceInstance = vfCanvasManager.createElementOnCanvas(resourceMetaData.getName());
+		
+		// 7. Click on DataProvider resource.
+		vfCanvasManager.clickOnCanvaElement(resourceInstance);
+		
+		// 8. Click on deployment artifacts in right menu.
+		CompositionPage.showDeploymentArtifactTab();
+		
+		// 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts.
+		// 10. Verify that only have download option.
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			// Hover over webelement -> check that only dowload button displayed
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+			Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true);
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false);
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false);
+		}
+
+
+	}
+
+	// US820414
+	// Create VF, upload MIBs artifacts then drag it on service & verify that deployment artifact have only download option
+	@Test
+	public void mibsArtifacsOnVFInstanceShouldOnlyHaveDownloadOption() throws Exception {
+		String filePath = FileHandling.getFilePath(folder);
+
+		// 1. Create VF.
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(resourceMetaData, getUser());
+			
+		// 2. Upload MIBs artifacts - SNMP_TRAP & SNMP_POLL.
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "SNMP_TRAP"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "SNMP_POLL"));
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true));
+		}
+		assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+		
+		// 3. Check-in VF.
+		ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+		
+		// 4. Create service.
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();		
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		// 5. Click on composition.
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			
+		// 6. Drag created DataProvider s to canvas.
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(resourceMetaData.getName());
+		CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+		
+		// 7. Click on DataProvider resource.
+		canvasManager.clickOnCanvaElement(resourceInstance);
+		
+		// 8. Click on deployment artifacts in right menu.
+		CompositionPage.showDeploymentArtifactTab();
+		
+		// 9. Verify that each uploaded MIBs artifacts shows in deployment artifacts.
+		// 10. Verify that only have download option.
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			// Hover over webelement -> check that only dowload button displayed
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+			Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + deploymentArtifact.getArtifactLabel()).isDisplayed(), true);
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + deploymentArtifact.getArtifactLabel()), false);
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + deploymentArtifact.getArtifactLabel());
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false);
+		}
+	}
+
+	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
new file mode 100644
index 0000000..179c300
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/MobProxy.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.util.List;
+
+import java.net.Proxy;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.remote.CapabilityType;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.testng.AssertJUnit;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.github.markusbernhardt.proxy.ProxySearch;
+import com.github.markusbernhardt.proxy.ProxySearch.Strategy;
+
+import net.lightbody.bmp.BrowserMobProxyServer;
+import net.lightbody.bmp.client.ClientUtil;
+import net.lightbody.bmp.core.har.Har;
+import net.lightbody.bmp.proxy.CaptureType;
+ 
+public class MobProxy {
+	public static WebDriver driver;
+	public static BrowserMobProxyServer server;
+ 
+	@BeforeClass
+	public void setup() throws Exception {
+		
+		ProxySearch proxySearch = new ProxySearch();
+		proxySearch.addStrategy(Strategy.OS_DEFAULT); 
+		proxySearch.addStrategy(Strategy.JAVA); 
+		proxySearch.addStrategy(Strategy.BROWSER); 
+		ProxySelector proxySelector = proxySearch.getProxySelector(); 
+
+		ProxySelector.setDefault(proxySelector); 
+		URI home = URI.create("http://www.google.com"); 
+		System.out.println("ProxySelector: " + proxySelector); 
+		System.out.println("URI: " + home); 
+		List<Proxy> proxyList = proxySelector.select(home); 
+		String host = null;
+		String port = null;
+		if (proxyList != null && !proxyList.isEmpty()) { 
+		 for (Proxy proxy : proxyList) { 
+		   System.out.println(proxy); 
+		   SocketAddress address = proxy.address(); 
+		   if (address instanceof InetSocketAddress) { 
+		     host = ((InetSocketAddress) address).getHostName(); 
+		     port = Integer.toString(((InetSocketAddress) address).getPort()); 
+		     System.setProperty("http.proxyHost", host); 
+		     System.setProperty("http.proxyPort", port); 
+		   } 
+		 } 
+		}
+		
+		server = new BrowserMobProxyServer();
+		InetSocketAddress address = new InetSocketAddress(host, Integer.parseInt(port));
+	    server.setChainedProxy(address);
+		server.start();
+		int port1 = server.getPort();
+		DesiredCapabilities seleniumCapabilities = new DesiredCapabilities();
+		seleniumCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
+		seleniumCapabilities.setCapability(CapabilityType.PROXY, ClientUtil.createSeleniumProxy(server));
+		driver = new FirefoxDriver(seleniumCapabilities);
+		server.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT);
+		System.out.println("Port started:" + port1);
+	}
+ 
+	@Test
+	public void first_test1() throws InterruptedException {
+ 
+		server.newHar("asdc.har");
+ 
+		driver.get("https://www.e-access.att.com/QA-SCRUM1/sdc1/portal#/dashboard");
+		driver.manage().window().maximize();
+		
+		WebElement userNameTextbox = driver.findElement(By.name("userid"));
+		userNameTextbox.sendKeys("m99121");
+		WebElement passwordTextbox = driver.findElement(By.name("password"));
+		passwordTextbox.sendKeys("66-Percent");
+		
+		WebElement submitButton = driver.findElement(By.name("btnSubmit"));
+		submitButton.click();
+		Thread.sleep(300);
+		WebElement buttonOK = driver.findElement(By.name("successOK"));
+		AssertJUnit.assertTrue(buttonOK.isDisplayed());
+		buttonOK.click();
+		Thread.sleep(2000);
+		driver.findElement(By.xpath(getXpath("main-menu-button-catalog"))).click();
+		Thread.sleep(2000);		
+		driver.findElement(By.xpath(getXpath("checkbox-service"))).click();
+		Thread.sleep(2000);
+	}
+	
+	public static String getXpath(String dataTestId){
+		return String.format("//*[@data-tests-id='%s']", dataTestId);
+	}
+ 
+	@AfterClass
+	public void shutdown() {
+		try {
+	        
+			// Get the HAR data
+			Har har = server.getHar();
+			File harFile = new File("C:\\temp\\asdc.har");
+			har.writeTo(harFile);
+ 
+		} catch (IOException ioe) {
+			ioe.printStackTrace();
+		}
+		driver.quit();
+		server.stop();
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
new file mode 100644
index 0000000..9d460b0
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/NewArtifactTypeGuide.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class NewArtifactTypeGuide extends SetupCDTest {
+	
+	private String folder ="";
+
+	// US820276
+	// Upload information artifact of type GUIDE to VF
+	@Test
+	public void crudGuideInformationArtifactForVf() throws Exception {
+		String filePath = FileHandling.getFilePath(folder);
+
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(resourceMetaData, getUser());
+			
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+
+		InformationalArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
+		
+		assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+		
+		String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
+		ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
+		
+		InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
+		UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+		artifactPopup.loadFile(filePath, "CP.yml");
+		artifactPopup.clickDoneButton();
+		
+		assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+		Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
+		ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
+		
+		InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
+		InformationalArtifactPage.clickOK();
+	}
+	
+	// US820276
+	// Upload information artifact of type GUIDE to VFC
+	@Test
+	public void crudGuideInformationArtifactForVfc() throws Exception {
+		String filePath = FileHandling.getFilePath(folder);
+
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VFC, getUser());
+		ResourceUIUtils.importVfc(resourceMetaData, filePath, "guidevFW_VFC.yml", getUser());
+			
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		ArtifactInfo informationArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "GUIDE");
+
+		InformationalArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(informationArtifact);
+		
+		assertTrue("Only created artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+		String artifactUUID = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText();
+		ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "1", informationArtifact.getArtifactType(), true, true, true, false);
+		
+		InformationalArtifactPage.clickEditArtifact(informationArtifact.getArtifactLabel());
+		UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+		artifactPopup.loadFile(filePath, "CP.yml");
+		artifactPopup.clickDoneButton();
+		
+		assertTrue("Only updated artifact need to be exist", DeploymentArtifactPage.checkElementsCountInTable(1));
+		Assert.assertNotEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + informationArtifact.getArtifactLabel()).getText(), artifactUUID);
+		ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(informationArtifact.getArtifactLabel(), null, "2", informationArtifact.getArtifactType(), true, true, true, false);
+		
+		InformationalArtifactPage.clickDeleteArtifact(informationArtifact.getArtifactLabel());
+		InformationalArtifactPage.clickOK();
+	}
+
+	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
new file mode 100644
index 0000000..1f85ec2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/RemoveRestrictionOfDeploymentArtifacts.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.annotations.Test;
+
+
+public class RemoveRestrictionOfDeploymentArtifacts extends SetupCDTest {
+	
+	private String folder ="";
+
+	// US833330 - Story [BE] - remove restriction of deployment artifacts
+	// Create service without resource instance and without deployment artifacts and verify it can submit for testing
+	@Test
+	public void createServiceWithoutRIAndArtifacts() throws Exception {
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+	}
+	
+	
+	// US833330 - Story [BE] - remove restriction of deployment artifacts
+	// Create service with VL resource instance and without deployment artifacts and verify it can submit for testing
+	@Test
+	public void createServiceWithVlAndWithoutArtfiacts() throws Exception {
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+				
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();			
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+		canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+		canvasManager.createElementOnCanvas(LeftPanelCanvasItems.NETWORK);
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+	}
+	
+	// US833330 - Story [BE] - remove restriction of deployment artifacts
+	// Create service with VF with informational artifacts and verify it can submit for testing
+	@Test
+	public void createServiceWithInformationalArtifacts() throws Exception {
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(resourceMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+				
+		String filePath = FileHandling.getFilePath(folder);
+		List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
+		informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+		informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "GUIDE"));
+		for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+			InformationalArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact, new UploadArtifactPopup(true));
+		}
+		ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
+		TesterOperationPage.certifyComponent(resourceMetaData.getName());
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement resourceInstance = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+	}
+	
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
new file mode 100644
index 0000000..80801af
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Service_Tests_UI.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+
+public class Service_Tests_UI extends SetupCDTest{
+
+	public Service_Tests_UI() {
+		// TODO Auto-generated constructor stub
+	}
+	
+	// US839610 - E2E Declare VL / CP properties as inputs in service level
+	@Test
+	public void declareVL_CP_InputsInServiceLevel() throws Exception {
+		String vnfFile = "FDNT.zip";
+		Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
+		ServiceUIUtils.createService(servicemetadata, getUser());
+		GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+		CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(VspName.left);
+		GeneralUIUtils.waitForLoader();
+		CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
+				.click();
+		GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
+		GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
+		GeneralUIUtils.getWebElementByTestID("inputs-vf-instance-1").click();
+//		GeneralUIUtils.onNameClicked(input);
+	}
+	@Test
+	public void CreateServiceWithCpInstance() throws Exception {
+		String vnfFile = "FDNT.zip";
+		Pair<String,Map<String,String>> VspName =OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		ServiceReqDetails servicemetadata = ElementFactory.getDefaultService(getUser());
+		ServiceUIUtils.createService(servicemetadata, getUser());
+		GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+		CanvasManager service_CanvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(VspName.left);
+		GeneralUIUtils.waitForLoader();
+		CanvasElement vfi_Element = service_CanvasManager.createElementOnCanvas(VspName.left);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue())
+				.click();
+		GeneralUIUtils.findComponentAndClick(servicemetadata.getName());
+		GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
+		String version = GeneralUIUtils.getWebElementByTestID("versionHeader").getText();
+		RestResponse service = ServiceRestUtils.getServiceByNameAndVersion(getUser(), servicemetadata.getName(),
+				version.substring(1));
+		List<String> serviceResponseArray = new ArrayList<String>();
+		serviceResponseArray =LocalGeneralUtilities.getValuesFromJsonArray(service);
+		servicemetadata.setUniqueId(serviceResponseArray.get(0));
+		RestResponse serviceResponse = ServiceRestUtils.getService(servicemetadata, getUser());
+		if (serviceResponseArray.get(0).contains("VL")) {
+			System.out.println("OK");
+		}
+
+	}
+
+	@Override
+	protected UserRoleEnum getRole() {
+		// TODO Auto-generated method stub
+		return UserRoleEnum.DESIGNER;
+	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
new file mode 100644
index 0000000..089ad95
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Testing.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.testng.Assert;
+
+
+
+
+
+
+public class Testing {
+
+	public static void main(String[] args) throws Exception {
+		// TODO Auto-generated method stub
+
+		File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+		ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+		
+		Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+		vl_us831517_1.put("property_1", true);
+		vl_us831517_1.put("property_2", "init_value_2");
+		vl_us831517_1.put("property_3", "init_value_3");
+		
+		
+		Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+		vl_us831517_2.put("property_1", false);
+		vl_us831517_2.put("property_2", "init_value_2");
+		vl_us831517_2.put("property_3", "new_value_3");
+		
+		Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+		vl_us831517_3.put("property_1", true);
+		vl_us831517_3.put("property_2", "init_value_2");
+		vl_us831517_3.put("property_3", "init_value_3");
+		vl_us831517_3.put("property_4", false);
+		vl_us831517_3.put("property_5", "init_value_5");
+		
+		Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+		predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+		predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+		predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+		
+		validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+		
+		
+		
+	}
+	
+	
+	
+	private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
+		
+		for(String key: predefinedMap.keySet()) {
+			Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
+			
+			predefinedMap.get(key).forEach((i,j) -> {
+				Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
+			});
+		}
+
+	}
+	
+	// Get properties by type
+	private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
+		Map<String, Object> propertiesMap = null;
+		
+		Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
+		
+		for(String nodeTemplate: nodeTemplates) {
+			String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
+			currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
+			if(currentNodeTemplateType.equals(nodeTemplateType)) {
+				propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
+				break;
+			}
+		}
+		
+		return propertiesMap;
+	}
+	
+	// Get node templates
+	private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
+		Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
+		return resourceInstanceArray;
+	}
+	
+	// Get type of node template
+	private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
+		return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
+	}
+	
+	// Get properties of node template
+	private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
+		Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
+		return propertiesMap;
+	}
+	
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
new file mode 100644
index 0000000..a038c28
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/VfModule.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import static org.testng.AssertJUnit.assertNotNull;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.CsarParserUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+import com.aventstack.extentreports.Status;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class VfModule extends SetupCDTest {
+
+
+	@Test
+	public void checkVfModulesCountAndStructure() throws Exception, AWTException {
+
+//		String filepath = "src\\main\\resources\\Files\\VNFs";
+		String filepath = FileHandling.getVnfRepositoryPath();
+//		String vnfFile = "LDSA.zip";
+		String vnfFile = "FDNT.zip";
+		getExtendTest().log(Status.INFO, String.format("Going to onboard the VNF %s......", vnfFile));
+		System.out.println(String.format("Going to onboard the VNF %s......", vnfFile));
+
+		OnboardingUtils.createVendorLicense(getUser());
+		Pair<String, Map<String, String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser());
+		String vspName = createVendorSoftwareProduct.left;
+		//
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
+		File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition = CsarParserUtils.getListTypeHeatMetaDefinition(latestFilefromDir);
+		//
+		getExtendTest().log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
+		HomePage.showVspRepository();
+		getExtendTest().log(Status.INFO, String.format("Going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+
+		OnboardingUtils.importVSP(createVendorSoftwareProduct);
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		
+		// Verify deployment artifacts
+		Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
+		LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+		for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+			if(deploymentArtifact.getType().equals("HEAT_ENV")) {
+				continue;
+			}
+			System.out.println("--------------");
+			System.out.println(deploymentArtifact.getFileName());
+			System.out.println(deploymentArtifact.getType());
+//			System.out.println(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")));
+			if(deploymentArtifact.getFileName().contains(".")) {
+				ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType());
+			} else {
+				ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType());
+			}
+			
+		}
+		
+		DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+
+		DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+
+		// create service
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+
+		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CompositionPage.searchForElement(vspName);
+		CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+		assertNotNull(vfElement);
+		ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+		latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		
+//		verification
+		Service service = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, serviceMetadata.getName(), serviceMetadata.getVersion());
+		ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(latestFilefromDir);
+
+//		compare number of vf modules defined in HEAT.meta file vs Service TOSCA yaml
+		VfModuleVerificator.compareNumberOfVfModules(listTypeHeatMetaDefinition, toscaDefinition);
+		VfModuleVerificator.verifyGroupMetadata(toscaDefinition, service);
+
+		getExtendTest().log(Status.INFO, String.format("Onboarding %s test is passed ! ", vnfFile));
+
+	}
+
+	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
new file mode 100644
index 0000000..71c2612
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/Vf_Tests_UI.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ArtifactPageEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class Vf_Tests_UI extends SetupCDTest{
+
+	public Vf_Tests_UI() {
+		// TODO Auto-generated constructor stub
+	}
+	public void uploadHeatEnvVFLevel() throws Exception {
+		
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+	}
+	
+//	@Test
+//	// Download ENV file from VF level.
+//	public void downloadEnvVFLevel() throws AWTException, Exception {
+//		String firstEnvArtifact = "base_stsi_dnt_frwl.env";
+//		String secondEnvArtifact = "mod_vmsi_dnt_fw_parent.env";
+//		String filePath=Config.instance().getWindowsDownloadDirectory();
+//		String vnfFile = "FDNT.zip";
+//	    OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+//		Map<String,File> mD5OfFilesToValidate = new HashMap<String,File>();
+//		mD5OfFilesToValidate.put(firstEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + firstEnvArtifact));
+//		mD5OfFilesToValidate.put(secondEnvArtifact,new File(FileHandling.getResourcesEnvFilesPath() + secondEnvArtifact));
+//		List<File>filesToBeDeleted=new ArrayList<>(mD5OfFilesToValidate.values());
+//		FileHandling.deleteLastDowloadedFiles(filesToBeDeleted);
+//		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+//		List<WebElement> allDisplayedArtifcats = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
+//		for (int i=0;i<allDisplayedArtifcats.size();i++) {
+//			if (DeploymentArtifactPage.geteArtifactType(allDisplayedArtifcats.get(i).getText()).equalsIgnoreCase("heat")) {
+//				DeploymentArtifactPage.clickDownloadEnvArtifact(allDisplayedArtifcats.get(i));
+//				GeneralUIUtils.waitForLoader();
+//				File latestFilefromDir = FileHandling.getRequiredFromDir(filePath,allDisplayedArtifcats.get(i).getText()+".env");
+//				VfVerificator.verifyFilesChecksum(latestFilefromDir,mD5OfFilesToValidate.get(latestFilefromDir.getName()));
+//
+//			}
+//		}
+//	}
+	@Override
+	protected UserRoleEnum getRole() {
+		// TODO Auto-generated method stub
+		return UserRoleEnum.DESIGNER;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
new file mode 100644
index 0000000..291a1db
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/US/extendNode_TemplatePropertiesWithDefaultValues.java
@@ -0,0 +1,299 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.US;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Set;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+
+public class extendNode_TemplatePropertiesWithDefaultValues extends SetupCDTest {
+
+	@DataProvider(name="customizeServiceVfUsedVlsCps") 
+	public static Object[][] dataProviderCustomizeServiceVfUsedVlsCps() {
+		return new Object[][] {
+//			{"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.SERVICE},
+			{"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.SERVICE},
+			{"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.RESOURCE},
+			{"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.RESOURCE},
+			};
+	}
+	
+	// US831517 - Story [BE] - Extend node_template properties with default values
+	@Test(dataProvider="customizeServiceVfUsedVlsCps")
+	public void customizeServiceVfUsedVlsCps(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum, ComponentTypeEnum componentTypeEnum) throws Exception {
+		setLog("Extend node_template properties with default values");
+
+		// import Resource
+		LinkedList<String> assetsName = importThreeAsset(fileName_vl1, fileName_vl2, fileName_vl3, resourceTypeEnum);
+		
+		if(ComponentTypeEnum.SERVICE == componentTypeEnum) {
+			ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+			ServiceUIUtils.createService(serviceMetadata, getUser());
+		} else {
+			ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			ResourceUIUtils.createResource(resourceMetaData, getUser());
+		}
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();		
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement resourceInstance1 = canvasManager.createElementOnCanvas(assetsName.get(0));
+		CanvasElement resourceInstance2 = canvasManager.createElementOnCanvas(assetsName.get(1));
+		CanvasElement resourceInstance3 = canvasManager.createElementOnCanvas(assetsName.get(2));
+		
+		canvasManager.clickOnCanvaElement(resourceInstance1);
+		CompositionPage.showPropertiesAndAttributesTab();
+		PropertiesUIUtils.changePropertyDefaultValueInComposition("property_1", "false");
+		
+		canvasManager.clickOnCanvaElement(resourceInstance2);
+		CompositionPage.showPropertiesAndAttributesTab();
+		PropertiesUIUtils.changePropertyDefaultValueInComposition("property_3", "customize");
+		
+		canvasManager.clickOnCanvaElement(resourceInstance3);
+		CompositionPage.showPropertiesAndAttributesTab();
+		PropertiesUIUtils.changePropertyDefaultValueInComposition("property_2", "customize derived");
+		PropertiesUIUtils.changePropertyDefaultValueInComposition("property_5", "customize new");
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+		
+		// TODO: Replace it by automatic download to path
+		// TODO: After it remove
+		File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+		ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+		
+		Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+		vl_us831517_1.put("property_1", false);
+		vl_us831517_1.put("property_2", "init_value_2");
+		vl_us831517_1.put("property_3", "init_value_3");
+		
+		
+		Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+		vl_us831517_2.put("property_1", false);
+		vl_us831517_2.put("property_2", "init_value_2");
+		vl_us831517_2.put("property_3", "customize");
+		
+		Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+		vl_us831517_3.put("property_1", true);
+		vl_us831517_3.put("property_2", "customize derived");
+		vl_us831517_3.put("property_3", "init_value_3");
+		vl_us831517_3.put("property_4", false);
+		vl_us831517_3.put("property_5", "customize new");
+		
+		Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+		predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+		predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+		predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+		
+		validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+		
+		RestCDUtils.deleteOnDemand();
+	}
+	
+	@DataProvider(name="serviceVfUsedVlsCps") 
+	public static Object[][] dataProviderServiceVfUsedVlsCps() {
+		return new Object[][] {
+			{"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.SERVICE},
+			{"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.SERVICE},
+			{"VL_US831517_1.yml", "VL_US831517_2.yml", "VL_US831517_3.yml", ResourceTypeEnum.VL, ComponentTypeEnum.RESOURCE},
+			{"CP_US831517_1.yml", "CP_US831517_2.yml", "CP_US831517_3.yml", ResourceTypeEnum.CP, ComponentTypeEnum.RESOURCE},
+			};
+	}
+	
+	
+	// US831517 - Story [BE] - Extend node_template properties with default values
+	@Test(dataProvider="serviceVfUsedVlsCps")
+	public void serviceVfUsedVlsCps(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum, ComponentTypeEnum componentTypeEnum) throws Exception {
+		setLog("Extend node_template properties with default values");
+
+		// import Resource
+		LinkedList<String> assetsName = importThreeAsset(fileName_vl1, fileName_vl2, fileName_vl3, resourceTypeEnum);
+		
+		if(ComponentTypeEnum.SERVICE == componentTypeEnum) {
+			ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+			ServiceUIUtils.createService(serviceMetadata, getUser());
+		} else {
+			ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			ResourceUIUtils.createResource(resourceMetaData, getUser());
+		}
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();		
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		canvasManager.createElementOnCanvas(assetsName.get(0));
+		canvasManager.createElementOnCanvas(assetsName.get(1));
+		canvasManager.createElementOnCanvas(assetsName.get(2));
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_TEMPLATE.getValue());
+		
+		// TODO: Replace it by automatic download to path
+		// TODO: After it remove
+		File path = new File("C:\\Users\\rp955r\\Desktop\\US\\US831517\\TCExport\\TC1459238.yml");
+		ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(path);
+		
+		Map<String, Object> vl_us831517_1 = new HashMap<String, Object>();
+		vl_us831517_1.put("property_1", true);
+		vl_us831517_1.put("property_2", "init_value_2");
+		vl_us831517_1.put("property_3", "init_value_3");
+		
+		
+		Map<String, Object> vl_us831517_2 = new HashMap<String, Object>();
+		vl_us831517_2.put("property_1", false);
+		vl_us831517_2.put("property_2", "init_value_2");
+		vl_us831517_2.put("property_3", "new_value_3");
+		
+		Map<String, Object> vl_us831517_3 = new HashMap<String, Object>();
+		vl_us831517_3.put("property_1", true);
+		vl_us831517_3.put("property_2", "init_value_2");
+		vl_us831517_3.put("property_3", "init_value_3");
+		vl_us831517_3.put("property_4", false);
+		vl_us831517_3.put("property_5", "init_value_5");
+		
+		Map<String, Map<String, Object>> predefinedProperties = new HashMap<String, Map<String, Object>>();
+		predefinedProperties.put("VL_US831517_1", vl_us831517_1);
+		predefinedProperties.put("VL_US831517_2", vl_us831517_2);
+		predefinedProperties.put("VL_US831517_3", vl_us831517_3);
+		
+		validateNodeTemplatesProperties(predefinedProperties, toscaDefinition);
+		
+		RestCDUtils.deleteOnDemand();
+	}
+	
+	private LinkedList<String> importThreeAsset(String fileName_vl1, String fileName_vl2, String fileName_vl3, ResourceTypeEnum resourceTypeEnum) throws Exception {
+		LinkedList<String> assetsNames = new LinkedList<String>();
+		
+		String filePath = System.getProperty("filepath");
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath() + File.separator + "US831517" + File.separator;
+		}
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "US831517" + File.separator;
+		}
+		
+		// import Resource
+		ResourceReqDetails resourceMetaDataVl1 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+		assetsNames.add(resourceMetaDataVl1.getName());
+		ResourceUIUtils.importVfc(resourceMetaDataVl1, filePath, fileName_vl1, getUser());
+		GeneralPageElements.clickSubmitForTestingButton(resourceMetaDataVl1.getName());
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(resourceMetaDataVl1.getName());
+		TesterOperationPage.certifyComponent(resourceMetaDataVl1.getName());
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		ResourceReqDetails resourceMetaDataVl2 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+		assetsNames.add(resourceMetaDataVl2.getName());
+		ResourceUIUtils.importVfc(resourceMetaDataVl2, filePath, fileName_vl2, getUser());
+		GeneralPageElements.clickCheckinButton(resourceMetaDataVl2.getName());
+		
+		ResourceReqDetails resourceMetaDataVl3 = ElementFactory.getDefaultResourceByType(resourceTypeEnum, getUser());
+		assetsNames.add(resourceMetaDataVl3.getName());
+		ResourceUIUtils.importVfc(resourceMetaDataVl3, filePath, fileName_vl3, getUser());
+		GeneralPageElements.clickCheckinButton(resourceMetaDataVl2.getName());
+		
+		return assetsNames;
+	}
+	
+	
+	private static void validateNodeTemplatesProperties(Map<String, Map<String, Object>> predefinedMap, ToscaDefinition toscaDefinition) {
+		
+		for(String key: predefinedMap.keySet()) {
+			Map<String, Object> nodeTemplateProperties = getNodeTemplatePropertiesByNodeTemplateType(key, toscaDefinition);
+			
+			predefinedMap.get(key).forEach((i,j) -> {
+				Assert.assertEquals(nodeTemplateProperties.get(i), j, "Expected that the properties will be equal");
+			});
+		}
+
+	}
+	
+	// Get properties by type
+	private static Map<String, Object> getNodeTemplatePropertiesByNodeTemplateType(String nodeTemplateType, ToscaDefinition toscaDefinition) {
+		Map<String, Object> propertiesMap = null;
+		
+		Set<String> nodeTemplates = getNodeTemplates(toscaDefinition);
+		
+		for(String nodeTemplate: nodeTemplates) {
+			String currentNodeTemplateType = getNodeTemplateType(toscaDefinition, nodeTemplate);
+			currentNodeTemplateType = currentNodeTemplateType.substring(currentNodeTemplateType.lastIndexOf(".") + 1);
+			if(currentNodeTemplateType.equals(nodeTemplateType)) {
+				propertiesMap = getNodeTemplateProperties(toscaDefinition, nodeTemplate);
+				break;
+			}
+		}
+		
+		return propertiesMap;
+	}
+	
+	// Get node templates
+	private static Set<String> getNodeTemplates(ToscaDefinition toscaDefinition) {
+		Set<String> resourceInstanceArray = toscaDefinition.getTopology_template().getNode_templates().keySet();
+		return resourceInstanceArray;
+	}
+	
+	// Get type of node template
+	private static String getNodeTemplateType(ToscaDefinition toscaDefinition, String nodeTemplate) {
+		return toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getType();
+	}
+		
+	// Get properties of node template
+	private static Map<String, Object> getNodeTemplateProperties(ToscaDefinition toscaDefinition, String nodeTemplate) {
+		Map<String, Object> propertiesMap = toscaDefinition.getTopology_template().getNode_templates().get(nodeTemplate).getProperties();
+		return propertiesMap;
+	}
+	
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
new file mode 100644
index 0000000..6dce83f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/businesslogic/ArtifactBusinessLogic.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.businesslogic;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.HeatAndHeatEnvNamesPair;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+
+import com.clearspring.analytics.util.Pair;
+
+public class ArtifactBusinessLogic {
+
+	private final static String[] okFileExtensions = new String[] {"yaml", "yml", "env"};
+	private static final String PARAMETERS = "parameters";
+	private static final String DEPLOYMENT = "Deployment";
+	
+	public static synchronized Map<String, File> createEnvFilesListFromCsar(String vspName, String filePath) throws Exception{
+		Map<String, File> generatedEnvFiles = new HashMap<>();
+		File csarFile= HomePage.downloadVspCsarToDefaultDirectory(vspName); 
+		FileHandling.unzip(csarFile.toString(), filePath);
+		List<File> yamlList = getHeatFilesCreatedFromCsar(csarFile, filePath);
+		Map<String, HeatAndHeatEnvNamesPair> filesPairMap = getFilesPairMap(yamlList);
+		generatedEnvFiles = generateDefaultEnvFiles(filesPairMap, filePath);
+		return generatedEnvFiles;
+	}
+	
+	public static synchronized List<File> getHeatFilesCreatedFromCsar(File pathToDirectory, String filePath) throws Exception {
+		List<File> fileList = new ArrayList<>();
+		String artifactsFilePath = filePath + "Artifacts" + File.separator;
+		List<File> fileListFromArtifactsDirectory = FileHandling.getHeatAndHeatEnvArtifactsFromZip(new File(artifactsFilePath), okFileExtensions);
+		Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToDirectory.toString());
+		LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get(DEPLOYMENT));
+		for(HeatMetaFirstLevelDefinition deploymentArtifact : deploymentArtifacts){
+			String type = deploymentArtifact.getType();
+			if(type.equals(ArtifactTypeEnum.HEAT.getType()) || 
+			   type.equals(ArtifactTypeEnum.HEAT_ENV.getType()) || 
+			   type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || 
+			   type.equals(ArtifactTypeEnum.HEAT_NET.getType())){
+				File file = (new File(artifactsFilePath + deploymentArtifact.getFileName()));
+				if(fileListFromArtifactsDirectory.contains(file)){
+					fileList.add(file);
+				}else{
+					assertTrue("File " + file + " does not exist", false);
+				}
+			}
+		}
+		return fileList;
+	}
+	public static synchronized Map<String, HeatAndHeatEnvNamesPair> getFilesPairMap(List<File> generatedEnvFiles) {
+		
+		Map<String, HeatAndHeatEnvNamesPair> heatAndHeatEnvPairs= new HashMap<>();
+		for(File file : generatedEnvFiles){
+			String[] fileName = file.getName().split("\\.");
+			String currentKey = fileName[0];
+			String currentExtension = fileName[1];
+			HeatAndHeatEnvNamesPair pair;
+			if(!heatAndHeatEnvPairs.containsKey(currentKey)){
+				pair = new HeatAndHeatEnvNamesPair();
+				heatAndHeatEnvPairs.put(currentKey, pair);
+			}else{
+				pair = heatAndHeatEnvPairs.get(currentKey);
+			}
+			setFileToPair(file, currentExtension, pair);
+		}
+		return heatAndHeatEnvPairs;
+	}
+	
+	/**
+	 * The method fill list of HeatWithParametersDefinition parameters
+	 * @param deploymentArtifacts
+	 * @return
+	 */
+	public static synchronized List<HeatWithParametersDefinition> extractHeatWithParametersDefinition(Map<String, ArtifactDefinition> deploymentArtifacts) {
+
+		List<HeatWithParametersDefinition> heatAndEnvLabelList = new ArrayList<>();
+		
+		for (Entry<String, ArtifactDefinition> artifactDefinitionChild : deploymentArtifacts.entrySet()){
+			if(artifactDefinitionChild.getValue().getArtifactType().equals(ArtifactTypeEnum.HEAT_ENV.getType())){
+				for(Entry<String, ArtifactDefinition> artifactDefinitionParent : deploymentArtifacts.entrySet()){
+					if(artifactDefinitionChild.getValue().getGeneratedFromId().equals(artifactDefinitionParent.getValue().getUniqueId())){
+						String heatLabel = artifactDefinitionParent.getValue().getArtifactLabel();
+						String heatArtifactType = artifactDefinitionParent.getValue().getArtifactType();
+						String heatArtifactDisplayName = artifactDefinitionParent.getValue().getArtifactDisplayName();
+						List<HeatParameterDataDefinition> heatParameterDefinition = artifactDefinitionParent.getValue().getHeatParameters();
+						String heatEnvLabel = artifactDefinitionChild.getValue().getArtifactLabel();
+						String heatEnvArtifactType = artifactDefinitionChild.getValue().getArtifactType();
+						heatAndEnvLabelList.add(new HeatWithParametersDefinition(heatLabel, heatEnvLabel, heatArtifactType, heatEnvArtifactType, heatArtifactDisplayName, heatParameterDefinition));
+						break;
+					}
+				}
+			}
+		}
+		return heatAndEnvLabelList;
+	}
+	
+
+	public static synchronized void setFileToPair(File file, String currentExtension, HeatAndHeatEnvNamesPair pair) {
+		if(!currentExtension.equals("env")){
+			pair.setHeatFileName(file);
+		}else{
+			pair.setHeatEnvFileName(file);
+		}
+	}
+
+	public static synchronized Map<String, File> generateDefaultEnvFiles(Map<String, HeatAndHeatEnvNamesPair> filesPairMap, String filePath) throws Exception {
+		
+		Map<String, File> generatedEnvFilesMap = new HashMap<>();
+		for(Entry<String, HeatAndHeatEnvNamesPair> pair : filesPairMap.entrySet()){
+			Map<String, Pair<String, Object>> envParametersMap = getEnvParametersMap(pair);
+			File generatedEnvFile = createEnvFile(envParametersMap, new File(filePath + pair.getKey() + ".env"));
+			generatedEnvFilesMap.put(pair.getKey(), generatedEnvFile);
+		}
+		return generatedEnvFilesMap;
+	}
+
+	public static synchronized File createEnvFile(Map<String, Pair<String, Object>> envParametersMap, File fileToWrite) throws IOException {
+
+		FileHandling.writeToFile(fileToWrite, PARAMETERS+":", 0);
+		FileHandling.writeToFile(fileToWrite, envParametersMap, 2);
+		return fileToWrite;
+	}
+
+	public static synchronized Map<String, Pair<String, Object>> getEnvParametersMap(Entry<String, HeatAndHeatEnvNamesPair> pair) throws Exception {
+		File heatFileName = pair.getValue().getHeatFileName();
+		File heatEnvFileName = pair.getValue().getHeatEnvFileName();
+		Map<String, Pair<String, Object>> envParametersMap = new HashMap<>();
+		fillParametersMapFromHeatFile(heatFileName, envParametersMap);
+		fillParametersMapFromHeatEnvFile(heatEnvFileName, envParametersMap);
+		return envParametersMap;
+	}
+
+	public static synchronized void fillParametersMapFromHeatEnvFile(File heatEnvFileName, Map<String, Pair<String, Object>> envParametersMap) throws Exception {
+		if(heatEnvFileName != null){
+			Map<String, Object> mapHeatEnvFileParameters = FileHandling.parseYamlFileToMapByPattern(heatEnvFileName, PARAMETERS);
+			for (Map.Entry<String, Object> parameter : mapHeatEnvFileParameters.entrySet()){
+				String key = parameter.getKey();
+				Pair<String, Object> pair;
+				if(envParametersMap.containsKey(key)){
+					if(envParametersMap.get(key).left.equals("string") && parameter.getValue() != null){
+						pair = Pair.create(envParametersMap.get(key).left, "\"" + parameter.getValue() + "\"");
+					}else if(envParametersMap.get(key).left.equals("string") && parameter.getValue() == null){
+						pair = Pair.create(envParametersMap.get(key).left, "");
+					}else if(parameter.getValue() == null){
+						pair = Pair.create(envParametersMap.get(key).left, "");
+					}else{
+						pair = Pair.create(envParametersMap.get(key).left, parameter.getValue());
+					}
+					envParametersMap.put(key, pair);
+				}
+			}
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	public static synchronized void fillParametersMapFromHeatFile(File heatFileName, Map<String, Pair<String, Object>> envParametersMap) throws Exception {
+		Map<String, Object> mapHeatFileParameters = FileHandling.parseYamlFileToMapByPattern(heatFileName, PARAMETERS);
+		for (Map.Entry<String, Object> parameter : mapHeatFileParameters.entrySet()){
+			Map<String, Object> value = (Map<String, Object>) parameter.getValue();
+			Pair<String, Object> pair;
+			if(value.get("type").toString().equals("string") && value.get("default") != null ){
+				pair = Pair.create(value.get("type").toString(), "\"" + value.get("default") + "\"");
+			}else if(value.get("type").toString().equals("string") && value.get("default") == null){
+				pair = Pair.create(value.get("type").toString(), "");
+			}else if(value.get("default") == null){
+				pair = Pair.create(value.get("type").toString(), "");
+			}else{
+				pair = Pair.create(value.get("type").toString(), value.get("default"));
+			}
+			envParametersMap.put(parameter.getKey(), pair);
+		}
+	}
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java
new file mode 100644
index 0000000..1302cb5
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ArtifactInfo.java
@@ -0,0 +1,105 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public class ArtifactInfo {
+
+	private String filepath;
+	private String filename;
+	private String description;
+	private String artifactType;
+	private String artifactLabel;
+	private String artifactVersion;
+
+	public ArtifactInfo(String filepath, String filename, String description, String artifactLabel,
+			String artifactType) {
+		super();
+		this.filepath = filepath;
+		this.filename = filename;
+		this.description = description;
+		this.artifactType = artifactType;
+		this.artifactLabel = artifactLabel;
+	}
+	
+	public ArtifactInfo(String filepath, String filename, String description, String artifactLabel,
+			String artifactType, String artifactVersion) {
+		super();
+		this.filepath = filepath;
+		this.filename = filename;
+		this.description = description;
+		this.artifactType = artifactType;
+		this.artifactLabel = artifactLabel;
+		this.artifactVersion = artifactVersion;
+	}
+
+	public ArtifactInfo() {
+		super();
+	}
+	
+	public String getArtifactVersion() {
+		return artifactVersion;
+	}
+
+	public void setArtifactVersion(String artifactVersion) {
+		this.artifactVersion = artifactVersion;
+	}
+
+	public String getFilepath() {
+		return filepath;
+	}
+
+	public void setFilepath(String filepath) {
+		this.filepath = filepath;
+	}
+
+	public String getFilename() {
+		return filename;
+	}
+
+	public void setFilename(String filename) {
+		this.filename = filename;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public String getArtifactType() {
+		return artifactType;
+	}
+
+	public void setArtifactType(String artifactType) {
+		this.artifactType = artifactType;
+	}
+
+	public String getArtifactLabel() {
+		return artifactLabel;
+	}
+
+	public void setArtifactLabel(String artifactLabel) {
+		this.artifactLabel = artifactLabel;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java
new file mode 100644
index 0000000..818b488
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasElement.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+
+public final class CanvasElement {
+	private final String uniqueId;
+	private ImmutablePair<Integer, Integer> location;
+	private LeftPanelCanvasItems normativeElementType;
+	private String elementType;
+
+	CanvasElement(String name, ImmutablePair<Integer, Integer> location, LeftPanelCanvasItems canvasItem) {
+		super();
+		this.uniqueId = name;
+		this.location = location;
+		normativeElementType = canvasItem;
+	}
+
+	CanvasElement(String name, ImmutablePair<Integer, Integer> location, String canvasItem) {
+		super();
+		this.uniqueId = name;
+		this.location = location;
+		elementType = canvasItem;
+	}
+
+	public String getUniqueId() {
+		return uniqueId;
+	}
+
+	public ImmutablePair<Integer, Integer> getLocation() {
+		return location;
+	}
+
+	public void setLocation(ImmutablePair<Integer, Integer> location) {
+		this.location = location;
+	}
+
+	public LeftPanelCanvasItems getNormativeElementType() {
+		return normativeElementType;
+	}
+
+	public String getElementType() {
+		return elementType;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
new file mode 100644
index 0000000..25ed4c2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CanvasManager.java
@@ -0,0 +1,268 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class CanvasManager {
+	private Map<String, CanvasElement> canvasElements;
+	private Actions actions;
+	private WebElement canvas;
+	private int reduceCanvasWidthFactor;
+	private CanvasElement canvasElement;
+	// Offsets Are used to find upper right corner of canvas element in order to
+	// connect links
+	private static final int CANVAS_ELEMENT_Y_OFFSET = 30;
+	private static final int CANVAS_ELEMENT_X_OFFSET = 18; // 14 - 27
+
+	private CanvasManager() {
+		canvasElements = new HashMap<>();
+		actions = new Actions(GeneralUIUtils.getDriver());
+		canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue());
+		try {
+			WebElement webElement = GeneralUIUtils
+					.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue());
+			reduceCanvasWidthFactor = webElement.getSize().width;
+		} catch (Exception e) {
+			reduceCanvasWidthFactor = 0;
+		}
+	}
+
+	public static CanvasManager getCanvasManager() {
+		return new CanvasManager();
+	}
+
+	public List<CanvasElement> getCanvasElements() {
+		return canvasElements.values().stream().collect(Collectors.toList());
+	}
+
+	private void addCanvasElement(CanvasElement element) {
+		canvasElements.put(element.getUniqueId(), element);
+	}
+
+	private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation)
+			throws Exception {
+		GeneralUIUtils.waitForLoader();
+		actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+		actions.clickAndHold();
+		actions.moveToElement(canvas, newLocation.left, newLocation.right);
+		actions.release();
+		actions.perform();
+		canvasElement.setLocation(newLocation);
+		GeneralUIUtils.waitForLoader();
+
+	}
+
+	public void moveToFreeLocation(String containerName) {
+		int maxWait = 5000;
+		int sumOfWaiting = 0;
+		int napPeriod = 200;
+		boolean isKeepWaiting = false;
+		while (!isKeepWaiting) {
+			ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+			actions.moveToElement(canvas, freePosition.left, freePosition.right);
+			actions.clickAndHold();
+			actions.release();
+			actions.perform();
+			isKeepWaiting = GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText()
+					.equals(containerName);
+			sumOfWaiting += napPeriod;
+			if (sumOfWaiting > maxWait) {
+				Assert.fail("Can't click on VF");
+			}
+		}
+	}
+
+	public void clickOnCanvaElement(CanvasElement canvasElement) {
+		actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+		actions.clickAndHold();
+		actions.release();
+		actions.perform();
+		actions.click().perform();
+		GeneralUIUtils.ultimateWait();
+		ExtentTestActions.log(Status.INFO, String.format("Canvas element %s selected", canvasElement.getElementType()));
+	}
+
+	public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception {
+		moveElementOnCanvas(canvasElement, getFreePosition());
+	}
+
+	public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception {
+		GeneralUIUtils.waitForLoader();
+		actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+		actions.click();
+		actions.perform();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue())
+				.click();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+		canvasElements.remove(canvasElement.getUniqueId());
+		GeneralUIUtils.ultimateWait();
+		if (canvasElement.getElementType().contains("-")){
+			ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType().split("-")[4]));
+		}
+		else{
+			ExtentTestActions.log(Status.INFO, String.format("Canvas element %s removed", canvasElement.getElementType()));
+		}
+	}
+
+	private WebElement findClickElement(String dataTestId) {
+		int attempts = 0;
+		while (attempts < 2) {
+			try {
+				return GeneralUIUtils.getWebElementByTestID(dataTestId);
+			} catch (StaleElementReferenceException e) {
+			}
+			attempts++;
+		}
+		return null;
+	}
+	
+	public CanvasElement createElementOnCanvas(String elementName) throws Exception {
+		String actionDuration = GeneralUIUtils.getActionDuration(() -> {
+			try {
+				canvasElement = createElementOnCanvasWithoutDuration(elementName);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		});
+		
+		if (canvasElement != null){
+			ExtentTestActions.log(Status.INFO, String.format("The element %s should now be on the canvas", elementName), actionDuration);
+		}
+		return canvasElement;
+	}
+	
+	private CanvasElement createElementOnCanvasWithoutDuration(String elementDataTestId) throws Exception {
+		try {
+			WebElement element = findClickElement(elementDataTestId);
+			ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+			actions.moveToElement(element, 20, 20);
+			actions.clickAndHold();
+			actions.moveToElement(canvas, freePosition.left, freePosition.right);
+			actions.release();
+			actions.perform();
+			GeneralUIUtils.ultimateWait();
+			String uniqueId = elementDataTestId + "_" + UUID.randomUUID().toString();
+			CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, elementDataTestId);
+			addCanvasElement(canvasElement);
+			GeneralUIUtils.ultimateWait();
+			return canvasElement;
+		} 
+		catch (Exception e) {
+			System.out.println("Can't create element on canvas");
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	public CanvasElement createElementOnCanvas(LeftPanelCanvasItems canvasItem) throws Exception {
+		return createElementOnCanvas(canvasItem.getValue());
+	}
+
+	private ImmutablePair<Integer, Integer> getFreePosition() {
+		ImmutablePair<Integer, Integer> randomPosition = null;
+		boolean freePosition = false;
+		int minSpace = 150;
+		while (!freePosition) {
+			ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition();
+			freePosition = !canvasElements.values().stream().map(e -> e.getLocation())
+					.filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace
+							&& Math.abs(e.right - tempRandomPosition.right) < minSpace)
+					.findAny().isPresent();
+			randomPosition = tempRandomPosition;
+		}
+		return randomPosition;
+	}
+
+	private ImmutablePair<Integer, Integer> getRandomPosition() {
+		int edgeBuffer = 50;
+		Random random = new Random();
+		int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer;
+		int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer;
+		return new ImmutablePair<Integer, Integer>(xElement, yElement);
+	}
+
+	public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+		ExtentTestActions.log(Status.INFO, String.format("Linking between the %s instance and the %s instance.", firstElement.getElementType(), secondElement.getElementType()));
+		drawSimpleLink(firstElement, secondElement);
+		selectReqAndCapAndConnect();
+		ExtentTestActions.log(Status.INFO, String.format("The instances %s and %s should now be connected.", firstElement.getElementType(), secondElement.getElementType()));
+	}
+
+	private void selectReqAndCapAndConnect() throws Exception {
+		// Select First Cap
+		GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click();
+		// Select First Req
+		GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click();
+		// Connect
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
+
+		GeneralUIUtils.waitForLoader();
+	}
+
+	private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+		int yOffset = CANVAS_ELEMENT_Y_OFFSET;
+		int xOffset = CANVAS_ELEMENT_X_OFFSET;
+
+		actions.moveToElement(canvas, firstElement.getLocation().left + xOffset,
+				firstElement.getLocation().right - yOffset);
+
+		actions.clickAndHold();
+		actions.moveToElement(canvas, secondElement.getLocation().left + xOffset, secondElement.getLocation().right - yOffset);
+		actions.release();
+		actions.perform();
+		GeneralUIUtils.ultimateWait();
+	}
+
+	public String updateElementNameInCanvas(CanvasElement canvasElement, String newInstanceName) throws Exception {
+		GeneralUIUtils.ultimateWait();;
+		clickOnCanvaElement(canvasElement);
+		WebElement updateInstanceName = GeneralUIUtils.getWebElementBy(By.id("editPencil"));
+		updateInstanceName.click();
+		WebElement instanceNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.INSTANCE_NAME_FIELD.getValue());
+		String oldInstanceName = instanceNameField.getAttribute("value");
+		instanceNameField.clear();
+		instanceNameField.sendKeys(newInstanceName);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+		GeneralUIUtils.ultimateWait();
+		GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("w-sdc-modal-resource-instance-name"));
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", oldInstanceName, newInstanceName));
+		return oldInstanceName;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java
new file mode 100644
index 0000000..1335b51
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CatalogFilterTitlesEnum.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum CatalogFilterTitlesEnum {
+
+	TYPE("typeFilterTitle"), CATEGORIES("categoriesFilterTitle"), STATUS("statusFilterTitle");
+
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private CatalogFilterTitlesEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java
new file mode 100644
index 0000000..ffa17ee
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CheckBoxStatusEnum.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum CheckBoxStatusEnum {
+	CHECKOUT("", "checkbox-checkout"), 
+	CHECKIN("", "checkbox-checkin"), 
+	READY_FOR_TESTING("checkbox-readyfortesting","checkbox-1"), 
+	IN_TESTING("checkbox-intesting", "checkbox-2"), 
+	WAITING_FOR_DISTRIBUTION("", "checkbox-waitingforapproval"), 
+	DISTRIBUTION_REJECTED("", "checkbox-distributionrejected"), 
+	DISTRIBUTION_APPROVED("", "checkbox-distributionapproved"), 
+	CERTIFIED("checkbox-certified", "checkbox-3"), 
+	DISTRIBUTED("", "checkbox-4"), 
+	IN_DESIGN("", "checkbox-0");
+
+	private String value;
+	private String value2;
+
+	public String getValue() {
+		return value;
+	}
+
+	public String getCatalogValue() {
+		return value2;
+	}
+
+	private CheckBoxStatusEnum(String value, String value2) {
+		this.value = value;
+		this.value2 = value2;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java
new file mode 100644
index 0000000..a49c502
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/CreateAndImportButtonsEnum.java
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum CreateAndImportButtonsEnum {
+
+	IMPORT_VF, IMPORT_VFC, IMPORT_CP, IMPORT_VL, CREATE_VF, CREATE_SERVICE, CREATE_PRODUCT;
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
new file mode 100644
index 0000000..ef510b8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/DataTestIdEnum.java
@@ -0,0 +1,835 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import java.util.Arrays;
+import java.util.List;
+
+public final class DataTestIdEnum {
+	private DataTestIdEnum() {
+	}
+
+	public enum Dashboard {
+		IMPORT_AREA("importButtonsArea"),
+		ADD_AREA("AddButtonsArea"),
+		BUTTON_ADD_VF("createResourceButton"), 
+		BUTTON_ADD_SERVICE("createServiceButton"), 
+		IMPORT_VFC("importVFCbutton"), 
+		IMPORT_VF("importVFbutton"), 
+		IMPORT_VFC_FILE("file-importVFCbutton"), 
+		IMPORT_VF_FILE("file-importVFbutton"),
+		BUTTON_ADD_PRODUCT("createProductButton");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private Dashboard(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum LifeCyleChangeButtons {
+		CREATE("create/save"), 
+		CHECK_IN("check_in"), 
+		SUBMIT_FOR_TESTING("submit_for_testing"), 
+		START_TESTING("start_testing"), 
+		ACCEPT("accept"),
+		CHECKOUT("check_out");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private LifeCyleChangeButtons(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum DistributionChangeButtons {
+		APPROVE("approve"), 
+		REJECT("reject"), 
+		DISTRIBUTE("distribute"), 
+		MONITOR("monitor"), 
+		APPROVE_MESSAGE("checkindialog"), 
+		RE_DISTRIBUTE("redistribute");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private DistributionChangeButtons(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum InformationalArtifactsPlaceholders {
+		CLOUD_QUESTIONNAIRE("Cloud Questionnaire (completed)"), 
+		FEATURES("Features"), 
+		VENDOR_TEST_RESULT("Vendor Test Result"), 
+		TEST_SCRIPTS("Test Scripts"), 
+		RESOURCE_SECURITY_TEMPLATE("Resource Security Template"), 
+		HEAT_TEMPLATE_FROM_VENDOR("HEAT Template from Vendor"), 
+		CAPACITY("Capacity");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private InformationalArtifactsPlaceholders(String value) {
+			this.value = value;
+		}
+	}	
+
+	public enum ModalItems {
+		BROWSE_BUTTON("browseButton"), 
+		ADD("Add"), 
+		DESCRIPTION("description"), 
+		SUMBIT_FOR_TESTING_MESSAGE("changeLifeCycleMessage"), 
+		OK("OK"), 
+		CANCEL("Cancel"), 
+		ACCEP_TESTING_MESSAGE("checkindialog");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ModalItems(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum LeftPanelCanvasItems {
+		BLOCK_STORAGE("BlockStorage"), 
+		CINDER_VOLUME("CinderVolume"), 
+		COMPUTE("Compute"), 
+		LOAD_BALANCER("LoadBalancer"), 
+		NOVA_SERVER("NovaServer"), 
+		OBJECT_STORAGE("ObjectStorage"), 
+		NEUTRON_PORT("NeutronPort"), 
+		PORT("Port"), DATABASE("Database"), 
+		NETWORK("Network");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private LeftPanelCanvasItems(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum LinkMenuItems {
+		CANCEL_BUTTON("link-menu-button-cancel"), 
+		CONNECT_BUTTON("link-menu-button-connect"), 
+		LINK_ITEM_CAP("link-item-capabilities"), 
+		LINK_ITEM_REQ("link-item-requirements"), 
+		LINK_MENU("link-menu-open");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private LinkMenuItems(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum GeneralCanvasItems {
+		CANVAS("canvas"), 
+		CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), 
+		DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete"), 
+		UPDATE_INSTANCE_NAME("e-sdc-small-icon-update"), 
+		INSTANCE_NAME_FIELD("instanceName");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private GeneralCanvasItems(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum ResourceMetadataEnum {
+		RESOURCE_NAME("name"), 
+		DESCRIPTION("description"), 
+		CATEGORY("selectGeneralCategory"), 
+		VENDOR_NAME("vendorName"), 
+		VENDOR_RELEASE("vendorRelease"), 
+		TAGS("i-sdc-tag-input"), 
+		CONTACT_ID("contactId"), 
+		ICON(" iconBox"),
+		TAGS_TABLE("i-sdc-tag-text");	
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ResourceMetadataEnum(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum GeneralElementsEnum {
+		CREATE_BUTTON("create/save"), 
+		CHECKIN_BUTTON("check_in"), 
+		CHECKOUT_BUTTON("check_out"), 
+		SUBMIT_FOR_TESTING_BUTTON("submit_for_testing"), 
+		DELETE_VERSION_BUTTON("delete_version"), 
+		REVERT_BUTTON("revert"), 
+		LIFECYCLE_STATE("formlifecyclestate"), 
+		VERSION_HEADER("versionHeader"),
+		OK("OK"), 
+		UPLOAD_FILE_INPUT("browseButton");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private GeneralElementsEnum(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum ArtifactPageEnum {
+		ADD_DEPLOYMENT_ARTIFACT("add-deployment-artifact-button"),
+		ADD_INFORMATIONAL_ARTIFACT("add-information-artifact-button"), 
+		DOWNLOAD_ARTIFACT_ENV("download_env_"),
+		ADD_ANOTHER_ARTIFACT("add-another-artifact-button"), 
+		EDIT_ARTIFACT("edit_"), //upload env file by its label(via deployment artifact view)/displayName(via Canvas)
+		DELETE_ARTIFACT("delete_"),
+		DOWNLOAD_ARTIFACT("download_"), 
+		GET_DEPLOYMENT_ARTIFACT_DESCRIPTION("description"), 
+		GET_INFORMATIONAL_ARTIFACT_DESCRIPTION("Description"), 
+		OK("OK"),
+		TYPE("artifactType_"), 
+		DEPLOYMENT_TIMEOUT("timeout_"), 
+		VERSION("artifactVersion_"), 
+		UUID("artifactUUID_"), 
+		EDIT_PARAMETERS_OF_ARTIFACT("edit-parameters-of-"),
+		ARTIFACT_NAME("artifactDisplayName_"),
+		UPLOAD_HEAT_ENV_PARAMETERS("uplaodEnv_"),
+		VERSION_ENV("artifactEnvVersion_");
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ArtifactPageEnum(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum PropertiesPageEnum {
+
+		ADD_NEW_PROPERTY("addGrey"), 
+		EDIT_PROPERTY("edit_"), 
+		DELETE_PROPERTY("delete_"), 
+		PROPERTY_NAME("propertyName_"), 
+		PROPERTY_DESCRIPTION("propertyDescription_"), 
+		PROPERTY_TYPE("propertyType_"), 
+		ENTRY_SCHEMA("propertySchema_"), 
+		ADD("Add"), CANCEL("Cancel"), 
+		DONE("Done"), 
+		PROPERTY_ROW("propertyRow"), 
+		SAVE("Save"), 
+		POPUP_FORM("sdc-edit-property-container");
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private PropertiesPageEnum(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum PropertiesPopupEnum {
+
+		PROPERTY_NAME("propertyName"), 
+		PROPERTY_VALUE("defaultvalue"), 
+		PROPERTY_BOOLEAN_VALUE("booleantype"), 
+		PROPERTY_DESCRIPTION("description"), 
+		PROPERTY_TYPE("propertyType"), 
+		ENTRY_SCHEMA("schema-type"), 
+		CANCEL("Cancel"),  
+		SAVE("Save"), 
+		POPUP_FORM("sdc-edit-property-container"), 
+		ADD("Add"), 
+		DONE("Done"),
+		PROPERTY_RADIO_BUTTON_CONTAINER("propertyRadioButton_"),
+		RADIO_BUTTON_CLASS("tlv-radio-label");
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private PropertiesPopupEnum(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum AdminPageTabs {
+		USER_MANAGEMENT("usermanagmenttab"), 
+		CATEGORY_MANAGEMENT("categorymanagmenttab");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private AdminPageTabs(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum UserManagementEnum {
+		
+		SEARCH_BOX("searchbox"),
+		NEW_USER_FIELD("newuserId"),
+		ROLE_SELECT("selectrole"),
+		CREATE_BUTTON("creategreen"),
+		CLASS__USER_MANAGEMENT_TABLE("sdc-user-management-table"),
+		ROW_TABLE("row_"),
+		FIRST_NAME("firstName_"),
+		LAST_NAME("lastName__"),
+		USER_ID("userId_"),
+		EMAIL("email_"),
+		ROLE("role_"),
+		LAST_ACTIVE("lastActive_"),
+		UPDATE_ROLE("selectRole_"),
+		UPDATE_USER_BUTTON("updateUser_"),
+		SAVE_USER("save_"),
+		DELETE_USER("delete_"),
+		;
+		
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private UserManagementEnum(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum CategoryManagement {
+	
+		SERVICE_CATEGORY_HEADER("servicecategoryheader"), 
+		RESOURCE_CATEGORY_HEADER("resourcecategoryheader"), 
+		SERVICE_CATEGORY_LIST("servicecategory"), 
+		RESOURCE_CATEGORY_LIST("resourcecategory"), 
+		NEW_CATEGORY_BUTTON("newcategory"), 
+		NEW_SUB_CATEGORY_BUTTON("newsubcategory"), 
+		NEW_CATEGORY_NAME("i-sdc-form-input");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private CategoryManagement(String value) {
+			this.value = value;
+		}
+	}
+	
+	
+
+	public enum MainMenuButtons {
+		HOME_BUTTON("main-menu-button-home"), 
+		CATALOG_BUTTON("main-menu-button-catalog"), 
+		ONBOARD_BUTTON("main-menu-button-onboard"), 
+		SEARCH_BOX("main-menu-input-search"),
+		REPOSITORY_ICON("repository-icon");
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private MainMenuButtons(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum MainMenuButtonsFromInsideFrame {
+		HOME_BUTTON("breadcrumbs-button-0");
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private MainMenuButtonsFromInsideFrame(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum MenuOptionsEnum {
+		EDIT("Edit"), 
+		CHECK_IN("Check in"), 
+		CHECK_OUT("Check out"), 
+		VIEW("View"), 
+		SUBMIT_FOR_TEST("Submit For Test"), 
+		ACCEPT("Accept"), 
+		REJECT("Reject"), 
+		START_TEST("Start test"), 
+		DISTREBUTE("Distribute");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private MenuOptionsEnum(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum StepsEnum {
+		GENERAL("Generalstep"), 
+		ICON("Iconstep"), 
+		DEPLOYMENT_ARTIFACT("Deployment Artifactstep"), 
+		INFORMATION_ARTIFACT("Information Artifactstep"), 
+		PROPERTIES("Propertiesstep"), 
+		COMPOSITION("Compositionstep"), 
+		ACTIVITY_LOG("Activity Logstep"), 
+		DEPLOYMENT_VIEW("Deploymentstep"), 
+		TOSCA_ARTIFACTS("TOSCA Artifactsstep"), 
+		MONITOR("Monitor step"), 
+		MANAGEMENT_WORKFLOW("Management Workflowstep"), 
+		INPUTS("Inputsstep"), 
+		HIERARCHY("Hierarchystep");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private StepsEnum(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum ArtifactPopup {
+
+		BROWSE("browseButton"), 
+		ARTIFACT_DESCRIPTION("description"), 
+		ARTIFACT_LABEL("artifactLabel"), 
+		ARTIFACT_TYPE("artifacttype"),
+		OK("OK"), 
+		SAVE("Save"),
+		DONE_BUTTON("Done"), 
+		CANCEL_BUTTON("Cancel"),
+		URL("input[class^='i-sdc-form-input']"), 
+		MODAL_WINDOW("sdc-add-artifact");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ArtifactPopup(String value) {
+			this.value = value;
+		}
+	}
+
+	public enum ServiceMetadataEnum {
+		SERVICE_NAME("name"), DESCRIPTION("description"), CATEGORY("selectGeneralCategory"), PROJECT_CODE("projectCode"), TAGS("i-sdc-tag-input"), CONTACT_ID("contactId"), ICON(" iconBox");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ServiceMetadataEnum(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum ProductMetadataEnum {
+		PRODUCT_NAME("name"), 
+		FULL_NAME("fullName"), 
+		DESCRIPTION("description"),  
+		PROJECT_CODE("projectCode"), 
+		TAGS("i-sdc-tag-input"), 
+		ATT_CONTACT("attContact"), 
+		ICON(" iconBox");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ProductMetadataEnum(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum DashboardCardEnum {
+		ASSET_TYPE("asset-type"), LIFECYCLE_STATE("span[class^='w-sdc-dashboard-card-info-lifecycleState']"),
+		INFO_NAME("div.sdc-tile-content-info-item-name"), 
+		VERSION("div[class^='w-sdc-dashboard-card-info-user']"),
+		DASHBOARD_CARD("div[class^='w-sdc-dashboard-card ']"),
+		ASSET_TYPE_CSS("span[data-tests-id='asset-type']");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private DashboardCardEnum(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum CatalogPageLeftPanelCategoryCheckbox {
+		GENERIC_CHECKBOX("span[data-tests-id='checkbox-resourcenewcategory.generic']"),
+		NETWORK_L2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3']"),
+		NETWORK_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.networkl4+']"),
+		NETWORK_CONNECTIVITY("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity']"),
+		APPLICATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+']"),
+		DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent']");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private  CatalogPageLeftPanelCategoryCheckbox(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum CatalogPageLeftPanelFilterTitle {
+		TYPE("span[data-tests-id='typeFilterTitle']"), 
+		CATEGORIES("span[data-tests-id='categoriesFilterTitle']"), 
+		STATUS("span[data-tests-id='statusFilterTitle']");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private  CatalogPageLeftPanelFilterTitle(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum CatalogPageLeftPanelSubCategoryCheckbox {
+		COMMON_NETWORK_RESOURCES("span[data-tests-id='checkbox-resourcenewcategory.networkl4+.commonnetworkresources']"),
+		ROUTER("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.router']"),				
+		WAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.wanconnectors']"),
+		LAN_CONNECTORS("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.lanconnectors']"),
+		INFRASTRUCTERE_NETWORKl2_3("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.infrastructure']"),
+		GATEWAY("span[data-tests-id='checkbox-resourcenewcategory.networkl2-3.gateway']"),
+		NETWORK_ELEMENTS("span[data-tests-id='checkbox-resourcenewcategory.generic.networkelements']"),
+		ABSTRACT("span[data-tests-id='checkbox-resourcenewcategory.generic.abstract']"),
+		RULES("span[data-tests-id='checkbox-resourcenewcategory.generic.rules']"),
+		DATABASE("span[data-tests-id='checkbox-resourcenewcategory.generic.database']"),
+		INFRASTRUCTERE_GENERIC("span[data-tests-id='checkbox-resourcenewcategory.generic.infrastructure']"),
+		VIRTUAL_LINKS("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity.virtuallinks']"),
+		CONNECTION_POINTS("span[data-tests-id='checkbox-resourcenewcategory.networkconnectivity.connectionpoints']"),
+		APPLICATION_SERVER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.applicationserver']"),
+		CALL_CONTROL("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.callcontrol']"),
+		MEDIASERVERS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.mediaservers']"),
+		WEBSERVER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.webserver']"),
+		LOAD_BALANCER("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.loadbalancer']"),
+		BORDER_ELEMENT("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.borderelement']"),
+		DATABASE_APPLIVATION_L4_PLUS("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.database']"),
+		FIREWALL("span[data-tests-id='checkbox-resourcenewcategory.applicationl4+.firewall']"),
+		DATABASE_DCAE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.database']"),
+		POLICY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.policy']"),
+		MICROSERVICE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.microservice']"),
+		SOURCE("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.source']"),
+		COLLECTOR("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.collector']"),
+		UTILITY("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.utility']"),
+		ANALYTICS("span[data-tests-id='checkbox-resourcenewcategory.dcaecomponent.analytics']");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private  CatalogPageLeftPanelSubCategoryCheckbox(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum CompositionScreenEnum {
+		
+		CHANGE_VERSION("changeVersion", Arrays.asList()),
+		DEPLOYMENT_ARTIFACT_TAB("deployment-artifact-tab", Arrays.asList("Deployment Artifacts")),
+		ADD_ARTIFACT("add_Artifact_Button", Arrays.asList()),
+		SEARCH_ASSET("searchAsset", Arrays.asList()),
+		PROPERTIES_AND_ATTRIBUTES_TAB("properties-and-attributes-tab",Arrays.asList()),
+		MENU_INPUTS("sub-menu-button-inputs",Arrays.asList()),
+		MENU_TRIANGLE_DROPDOWN("triangle-dropdown", Arrays.asList()),
+		ARTIFACTS_LIST("artifactName", Arrays.asList()),
+		INFORMATION_ARTIFACTS("button[tooltip-content='Information Artifacts']", Arrays.asList("Informational Artifacts")),
+		API("button[tooltip-content='API']", Arrays.asList("API Artifacts")),
+		INFORMATION("button[tooltip-content='Information']", Arrays.asList("General Info", "Additional Information", "Tags")),
+		COMPOSITION("button[tooltip-content='Composition']",  Arrays.asList("Composition")),
+		INPUTS("button[tooltip-content='Inputs']", Arrays.asList("")),
+		REQUIREMENTS_AND_CAPABILITIES("button[tooltip-content='Requirements and Capabilities']", Arrays.asList()),
+		INFORMATION_TAB("information-tab", Arrays.asList()),
+		CUSTOMIZATION_UUID("rightTab_customizationModuleUUID", Arrays.asList());
+		
+		private String value;
+		private List<String> title;
+
+		public String getValue() {
+			return value;
+		}
+		
+		public List<String> getTitle() {
+			return title;
+		}				
+
+		private  CompositionScreenEnum(String value, List<String> title) {
+			this.value = value;
+			this.title = title;
+		}		
+	}
+	
+	public enum ToscaArtifactsScreenEnum {
+		
+		TOSCA_MODEL("download-Tosca Model"),
+		TOSCA_TEMPLATE("download-Tosca Template"),
+		ARTIFACT_VERSION("version-"),
+		ARTIFACT_NAME("name-"),
+		ARTIFACT_TYPE("type-"),
+		ARTIFACT_DETAILS("details-"),
+		DOWNLOAD_ARTIFACT("download-"),
+		DOWNLOAD_CSAR("download-Tosca Model");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private  ToscaArtifactsScreenEnum(String value) {
+			this.value = value;
+		}		
+	}
+	
+	public enum InformationalArtifactsService {
+		AFFINITY_RULES("artifact_Display_Name-Affinity Rules"),
+		CONTROL_LOOP_FUNCTIONS("artifact_Display_Name-Control Loop Functions"),
+		DEPLOYMENT_VOTING_RECORD("artifact_Display_Name-Deployment Voting Record"),
+		DIMENSIONING_INFO("artifact_Display_Name-Dimensioning Info"),
+		DISTRIBUTION_INSTRUCTION("artifact_Display_Name-Distribution Instructions"),
+		ENGINEERING_RULES("artifact_Display_Name-Engineering Rules (ERD)"),
+		OPERATIONAL_POLICES("artifact_Display_Name-Operational Policies"),
+		SERVICE_ARTIFACT_PLAN("artifact_Display_Name-Service Artifact Plan"),
+		SERVICE_QUESTIONNAIRE("artifact_Display_Name-Service Questionnaire"),
+		SERVICE_SECURITY_TEMPLATE("artifact_Display_Name-Service Security Template"),
+		SERVICE_SPECIFIC_POLICIES("artifact_Display_Name-Service-specific Policies"),
+		SUMMARY_OF_IMPACTS_TO_ECOMP("artifact_Display_Name-Summary of impacts to ECOMP elements,OSSs, BSSs"),
+		TD_CERTIFICATION_TEST_RESULTS("artifact_Display_Name-TD Certification Test Results");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private InformationalArtifactsService(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum APIArtifactsService {
+		
+		CONFIGURATION("artifact_Display_Name-Configuration"),
+		INSTANTIATION("artifact_Display_Name-Instantiation"),
+		LOGGING("artifact_Display_Name-Logging"),
+		MONITORING("artifact_Display_Name-Monitoring"),
+		REPORTING("artifact_Display_Name-Reporting"),
+		TESTING("artifact_Display_Name-Testing");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private  APIArtifactsService(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum DeploymentArtifactCompositionRightMenu {
+		ARTIFACT_NAME("artifactName-"),
+		ARTIFACT_DISPLAY_NAME("artifact_Display_Name-"),
+		DOWNLOAD("download_"), 
+		DELETE("delete_"),
+		ADD_ARTIFACT_BUTTON("add_Artifact_Button"), 
+		EDIT_PARAMETERS_OF_ARTIFACT("edit-parameters-of-"),
+		ARTIFACT_ITEM("artifact-item-"),
+		ARTIFACT_ENV("heat_env_");
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private DeploymentArtifactCompositionRightMenu(String value) {
+			this.value = value;
+		}
+		
+	}
+	
+	public enum InputsScreenService {
+		ADD_SELECTED_INPUTS_BTN("add-inputs-to-service-button"), 
+		VF_INSTANCE_ROWS("expand-collapse[expanded-selector^='.vf-instance-list.']"),
+		VF_INSTANCE_ROW_NAME("span[class^='title-text']"),
+		VF_INSTANCE_INPUTS("div[class^='vf-instance-list ']"),
+		VF_INSTANCE_INPUT("div[class^='input-row ng-scope']"),
+		VF_INSTNCE_PROPERTY_NAME("div[class^='title-text']"),
+		INPUT_CHECKBOX("span[class^='tlv-checkbox-label']"),
+		SERVICE_INPUT_ROW("div[class^='service-input-row input-row']"),
+		DELETE_INPUT_BTN("span[class$='remove-input-icon']"),
+		RESOURCE_INSTANCE_PROPERTY_NAME("propertyName_"),
+		RESOURCE_INSTANCE_PROPERTY_TYPE("propertyType_"),
+		RESOURCE_INSTANCE_PROPERTY_CHECKBOX("propertyCheckbox_"),
+		SERVICE_INPUTS_DELETE_BUTTON("deleteInput_")
+		;
+		
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private InputsScreenService(String value) {
+			this.value = value;
+		}
+		
+	}
+	
+	public enum DeploymentScreen {
+		MODULES("span[class^='expand-collapse-title-text']"),
+		MEMBERS("div[class^='expand-collapse-sub-title']"),
+		PROPERTIES("list-of-Properties"),
+		ARTIFACTS("list-of-Artifacts"),
+		BUTTON_PROPERTIES("div[data-tests-id='list-of-Properties'] span[class^='hand']"),
+		BUTTON_ARTIFACTS("div[data-tests-id='list-of-Artifacts'] span[class^='hand']"),
+		PROPERTY_NAMES("div[data-tests-id='selected-module-property-name'] span"),
+		PROPERTY_TYPES("selected-module-property-type"),
+		PROPERTY_SCHEMA_TYPE("selected-module-property-schema-type"),
+		ARTIFACT_NAME("selected-module-artifact-name"),
+		ARTIFACT_UUID("selected-module-artifact-uuid"),
+		ARTIFACT_VERSION("selected-module-artifact-version"),
+		PENCIL_ICON("edit-name-popover-icon"),
+		MODULE_NAME("selected-module-name"),
+		MODULE_ID("selected-module-group-uuid"),
+		RESOURCE_NAME_ON_POPOVER("popover-vfinstance-name"),
+		MODULE_NAME_ON_POPOVER("popover-module-name"),
+		NAME_INPUT("popover-heat-name"),
+		SAVE("popover-save-button"),
+		CANCEL("popover-close-button"),
+		X_BUTTON("popover-x-button");
+				
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private DeploymentScreen(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum ImportVfRepository {
+		SEARCH("onboarding-search"), 
+		IMPORT_VSP("import-csar"), 
+		DOWNLOAD_CSAR("download-csar"),
+		UPDATE_VSP("update-csar");
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private ImportVfRepository(String value) {
+			this.value = value;
+		}
+	}
+	
+	public enum EnvParameterView {
+		SEARCH_ENV_PARAM_NAME("search-env-param-name"), 
+		ENV_CURRENT_VALUE("value-field-of-"),//value-field-of-oam_volume_name_0 - parameter name 
+		ENV_DEFAULT_VALUE("default-value-of-");// default-value-of-vnf_name
+
+		private String value;
+
+		public String getValue() {
+			return value;
+		}
+
+		private EnvParameterView(String value) {
+			this.value = value;
+		}
+	}
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java
new file mode 100644
index 0000000..a7d2551
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ErrorMessageProperties.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public class ErrorMessageProperties {
+	
+	private String messageId ;
+	private String code;
+
+	public ErrorMessageProperties() {
+		
+	}
+	
+	public ErrorMessageProperties(String messageId, String code) {
+		this.messageId = messageId;
+		this.code = code;
+	}
+
+	public String getMessageId() {
+		return messageId;
+	}
+
+	public void setMessageId(String messageId) {
+		this.messageId = messageId;
+	}
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java
new file mode 100644
index 0000000..e708fb8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/GeneralCanvasItemsEnum.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum GeneralCanvasItemsEnum {
+	CANVAS("canvas"), 
+	CANVAS_RIGHT_PANEL("w-sdc-designer-sidebar-head"), 
+	DELETE_INSTANCE_BUTTON("e-sdc-small-icon-delete");
+
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private GeneralCanvasItemsEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java
new file mode 100644
index 0000000..1df61b7
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatAndHeatEnvNamesPair.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import java.io.File;
+
+public class HeatAndHeatEnvNamesPair {
+	
+	private File heatFileName;
+	private File heatEnvFileName;
+	
+	public HeatAndHeatEnvNamesPair() {
+		super();
+	}
+
+	public HeatAndHeatEnvNamesPair(File heatFileName, File heatEnvFileName) {
+		super();
+		this.heatFileName = heatFileName;
+		this.heatEnvFileName = heatEnvFileName;
+	}
+
+	public File getHeatFileName() {
+		return heatFileName;
+	}
+
+	public void setHeatFileName(File heatFileName) {
+		this.heatFileName = heatFileName;
+	}
+
+	public File getHeatEnvFileName() {
+		return heatEnvFileName;
+	}
+
+	public void setHeatEnvFileName(File heatEnvFileName) {
+		this.heatEnvFileName = heatEnvFileName;
+	}
+
+	@Override
+	public String toString() {
+		return "HeatHeatEnvNamesPair [heatFileName=" + heatFileName + ", heatEnvFileName=" + heatEnvFileName + "]";
+	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java
new file mode 100644
index 0000000..5ff173e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/HeatWithParametersDefinition.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+
+public class HeatWithParametersDefinition {
+
+	private String heatLabel;
+	private String heatEnvLabel;
+	private String heatArtifactType;
+	private String heatEnvArtifactType;
+	private String heatArtifactDisplayName;
+	private List<HeatParameterDataDefinition> heatParameterDefinition;
+	
+	public HeatWithParametersDefinition(String heatLabel, String heatEnvLabel, String heatArtifactType, String heatEnvArtifactType, String heatArtifactDisplayName, List<HeatParameterDataDefinition> heatParameterDefinition) {
+		super();
+		this.heatLabel = heatLabel;
+		this.heatEnvLabel = heatEnvLabel;
+		this.heatArtifactType = heatArtifactType;
+		this.heatEnvArtifactType = heatEnvArtifactType;
+		this.heatArtifactDisplayName = heatArtifactDisplayName;
+		this.heatParameterDefinition = heatParameterDefinition;
+	}
+
+	public String getHeatArtifactDisplayName() {
+		return heatArtifactDisplayName;
+	}
+
+	public void setHeatArtifactDisplayName(String heatArtifactDisplayName) {
+		this.heatArtifactDisplayName = heatArtifactDisplayName;
+	}
+
+	public String getHeatLabel() {
+		return heatLabel;
+	}
+
+	public void setHeatLabel(String heatLabel) {
+		this.heatLabel = heatLabel;
+	}
+
+	public String getHeatEnvLabel() {
+		return heatEnvLabel;
+	}
+
+	public void setHeatEnvLabel(String heatEnvLabel) {
+		this.heatEnvLabel = heatEnvLabel;
+	}
+
+	public String getHeatArtifactType() {
+		return heatArtifactType;
+	}
+
+	public void setHeatArtifactType(String heatArtifactType) {
+		this.heatArtifactType = heatArtifactType;
+	}
+
+	public String getHeatEnvArtifactType() {
+		return heatEnvArtifactType;
+	}
+
+	public void setHeatEnvArtifactType(String heatEnvArtifactType) {
+		this.heatEnvArtifactType = heatEnvArtifactType;
+	}
+
+	public List<HeatParameterDataDefinition> getHeatParameterDefinition() {
+		return heatParameterDefinition;
+	}
+
+	public void setHeatParameterDefinition(List<HeatParameterDataDefinition> heatParameterDefinition) {
+		this.heatParameterDefinition = heatParameterDefinition;
+	}
+
+	@Override
+	public String toString() {
+		return "HeatWithParametersDefinition [heatLabel=" + heatLabel + ", heatEnvLabel=" + heatEnvLabel + ", heatArtifactType=" + heatArtifactType + ", heatEnvArtifactType=" + heatEnvArtifactType + ", heatArtifactDisplayName="
+				+ heatArtifactDisplayName + ", heatParameterDefinition=" + heatParameterDefinition + "]";
+	}
+
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java
new file mode 100644
index 0000000..773cb57
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/LifeCycleStateEnum.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum LifeCycleStateEnum {
+
+	CHECKOUT("IN DESIGN CHECK OUT"), 
+	CHECKIN("IN DESIGN CHECK IN"), 
+	READY_FOR_TESTING("READY FOR TESTING"), 
+	IN_TESTING("IN TESTING"), 
+	WAITING_FOR_DISTRIBUTION("WAITING FOR DISTRIBUTION"), 
+	DISTRIBUTION_REJECTED("DISTRIBUTION REJECTED"), 
+	DISTRIBUTION_APPROVED("DISTRIBUTION APPROVED"), 
+	CERTIFIED("CERTIFIED"), 
+	DISTRIBUTED("DISTRIBUTED"),
+	IN_DESIGN("IN DESIGN");
+
+	private String value;
+	private String value2;
+
+	public String getValue() {
+		return value;
+	}
+
+	private LifeCycleStateEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java
new file mode 100644
index 0000000..63171a6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/MenuOptionsEnum.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum MenuOptionsEnum {
+
+	EDIT("Edit"), CHECK_IN("Check in"), CHECK_OUT("Check out"), VIEW("View"), SUBMIT_FOR_TEST("Submit For Test"), ACCEPT("Accept"), REJECT("Reject"), START_TEST("Start test"), DISTREBUTE("Distribute");
+
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private MenuOptionsEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java
new file mode 100644
index 0000000..785a355
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/PropertyInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+
+public class PropertyInfo {
+
+	public PropertyInfo() {
+		super();
+	}
+
+	public PropertyInfo(PropertyTypeEnum prop) {
+		super();
+		this.name = prop.getName();
+		this.value = prop.getValue();
+		this.type = prop.getType();
+		this.description = prop.getDescription();
+	}
+
+	private String name;
+	private String value;
+	private String type;
+	private String description;
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java
new file mode 100644
index 0000000..2c49c87
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ResourceCategoriesNameEnum.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum ResourceCategoriesNameEnum {
+
+	GENERIC("checkbox-resourcenewcategory.generic"), NETWORK_CONNECTIVITY("checkbox-resourcenewcategory.networkconnectivity"), NETWORK_ELEMENTS("checkbox-resourcenewcategory.generic.networkelements"), 
+	ABSTRACT("checkbox-resourcenewcategory.generic.abstract"), DATABASE_GENERIC("checkbox-resourcenewcategory.generic.database"), INFRASTRUCTURE("checkbox-resourcenewcategory.generic.infrastructure"), 
+	VIRTUAL_LINKS("checkbox-resourcenewcategory.networkconnectivity.virtuallinks"), CONNECTION_POINTS("checkbox-resourcenewcategory.networkconnectivity.connectionpoints"), NETWORKL4("checkbox-resourcenewcategory.networkl4+"), 
+	COMMON_NETWORK_RESOURCES("checkbox-resourcenewcategory.networkl4+.commonnetworkresources"), APPLICATIONL4("checkbox-resourcenewcategory.applicationl4+"), WEB_SERVER("checkbox-resourcenewcategory.applicationl4+.webserver"), 
+	APPLICATION_SERVER("checkbox-resourcenewcategory.applicationl4+.applicationserver"), CALL_CONTROL("checkbox-resourcenewcategory.applicationl4+.callcontrol"), BORDER_ELEMENT("checkbox-resourcenewcategory.applicationl4+.borderelement"), 
+	MEDIA_SERVERS("checkbox-resourcenewcategory.applicationl4+.mediaservers"), DATABASE("checkbox-resourcenewcategory.applicationl4+.database"), FIREWALL("checkbox-resourcenewcategory.applicationl4+.firewall"), 
+	LOAD_BALANCER("checkbox-resourcenewcategory.applicationl4+.loadbalancer"), NETWORK_L23("checkbox-resourcenewcategory.networkl2-3"), Router("checkbox-resourcenewcategory.networkl2-3.router"), 
+	WAN_Connectors("checkbox-resourcenewcategory.networkl2-3.wanconnectors"), LAN_CONNECTORS("checkbox-resourcenewcategory.networkl2-3.lanconnectors"), GATEWAY("checkbox-resourcenewcategory.networkl2-3.gateway"), 
+	INFRASTRUCTUREL23("checkbox-resourcenewcategory.networkl2-3.infrastructure");
+
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private ResourceCategoriesNameEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java
new file mode 100644
index 0000000..b90e311
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/ServiceCategoriesNameEnum.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum ServiceCategoriesNameEnum {
+
+	NETWORK_L13("checkbox-servicenewcategory.networkl1-3"), VOIPCALL_CONTROL("checkbox-servicenewcategory.voipcallcontrol"), NETWORKL4("checkbox-servicenewcategory.networkl4+"), MOBILITY("checkbox-servicenewcategory.mobility");
+
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private ServiceCategoriesNameEnum(String value) {
+		this.value = value;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java
new file mode 100644
index 0000000..9e81505
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TopMenuButtonsEnum.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum TopMenuButtonsEnum {
+
+	HOME("main-menu-button-home"), CATALOG("main-menu-button-catalog"), ON_BOARDING("main-menu-button-onboard");
+
+	private String value;
+	private String value2;
+
+	public String getButton() {
+		return value;
+	}
+
+	private TopMenuButtonsEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
new file mode 100644
index 0000000..d27eb0c
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/TypesEnum.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public enum TypesEnum {
+
+	RESOURCE("checkbox-resource"), VF("checkbox-vf"), VFC("checkbox-vfc"), CP("checkbox-cp"), VL("checkbox-vl"), SERVICE("checkbox-service"), PRODUCT("checkbox-product");
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private TypesEnum(String value) {
+		this.value = value;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java
new file mode 100644
index 0000000..2de8725
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserCredentials.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import org.openecomp.sdc.be.model.User;
+
+public class UserCredentials extends User {
+
+	// private String userName;
+	private String password;
+
+	public UserCredentials(String userId, String password, String firstname, String lastname, String role) {
+		super();
+		setUserId(userId);
+		// this.userName = userName;
+		this.password = password;
+		setFirstName(firstname);
+		setLastName(lastname);
+		setRole(role);
+	}
+
+	public UserCredentials() {
+		super();
+	}
+
+	// public String getUserName() {
+	// return userName;
+	// }
+	// public void setUserName(String userName) {
+	// this.userName = userName;
+	// }
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
new file mode 100644
index 0000000..0101b43
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/UserManagementTab.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class UserManagementTab {
+
+	public void searchUser(String searchCriterion){
+		ExtentTestActions.log(Status.INFO, "Searching a user by the value : " + searchCriterion);
+		WebElement searchBoxWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.SEARCH_BOX.getValue());
+		searchBoxWebElement.clear();
+		searchBoxWebElement.sendKeys(searchCriterion);
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public void setNewUserBox(String user){
+		ExtentTestActions.log(Status.INFO, "Inserting userid " + user);
+		WebElement createNewUserWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.NEW_USER_FIELD.getValue());
+		createNewUserWebElement.clear();
+		createNewUserWebElement.sendKeys(user);
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public void selectUserRole(UserRoleEnum userRole){
+		String role = userRole.name().toLowerCase();
+		ExtentTestActions.log(Status.INFO, "Selecting role " + userRole.name());
+		GeneralUIUtils.getSelectList(role, DataTestIdEnum.UserManagementEnum.ROLE_SELECT.getValue());
+	}
+	
+	public void updateUserRole(UserRoleEnum userRole, int rowIndx){
+		String role = userRole.name().toLowerCase();
+		ExtentTestActions.log(Status.INFO, "Updating the user role to " + userRole.name());
+		GeneralUIUtils.getSelectList(role, DataTestIdEnum.UserManagementEnum.UPDATE_ROLE.getValue() + rowIndx);
+	}
+	
+	public void clickCreateButton(){
+		ExtentTestActions.log(Status.INFO, "Clicking on 'Create' button.");
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.CREATE_BUTTON.getValue());
+	}
+	
+	public WebElement getRow(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.ROW_TABLE.getValue() + index);
+	}
+	
+	public WebElement getFirstName(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.FIRST_NAME.getValue() + index);
+	}
+	
+	public WebElement getLastName(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.LAST_NAME.getValue() + index);
+	}
+	
+	public WebElement getUserId(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.USER_ID.getValue() + index);
+	}
+	
+	public WebElement getEmail(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.EMAIL.getValue() + index);
+	}
+	
+	public WebElement getRole(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.ROLE.getValue() + index);
+	}
+	
+	public WebElement getLastActive(int index){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.UserManagementEnum.LAST_ACTIVE.getValue() + index);
+	}
+	
+	public void updateUser(int index){
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.UPDATE_USER_BUTTON.getValue() + index);
+	}
+	
+	public void deleteUser(int index){
+		ExtentTestActions.log(Status.INFO, "Deleting the user in row " + (index + 1));
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.DELETE_USER.getValue() + index);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+	}
+	
+	public void saveAfterUpdateUser(int index){
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.UserManagementEnum.SAVE_USER.getValue() + index);
+	}
+	
+	public List<WebElement> getAllRowsDisplayed(){
+		return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.UserManagementEnum.ROW_TABLE.getValue());
+	}
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java
new file mode 100644
index 0000000..540a36a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/VFCArtifact.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.datatypes;
+
+public class VFCArtifact {
+
+		String artifactUUID;
+		String artifactVersion;
+		String artifactname;
+		String artifacttype;
+		
+
+		public VFCArtifact(String artifactName, String artifactType, String uuid, String version){
+			artifactname = artifactName;
+			artifactUUID = uuid;
+			artifactVersion = version;
+			artifacttype = artifactType;
+		}
+		
+		public String getArtifactUUID() {
+			return artifactUUID;
+		}
+
+		public void setArtifactUUID(String artifactUUID) {
+			this.artifactUUID = artifactUUID;
+		}
+
+		public String getArtifactVersion() {
+			return artifactVersion;
+		}
+
+		public void setArtifactVersion(String artifactVersion) {
+			this.artifactVersion = artifactVersion;
+		}
+
+		public String getArtifactname() {
+			return artifactname;
+		}
+
+		public void setArtifactname(String artifactname) {
+			this.artifactname = artifactname;
+		}
+
+		public String getArtifacttype() {
+			return artifacttype;
+		}
+
+		public void setArtifacttype(String artifacttype) {
+			this.artifacttype = artifacttype;
+		}
+		
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal
new file mode 100644
index 0000000..ea93ddf
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/datatypes/environmentLocal
@@ -0,0 +1,10 @@
+//URL designer
+urlDesigner=http://172.20.43.136:8080/sdc1/proxy-designer1#/dashboard
+//URL tester
+urlTester=http://172.20.43.136:8080/sdc1/proxy-tester1
+//URL Vagrant
+urlDesignerVagrant=http://localhost:8181/sdc1/proxy-designer1#/dashboard
+//UrlStaging 
+UrlStaging=https://www.e-access.att.com/sdcpstage/sdc1/portal#/dashboard
+//UrlAdmin
+UrlAdmin=http://172.20.43.136:8080/sdc1/proxy-admin1#/adminDashboard
\ No newline at end of file
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
new file mode 100644
index 0000000..710188a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/AdminUserManagment.java
@@ -0,0 +1,289 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.AdminWorkspaceUIUtilies;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils;
+import org.openecomp.sdc.ci.tests.verificator.ErrorMessageUIVerificator;
+import org.openecomp.sdc.ci.tests.verificator.UserManagementVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class AdminUserManagment extends SetupCDTest {
+	
+	@DataProvider(name = "searchValues")
+	private final Object[][] searchString(){
+		User newUser = createNewUserUsingAPI();
+ 		return new Object[][]{{newUser.getUserId(), newUser}, {newUser.getFirstName(), newUser}, {newUser.getLastName(), newUser}, {newUser.getEmail(), newUser}};
+	}
+
+	//TC915100
+	@Test
+	public void creatNewUserTest() throws Exception {
+		
+		String userId = generateValidUserId();
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+		UserManagementVerificator.validateUserCreated(userId, userRole);
+	}
+	
+	//TC922253
+	@Test
+	public void creatNewUser_MacIdTest() throws Exception {
+		
+		String macId = generateValidMacId();
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(macId, userRole);
+		UserManagementVerificator.validateUserCreated(macId, userRole);
+	}
+	
+	//TC922253
+	@Test
+	public void createExistingUserTest(){
+		String userId = generateValidUserId();
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+		ExtentTestActions.log(Status.INFO, "Trying to create the same user once again.");
+		AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+		ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.USER_ALREADY_EXIST);
+	}
+
+	//TC922253
+	@Test
+	public void createInvalidMacIdTest(){
+		String macId = generateValidMacId();
+		StringBuilder invalidMacId = new StringBuilder(macId);
+		invalidMacId.setCharAt(0, 'a');
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		ExtentTestActions.log(Status.INFO, "Trying to create an invalid macId.");
+		AdminWorkspaceUIUtilies.createNewUser(invalidMacId.toString(), userRole);
+		ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.INVALID_USER_ID);
+	}
+	
+	//TC922253
+	@Test
+	public void specialCharInUserIdTest(){
+		String expectedErrorMsg = "User id not valid.";
+		String userId = generateValidUserId();
+		StringBuilder invalidUserId = new StringBuilder(userId);
+		invalidUserId.setCharAt(1, '#');
+		ExtentTestActions.log(Status.INFO, String.format("Trying to create an invalid user with special character (%s)", userId));
+		AdminGeneralPage.getUserManagementTab().setNewUserBox(invalidUserId.toString());
+		ExtentTestActions.log(Status.INFO, "Validating an error message is displayed as a result of invalid character.");
+		List<WebElement> inputErrors = null;
+		int inputErrorsSize = 0;
+		
+		try{
+			WebElement inputField = GeneralUIUtils.getWebElementByClassName("input-error");
+			ExtentTestActions.log(Status.INFO, String.format("Validating the message is : '%s'", expectedErrorMsg));
+			inputErrors = inputField.findElements(By.className("ng-scope"));
+			inputErrorsSize = inputErrors.size();
+			for (WebElement err : inputErrors){
+				String actualErrorMessage = err.getText();
+				if (actualErrorMessage.equals(expectedErrorMsg)){
+					inputErrorsSize--;
+				}
+			}
+		}
+		catch(Exception e){
+			ExtentTestActions.log(Status.INFO, "Did not find an error input.");
+			Assert.fail("Did not find an error message input.");
+		}
+		
+		Assert.assertEquals(inputErrors.size() - 1 , inputErrorsSize, "Did not find an error : " + expectedErrorMsg);
+	}
+	
+	//TC915101
+	@Test(dataProvider = "searchValues")
+	public void searchUserByCriterionsTest(String searchCriterion, User user) throws IOException{
+		setLog(searchCriterion);
+		AdminWorkspaceUIUtilies.searchForUser(searchCriterion);
+		UserManagementVerificator.validateFirstRowDisplayedCorrectly(user);
+	}
+
+	//TC915101
+	@Test
+	public void searchForUserByRoleTest(){
+		String userId = generateValidUserId();
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(userId, userRole);
+		AdminWorkspaceUIUtilies.searchForUser(userRole.name());
+		List<WebElement> allRows = GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.UserManagementEnum.USER_ID.getValue());
+		ExtentTestActions.log(Status.INFO, String.format("Found %s rows, looking for the user %s.", allRows.size(), userId));
+		int rowsCount = allRows.size();
+		for (int i = 0 ; i < allRows.size() ; i++){
+			String userIdFromTable = GeneralUIUtils.getTextContentAttributeValue(allRows.get(i));
+			if (userIdFromTable.equals(userId)){
+				rowsCount--;
+				break;
+			}
+		}
+		Assert.assertEquals(allRows.size() - 1 , rowsCount , "Did not find a row with the userId " + userId);
+	}
+	
+	//TC915102
+	@Test
+	public void modifyUserRoleTest(){
+		User user = new User();
+		user.setUserId(generateValidUserId());
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(user.getUserId(), userRole);
+		UserRoleEnum updatedUserRole = UserRoleEnum.TESTER;
+		AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole);
+		UserManagementVerificator.validateUserRoleUpdated(0, updatedUserRole);
+		UserManagementVerificator.validateUserRoleUpdatedViaRest(user, getUser(), updatedUserRole);
+	}
+	
+	//TC915103
+	@Test
+	public void deleteUserTest(){
+		User user = new User();
+		user.setUserId(generateValidUserId());
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(user.getUserId(), userRole);
+		AdminWorkspaceUIUtilies.deleteFirstRow();
+		UserManagementVerificator.validateUserIdNotFound(user.getUserId());
+		UserManagementVerificator.validateUserNotFoundViaRest(user, getUser());
+	}
+	
+	//TC951428
+	@Test
+	public void modifyUserRoleWithTaskInHand_Checkout() throws Exception{
+		User newUser = new User();
+		newUser.setUserId(generateValidUserId());
+		UserRoleEnum userRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.createNewUser(newUser.getUserId(), userRole);
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, newUser);
+		ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName() + " with the user " + newUser.getUserId());
+		RestResponse createResourceResp = ResourceRestUtils.createResource(resourceMetaData, newUser);
+		Assert.assertEquals(createResourceResp.getErrorCode().intValue(), 201, "Did not succeed to create a VF");
+		
+		UserRoleEnum updatedUserRole = UserRoleEnum.TESTER;
+		AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole);
+		
+		ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS);
+	}
+	
+	@Test
+	public void modifyUserRoleWithTaskInHand_InTesting() throws Exception{
+		User newTesterUser = new User();
+		newTesterUser.setUserId(generateValidUserId());
+		UserRoleEnum userTesterRole = UserRoleEnum.TESTER;
+		userTesterRole.setUserId(newTesterUser.getUserId());
+		AdminWorkspaceUIUtilies.createNewUser(newTesterUser.getUserId(), userTesterRole);
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ExtentTestActions.log(Status.INFO, "Creating a new VF named " + resourceMetaData.getName());
+		ResourceUIUtils.createResource(resourceMetaData, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
+		Resource resourceObjectByNameAndVersion = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, resourceMetaData.getName(), "0.1");
+		ExtentTestActions.log(Status.INFO, "Getting the VF to 'In Testing' state.");
+		AtomicOperationUtils.changeComponentState(resourceObjectByNameAndVersion, userTesterRole, LifeCycleStatesEnum.STARTCERTIFICATION, true);
+		ExtentTestActions.log(Status.INFO, "Succeeded - The VF is in testing state.");
+		
+		reloginWithNewRole(UserRoleEnum.ADMIN);
+		UserRoleEnum updatedUserRole = UserRoleEnum.DESIGNER;
+		AdminWorkspaceUIUtilies.searchForUser(newTesterUser.getUserId());
+		AdminWorkspaceUIUtilies.updateUserRole(0, updatedUserRole);
+		
+		ErrorMessageUIVerificator.validateErrorMessage(ActionStatus.CANNOT_UPDATE_USER_WITH_ACTIVE_ELEMENTS);
+	}
+	
+	
+	private static String generateValidUserId() {
+		String charsPattern = "abcdefghijklmnopqrstuvwxyz";
+		String digitPatter = "0123456789";
+		String chars = ResourceUIUtils.buildStringFromPattern(charsPattern, 2);
+		String digits = ResourceUIUtils.buildStringFromPattern(digitPatter, 4);
+		return chars + digits;
+	}
+	
+	private String generateValidMacId() {
+		String digitPatter = "0123456789";
+		String digits = ResourceUIUtils.buildStringFromPattern(digitPatter, 5);
+		return "m" + digits;
+	}
+	
+	private User createNewUserUsingAPI() {
+		UserRoleEnum role = UserRoleEnum.DESIGNER;
+		String userId = generateValidUserId();
+		User userByEnv = new User("Tzemer", "Gefen", userId, "userId@intl.sdc.com", role.name(), null);
+		User adminUser = getUserByEnv(UserRoleEnum.ADMIN);
+		try {
+			RestResponse createUserResp = UserRestUtils.createUser(userByEnv, adminUser);
+			Assert.assertEquals(createUserResp.getErrorCode().intValue(), 201, "Did not succeed to create a new user using API.");
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return userByEnv;
+	}
+	
+	
+	private User getUserByEnv(UserRoleEnum userRole) {
+		try{
+			if (!getConfig().getUrl().contains("localhost") && !getConfig().getUrl().contains("127.0.0.1")) {
+				return getUserFromFileByRole(userRole);
+			}
+			else{
+				return getUser(userRole);
+			}
+		}
+		catch (Exception e){
+			throw new RuntimeException(e);
+		}
+	}
+
+
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.ADMIN;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
new file mode 100644
index 0000000..10389d9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CatalogLeftPanelTest.java
@@ -0,0 +1,236 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelSubCategoryCheckbox;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.CatalogVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+@Test(singleThreaded = true)
+public class CatalogLeftPanelTest extends  SetupCDTest{
+	
+	private String filePath;
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = System.getProperty("filepath");
+	
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		}
+	}
+	
+	public static String[] resourceTypes = Arrays.stream(ResourceTypeEnum.class.getEnumConstants()).
+			map(ResourceTypeEnum::name).toArray(String[]::new);
+	
+	public static String[] catalogTypes = {"RESOURCE", "SERVICE", "PRODUCT"};	
+	
+	public static Object[][] provideData(String[] arObj) {
+	    Object[][] arObject = new Object[arObj.length][];
+
+	    int index = 0;
+	    for (Object obj : arObj) {
+	        arObject[index++] = new Object[]{obj};
+	    }
+	    return arObject;
+	}
+	
+	@DataProvider(name = "Resource_Type_List")
+	private static final Object[][] resourceTypeList(){
+		// Extract names of constants from enum as array of Strings 
+		ResourceTypeEnum[] resourceEnums = {ResourceTypeEnum.CP, ResourceTypeEnum.VF, ResourceTypeEnum.VFC, ResourceTypeEnum.VL};
+		String[] resourcesForTest = Arrays.stream(resourceEnums).map(ResourceTypeEnum::name).toArray(String[]::new);				
+		return provideData(resourcesForTest); 
+	}
+	
+	@DataProvider(name = "Type_List")
+	private static final Object[][] typeList(){
+		// Extract names of constants from enum as array of Strings 
+		Object[][] arObject = new Object[catalogTypes.length][];
+		int index = 0;
+        for (String catalogType : catalogTypes) {
+        	if (catalogType.equals("RESOURCE")){
+        		arObject[index++] = new Object[]{catalogType, resourceTypes};
+        	} else {
+        		arObject[index++] = new Object[]{catalogType, new String[] {catalogType}};
+        	}
+		}
+		return arObject; 
+	}
+	
+	@DataProvider(name = "Status_List")
+	private static final Object[][] statusList(){
+		CheckBoxStatusEnum[] checkboxes = {CheckBoxStatusEnum.CERTIFIED, 
+				                           CheckBoxStatusEnum.IN_DESIGN, 
+				                           CheckBoxStatusEnum.DISTRIBUTED,
+				                           CheckBoxStatusEnum.IN_TESTING,
+				                           CheckBoxStatusEnum.READY_FOR_TESTING};
+		Object[][] arObject = new Object[checkboxes.length][];
+		int index = 0;
+		for (CheckBoxStatusEnum checkbox: checkboxes) {
+			if (checkbox.equals(CheckBoxStatusEnum.CERTIFIED)){
+				arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.CERTIFIED, LifeCycleStateEnum.DISTRIBUTED, LifeCycleStateEnum.WAITING_FOR_DISTRIBUTION) };
+			} else if (checkbox.equals(CheckBoxStatusEnum.IN_DESIGN)) {
+				arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.CHECKIN, LifeCycleStateEnum.CHECKOUT)};
+			} else if (checkbox.equals(CheckBoxStatusEnum.DISTRIBUTED)) {
+				arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.DISTRIBUTED)};
+			} else if (checkbox.equals(CheckBoxStatusEnum.IN_TESTING)) {
+				arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.IN_TESTING)};
+			} else if (checkbox.equals(CheckBoxStatusEnum.READY_FOR_TESTING)) {
+				arObject[index++] = new Object[]{checkbox, Arrays.asList(LifeCycleStateEnum.READY_FOR_TESTING)};
+			}
+		}
+		return arObject;
+	}
+	
+	// filter by Type Resource in catalog
+	@Test(dataProvider = "Type_List")
+	public void filterByType(String catalogType, String[] classValues ) throws Exception {
+        setLog(catalogType);		
+//		getExtendTest().setDescription(catalogType);
+		
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf(catalogType));
+		
+		CatalogVerificator.validateType(TypesEnum.valueOf(catalogType));				
+	}
+	
+	@Test(dataProvider = "Resource_Type_List")
+	public void filterByResourceType(String resourceType) throws Exception {
+		setLog(resourceType);		
+//		getExtendTest().setDescription(resourceType);			
+		
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		CatalogUIUtilitis.catalogFilterTypeChecBox(TypesEnum.valueOf(resourceType));
+		
+		CatalogVerificator.validateType(TypesEnum.valueOf(resourceType));	
+	}
+	
+	@Test(dataProvider = "Status_List")
+	public void filterByStatus(CheckBoxStatusEnum statusCheckbox, List<LifeCycleStateEnum> lifecycleStates) throws Exception{
+		setLog(statusCheckbox.name());		
+//		getExtendTest().setDescription(statusCheckbox.name());
+		
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.CATEGORIES);
+		CatalogUIUtilitis.catalogFilterStatusChecBox(statusCheckbox);
+		
+		CatalogVerificator.validateStatus(lifecycleStates, statusCheckbox.name());
+	}
+
+	@Test
+	public void filterByUpperCategory() throws Exception{		
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.TYPE);
+		
+		WebElement categorieCheckbox = CatalogUIUtilitis.clickOnUpperCategoryCheckbox();
+		
+		CatalogVerificator.validateCategory(categorieCheckbox.getAttribute("textContent").trim());
+	}
+
+	@Test
+	public void filterByGenericDtabaseSubCategory() throws Exception{		
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		CatalogUIUtilitis.clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle.TYPE);
+
+		WebElement checkboxElement = GeneralUIUtils.getElementsByCSS(CatalogPageLeftPanelSubCategoryCheckbox.DATABASE.getValue()).get(0);
+		String checkboxElementName = checkboxElement.getAttribute("textContent").trim();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s subcategory ...", checkboxElementName));
+		GeneralUIUtils.clickOnAreaJS(checkboxElement);
+		CatalogVerificator.validateSubCategory("Generic", checkboxElementName);
+	}
+	
+	@Test(priority = 1)
+	public void lastUpdatedService() throws Exception{
+		// create service 
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue());
+		String firstElementName = cardElements.get(0).getAttribute("textContent").trim();
+		assertTrue(String.format("Wrong element name, Exepected : %s , Actual: %s", serviceMetadata.getName(), firstElementName), serviceMetadata.getName().equals(firstElementName));			
+	}
+	
+	@Test(priority = 17)
+	public void lastUpdatedResource() throws Exception{
+		// create resource 
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue());
+		String firstElementName = cardElements.get(0).getAttribute("textContent").trim();
+		assertTrue(String.format("Wrong element name, Exepected : %s , Actual: %s", vfMetaData.getName(), firstElementName), vfMetaData.getName().equals(firstElementName));			
+	}
+	
+	@Test(priority = 5)
+	public void fromCatalogCheckout() throws Exception{
+		// create resource 
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		GeneralUIUtils.findComponentAndClickInCatalog(vfMetaData.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());		
+	}
+	
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
new file mode 100644
index 0000000..d2c787e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Categories.java
@@ -0,0 +1,213 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class Categories extends SetupCDTest {
+
+	
+	@Test
+	public void createResourceCategory() throws Exception {
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+		GeneralUIUtils.clickSomewhereOnPage();
+		List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+		List<String> collect = resourceCategoriesList.stream().map(f -> f.getText()).collect(Collectors.toList());
+		collect.contains(newResourceCategory);
+		
+	
+	}
+	
+	@Test
+	public void createServiceCategory() throws Exception {
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		GeneralUIUtils.clickSomewhereOnPage();
+		List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+		List<String> collect = serviceCategoriesList.stream().map(f -> f.getText()).collect(Collectors.toList());
+		collect.contains(newserviceCategory);
+		
+	}
+	
+	
+	@Test
+	public void createResourceSubCategory() throws Exception {
+	
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+		String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+		String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+		List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+		AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.clickSomewhereOnPage();
+		
+		
+	}
+	
+	
+	@Test
+	public void createExistingResourceCategory() throws Exception {
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+		String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS.name());
+		Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+		
+			
+	}
+	
+	@Test
+	public void createExistingServiceCategory() throws Exception {
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		AdminGeneralPage.selectUserManagmetTab();
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+		String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_CATEGORY_ALREADY_EXISTS.name());
+		Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+		
+	}
+	
+	@Test
+	public void createExsitingResourceSubCategory() throws Exception {
+	
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+		String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+		String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+		List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+		AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+		AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+		GeneralUIUtils.waitForLoader();
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+		String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.COMPONENT_SUB_CATEGORY_EXISTS_FOR_CATEGORY.name());
+		Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+		
+	}
+	
+	
+	@Test
+	public void createServiceWithNewCategory() throws Exception {
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+		String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+		String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+		List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+		AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+		GeneralUIUtils.waitForLoader();
+		AdminGeneralPage.selectUserManagmetTab();
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		List<CategoryDefinition> categories = serviceMetadata.getCategories();
+		categories.get(0).setName(newserviceCategory);
+		
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+	
+	}
+	
+	
+	@Test
+	public void createResourceWithNewCategory() throws Exception {
+		
+		AdminGeneralPage.selectCategoryManagmetTab();
+		String newResourceCategory = ElementFactory.getDefaultCategory().getName();
+		String newserviceCategory = ElementFactory.getDefaultCategory().getName();
+		String newSubCategory = ElementFactory.getDefaultSubCategory().getName();
+		AdminGeneralPage.createNewResourceCategory(newResourceCategory);
+		AdminGeneralPage.createNewServiceCategory(newserviceCategory);
+		List<WebElement> serviceCategoriesList = AdminGeneralPage.getServiceCategoriesList();
+		List<WebElement> resourceCategoriesList = AdminGeneralPage.getResourceCategoriesList();
+		AdminGeneralPage.addSubCategoryToResource(resourceCategoriesList, newResourceCategory , newSubCategory);
+		GeneralUIUtils.waitForLoader();
+		AdminGeneralPage.selectUserManagmetTab();
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		List<CategoryDefinition> categories = resourceMetaData.getCategories();
+		CategoryDefinition categoryDefinition = categories.get(0);
+		categoryDefinition.setName(newResourceCategory);
+		SubCategoryDefinition subCategoryDefinition = categoryDefinition.getSubcategories().get(0);
+		subCategoryDefinition.setName(newSubCategory);
+		
+		ResourceUIUtils.createResource(resourceMetaData, getUser());
+		
+	
+	}
+	
+	
+	
+
+	
+	
+	
+
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.ADMIN;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
new file mode 100644
index 0000000..2c2b09a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/CustomizationUUID.java
@@ -0,0 +1,383 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.CustomizationUUIDVerificator;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class CustomizationUUID extends SetupCDTest {
+	
+	private static final String DESCRIPTION = "kuku";
+	private static final String ARTIFACT_LABEL = "artifact3";
+	private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+	private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+	private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+	private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+	private String filePath;
+	
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = System.getProperty("filepath");
+	
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		}
+	}
+	
+	@Test
+	public void uniqueCustomizationUUIDforeachVFi() throws Exception {
+		
+		
+		ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		List customizationUUIDs = new ArrayList<String>();
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+					
+		
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+		CanvasElement VFiElement2 = addElemntToCanvas(vfMetaData, canvasManager);
+		CanvasElement VFiElement3 = addElemntToCanvas(vfMetaData, canvasManager);
+		
+		
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+	
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement2);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement3);
+		
+		ServiceGeneralPage.clickCheckoutButton();
+		canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement VFiElement4 = addElemntToCanvas(vfMetaData, canvasManager);
+		CanvasElement VFiElement5 = addElemntToCanvas(vfMetaData, canvasManager);
+		CanvasElement VFiElement6 = addElemntToCanvas(vfMetaData, canvasManager);
+		
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement4);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement5);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement6);
+		
+		CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+			
+
+		}
+
+
+	@Test
+	public void uniqueCustomizationUUIDafterArtifactCRUDofVFi() throws Exception {
+		
+		
+		ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		List customizationUUIDs = new ArrayList<>();
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+					
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+			
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+		//add artifact to VFI
+		
+		ServiceGeneralPage.clickCheckoutButton();
+		canvasManager = CanvasManager.getCanvasManager();
+	
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+		
+		canvasManager.clickOnCanvaElement(VFiElement1);
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+		
+		
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+		
+		//delete VFI artifacts
+		
+		ServiceGeneralPage.clickCheckoutButton();
+		canvasManager = CanvasManager.getCanvasManager();
+		canvasManager.clickOnCanvaElement(VFiElement1);
+		CompositionPage.showDeploymentArtifactTab();
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue() + ARTIFACT_LABEL);
+		SetupCDTest.getExtendTest().log(Status.INFO, "Going to delete "  +  HEAT_FILE_YAML_NAME + " artifact" + " and check if deleted");
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + ARTIFACT_LABEL);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+		
+		
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+				
+		CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+		
+		}
+
+	
+	@Test
+	public void uniqueCustomizationUUIDchangeVFiVersion() throws Exception {
+		
+		
+		ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		List customizationUUIDs = new ArrayList<>();
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+					
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+			
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+		//change VF version
+		HomePage.navigateToHomePage();
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		//update VFI version
+		
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		ServiceGeneralPage.clickCheckoutButton();
+		canvasManager = CanvasManager.getCanvasManager();
+		canvasManager.clickOnCanvaElement(VFiElement1);
+		CompositionPage.changeComponentVersion(canvasManager, VFiElement1, "2.0");
+		
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+		CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+		
+		}
+	
+	
+	@Test
+	public void uniqueCustomizationUUIDaddRelation() throws Exception {
+		
+		
+		ResourceReqDetails vfMetaData = createNewResourceWithArtifactSubmitForTesting();
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		List customizationUUIDs = new ArrayList<>();
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+					
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement VFiElement1 = addElemntToCanvas(vfMetaData, canvasManager);
+			
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+		//change VF version
+		HomePage.navigateToHomePage();
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		//update VFI version
+		
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		ServiceGeneralPage.clickCheckoutButton();
+		canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(NormativeTypesEnum.PORT.getFolderName());
+		CanvasElement portElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);
+		canvasManager.linkElements(portElement, VFiElement1);
+		
+		canvasManager.clickOnCanvaElement(VFiElement1);
+		
+		
+		ServiceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		canvasManager = findServiceAndNavigateToCanvas(serviceMetadata);
+		addCanvasElementToList(customizationUUIDs, canvasManager, VFiElement1);
+		
+		CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDs);
+		
+		}
+	
+	
+	
+	public CanvasManager findServiceAndNavigateToCanvas(ServiceReqDetails serviceMetadata) throws Exception {
+		CanvasManager canvasManager;
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		canvasManager = CanvasManager.getCanvasManager();
+		return canvasManager;
+	}
+
+	public ResourceReqDetails createNewResourceWithArtifactSubmitForTesting() throws Exception {
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+		}
+		AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+		
+		String newDescription = "new description";
+		DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+		DeploymentArtifactPage.artifactPopup().clickDoneButton();
+		String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+		AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.clickOK();
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+//		ResourceReqDetails vfcCompute = ElementFactory.getDefaultResource(NormativeTypesEnum.COMPUTE);
+		CompositionPage.searchForElement(NormativeTypesEnum.COMPUTE.name());
+		CanvasManager canvasManagerVF = CanvasManager.getCanvasManager();
+		CanvasElement VFiElement1 = canvasManagerVF.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+		
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+		return vfMetaData;
+	}
+
+	public void addCanvasElementToList(List customizationUUIDs, CanvasManager canvasManager, CanvasElement VFiElement1)
+			throws Exception {
+		canvasManager.clickOnCanvaElement(VFiElement1);
+		WebElement VFi1customizationUUID = CompositionPage.getCustomizationUUID();
+		customizationUUIDs.add(VFi1customizationUUID.getText());
+	}
+
+	public CanvasElement addElemntToCanvas(ResourceReqDetails vfMetaData, CanvasManager canvasManager)
+			throws Exception {
+		CompositionPage.searchForElement(vfMetaData.getName());
+		CanvasElement VFiElement1 = canvasManager.createElementOnCanvas(vfMetaData.getName());
+		return VFiElement1;
+	}
+	
+		public static void changeDeleteAndValidateVersionOnGeneralPage(String previousVersion, String currentVersion, String serviceName) throws Exception{
+		GeneralPageElements.selectVersion("V" + previousVersion);
+		ServiceVerificator.verifyVersionUI(previousVersion);
+		GeneralUIUtils.clickJSOnElementByText("latest version");
+		ServiceVerificator.verifyVersionUI(currentVersion);
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		GeneralUIUtils.findComponentAndClick(serviceName);
+		ServiceVerificator.verifyVersionUI(previousVersion);		
+	}	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
new file mode 100644
index 0000000..87bf7b0
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/DeploymentViewTests.java
@@ -0,0 +1,286 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentViewTests extends SetupCDTest {
+	
+	private String filePath;
+	
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = System.getProperty("filepath");
+	
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		}
+	}
+	
+	@DataProvider(name = "CSAR_VF_Files", parallel = false)
+    public Object[][] createDataX() {
+             return new Object[][] { { "vSeGWdoubleMembers.csar" }, { "vSeGW.csar" }, {"vSeGWsingleModule.csar"}};
+    }
+	
+	
+	@Test(dataProvider = "CSAR_VF_Files")
+	public void deploymentScreenDCAEAssetImportCSARTest(String baseFileName) throws Exception{
+    // 		
+		setLog(baseFileName);		
+//		getExtendTest().setDescription(baseFileName);
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen();
+		List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
+		DeploymentViewVerificator verificator = new DeploymentViewVerificator(filePath + baseFileName);
+		verificator.verifyDeploymentPageModules(moduleRowsFromTable);
+		for(WebElement moduleRow :moduleRowsFromTable){
+			String moduleRowText = moduleRow.getText();
+			verificator.verifyDeploymentPageSubElements(moduleRowText.split("\\.\\.")[1]);
+			DeploymentPage.updateModuleName(moduleRowText, "updatedName");
+			String updatedModuleName = DeploymentPage.reconstructModuleName(moduleRowText.split("\\.\\."), "updatedName");
+			verificator.verifyComponentNameChanged( moduleRowText, updatedModuleName);
+			// Close module
+			GeneralUIUtils.clickOnElementByText(updatedModuleName);
+		}
+	}
+	
+	@Test
+	public void deploymentScreenDCAEAssetUpdateWithNewGroupCSAR_TC1368223_Test() throws Exception{		
+		String baseFileName   = "baseUpdateMinusGroupFlowVF.csar";
+		String updateFileName = "baseUpdateFlowVF.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+		metaDataFromUI.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0"); 
+                                                                         put("moduleID", "primary");}});
+		
+		// add new group, base_ldsa
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now", 3));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);		
+
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));		
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	};
+	
+	@Test
+	public void deploymentScreenDCAEAssetDeleteGroupFromCSAR_TC1368281_Test() throws Exception{		
+		String baseFileName   = "baseUpdateFlowVF.csar";
+		String updateFileName = "baseUpdateMinusGroupFlowVF.csar";
+				
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 3));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+		
+		// remove group base_ldsa
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group should be removed", 2));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);		
+		
+		// validate that group was removed
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
+		
+		Map<String, HashMap<String, String>> metaDataFromUI2 = DeploymentPage.collectMetaDataFromUI();
+		metaDataFromUI2.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0"); 
+		                                                                  put("moduleID", "primary");}});
+		
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		// add group base_ldsa
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group should be added", 3));
+		ResourceUIUtils.updateVfWithCsar(filePath, baseFileName);
+		
+		// validate that group was added
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI2, new DeploymentViewVerificator(filePath + baseFileName));
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	}
+	
+	@Test
+	public void deploymentScreenDCAEAssetUpdateWithNewGroupWithoutMembersCSAR_TC1368280_Test() throws Exception{		
+		String baseFileName    = "baseUpdateMinusGroupFlowVF.csar";
+		String updateFileName  = "baseUpdateAddGroupNoMembersUpdateFlow.csar";
+		String updateFileName2 = "baseUpdateFlowVF.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());				
+		
+		// add new group without members, base_ldsa
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group without members", 3));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);		
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+        
+		// validate that group was added and no members exist
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(null, new DeploymentViewVerificator(filePath + updateFileName));
+	    
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		// add group base_ldsa with members
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now, base_ldsa group with members", 3));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName2);
+		
+		// validate that member was added to base_ldsa group
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName2));
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	};
+	
+	@Test
+	public void deploymentScreenDCAEAssetImportCSARWithArtifactSection_TC1368282_1_Test() throws Exception{		
+		String baseFileName   = "baseUpdateFlowTwoArtifactsToGroup.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());					
+
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(null, new DeploymentViewVerificator(filePath + baseFileName));
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	};
+	
+	@Test
+	public void deploymentScreenDCAEAssetImportCSARRemoveArtifact_TC1368282_2_Test() throws Exception{		
+		String baseFileName   = "baseUpdateFlowTwoArtifactsToGroup.csar";
+		String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+		
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		// remove artifact from every group
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 3 artifacts in every group"));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	};
+	
+	@Test
+	public void deploymentScreenDCAEAssetImportCSARAddArtifact_TC1368282_3_Test() throws Exception{		
+		String baseFileName   = "baseUpdateFlowTwoArtifactsToGroup.csar";
+		String updateFileName = "baseUpdateFlowOneArtifactToGroup.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 3 artifacts in every group ", 3));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, updateFileName, getUser());
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+		
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		// add artifact to every group
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be 4 artifacts in every group"));
+		ResourceUIUtils.updateVfWithCsar(filePath, baseFileName);
+
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + baseFileName));
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	};
+	
+	@Test
+	public void deploymentScreenDCAEAssetImportCSARMixArtifacts_TC1368282_4_Test() throws Exception{		
+		String baseFileName   = "baseUpdateFlowTwoArtifactsToGroup.csar";
+		String updateFileName = "baseUpdateMixedArtifacts.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups, should be 4 artifacts in every group ", 3));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+		
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		//mix artifacts between groups
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, mixing between artifacts and groups", 3));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);
+		
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator());
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	};
+	
+	@Test
+	public void deploymentScreenDCAEAssetUpdateVFModule_TC1296437_Test() throws Exception{
+		String baseFileName   = "baseUpdateMinusGroupFlowVF.csar";
+		String updateFileName = "baseUpdateFlowVF.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating resource with %s groups ", 2));
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, baseFileName, getUser());
+//		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating %s group version, should be %s ", moduleRowText, metaDataFromUI.get(moduleRowText.split("\\.\\.")[1])));
+		
+		Map<String, HashMap<String, String>> metaDataFromUI = DeploymentPage.collectMetaDataFromUI();
+		metaDataFromUI.put("base_ldsa", new HashMap<String, String> (){ {put("version", "0"); 
+                                                                         put("moduleID", "primary");}});
+		
+		DeploymentViewVerificator.validateEditPopover();
+		
+		ResourceGeneralPage.getLeftMenu().moveToGeneralScreen();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating VF with new file, should be %s groups now", 3));
+		ResourceUIUtils.updateVfWithCsar(filePath, updateFileName);		
+        
+		assertTrue(resourceMetaData.getName().equals(ResourceGeneralPage.getNameText()));
+		DeploymentViewVerificator.regularDepoymentScreenVerificator(metaDataFromUI, new DeploymentViewVerificator(filePath + updateFileName));		
+		DeploymentViewVerificator.validateModuleNameUpadate();
+	}
+	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
new file mode 100644
index 0000000..6a80dfe
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportDCAE.java
@@ -0,0 +1,678 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class ImportDCAE extends SetupCDTest {
+
+	private String filePath;
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = System.getProperty("filepath");
+	
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		}
+	}
+	
+	@Test
+	public void updateDCAEAsset() throws Exception {
+         ResourceReqDetails resourceMetaData = createDCAEAsset();
+
+		// update Resource
+		ResourceReqDetails updatedResource = new ResourceReqDetails();
+		updatedResource.setName("ciUpdatedNameImportDCAE");
+		updatedResource.setDescription("kuku");
+		updatedResource.setVendorName("updatedVendor");
+		updatedResource.setVendorRelease("updatedRelease");
+		updatedResource.setContactId("ab0001");
+		updatedResource.setCategories(resourceMetaData.getCategories());
+		updatedResource.setVersion("0.1");
+ 		List<String> newTags = resourceMetaData.getTags();
+		newTags.remove(resourceMetaData.getName());
+		newTags.add(updatedResource.getName());
+		updatedResource.setTags(newTags);
+		ResourceUIUtils.updateResource(updatedResource, getUser());
+
+		VfVerificator.verifyVFMetadataInUI(updatedResource);
+		VfVerificator.verifyVFUpdated(updatedResource, getUser());
+	}
+	
+	@Test
+	public void vfcLinkedToComputeInDCAEAssetFlowTest() throws Exception {
+		String fileName = "importVFC_VFC14.yml";
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		
+		try{
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+			
+			reloginWithNewRole(UserRoleEnum.TESTER);
+			GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+			TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+	
+			reloginWithNewRole(UserRoleEnum.DESIGNER);
+			ResourceReqDetails resourceMetaData = createDCAEAsset();
+	
+			DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+			CanvasManager canvasManager = CanvasManager.getCanvasManager();
+			CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+			CompositionPage.searchForElement(atomicResourceMetaData.getName());
+			CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+			Assert.assertNotNull(cpElement);
+			ServiceVerificator.verifyNumOfComponentInstances(resourceMetaData, "0.1", 4, getUser());
+			
+			canvasManager.linkElements(cpElement, computeElement);
+	
+			resourceMetaData.setVersion("0.1");
+			VfVerificator.verifyLinkCreated(resourceMetaData, getUser(), 1);
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+		}
+
+	}
+	
+	@Test
+	public void addUpdateDeleteDeploymentArtifactToDCAEAssetTest() throws Exception {
+		createDCAEAsset();
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+		}
+		assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+		
+		String newDescription = "new description";
+		DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+		DeploymentArtifactPage.artifactPopup().clickDoneButton();
+		String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+		assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.clickOK();
+		assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+		
+		assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+	}
+	
+	@Test
+	public void addUpdateDeleteInformationalArtifactDCAEAssetTest() throws Exception {
+		createDCAEAsset();
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+		InformationalArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+		
+		assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
+		
+		String newDescription = "new description";
+		InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
+		InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+		InformationalArtifactPage.artifactPopup().clickDoneButton();
+		String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
+		assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+		InformationalArtifactPage.clickOK();
+		assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+	}
+	
+	@Test
+	public void addPropertiesToVfcInstanceInDCAEAssetTest() throws Exception {
+		String fileName = "importVFC_VFC15.yml";
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		
+		try{
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+	
+			createDCAEAsset();
+	
+			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.searchForElement(atomicResourceMetaData.getName());
+			CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+	
+			vfCanvasManager.clickOnCanvaElement(vfcElement);
+			CompositionPage.showPropertiesAndAttributesTab();
+			List<WebElement> properties = CompositionPage.getProperties();
+			String propertyValue = "abc123";
+			for (int i = 0; i < 2; i++) {
+				WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+				findElement.click();
+				PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
+				PropertiesPage.getPropertyPopup().clickSave();				
+				
+				findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+				assertTrue(findElement.getText().equals(propertyValue));
+			}
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+		}
+	}
+	
+	@Test
+	public void changeInstanceVersionDCAEAssetTest() throws Exception{
+		ResourceReqDetails atomicResourceMetaData = null;
+		ResourceReqDetails vfMetaData = null;
+		CanvasManager vfCanvasManager;
+		CanvasElement vfcElement = null;
+		String fileName = "importVFC_VFC16.yml";
+		try{
+			atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+			
+			vfMetaData = createDCAEAsset();
+			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			vfCanvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.searchForElement(atomicResourceMetaData.getName());
+			vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());			
+		
+			CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+			assert(false);
+		}
+		catch(Exception e){ 
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+			Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+			
+			
+			reloginWithNewRole(UserRoleEnum.TESTER);
+			GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+			TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+			
+			reloginWithNewRole(UserRoleEnum.DESIGNER);
+			GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			vfCanvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
+			
+			//verfication
+			VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
+		}
+			
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+		}
+		
+	}
+	
+	// future removed from ui
+	@Test(enabled = false)
+	public void addUpdateDeleteSimplePropertiesToDCAEAssetTest() throws Exception{
+		createDCAEAsset();
+			
+		ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+		List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+		int propertiesCount = PropertiesPage.getElemenetsFromTable().size();	
+		for (PropertyTypeEnum prop : propertyList){
+			PropertiesUIUtils.addNewProperty(prop);
+		}
+		assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+		VfVerificator.verifyPropertiesInUI(propertyList);
+		PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
+
+		PropertyTypeEnum prop = propertyList.get(0);
+		prop.setDescription("updatedDescription");
+		prop.setValue("value");
+		PropertiesUIUtils.updateProperty(prop);
+		
+		PropertiesPage.clickDeletePropertyArtifact(prop.getName());
+		assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
+	}
+	
+	// future removed from ui
+	@Test(enabled = false)
+	public void DCAEAssetInstancesInputScreenTest() throws Exception{
+		createDCAEAsset();
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		
+		Map<String, String> elementsIntancesMap = new HashMap<String, String>();
+		for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE)){
+			CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
+			vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
+			String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+			elementsIntancesMap.put(selectedInstanceName, element.getValue());
+		}
+
+		CompositionPage.moveToInputsScreen();
+		int canvasElementsSize = vfCanvasManager.getCanvasElements().size() + 2;
+		List<String> inputsNamesFromTable = InputsPage.getVFCInstancesNamesFromTable();
+		assertTrue(String.format("Instances count is not as Expected: %s Actual: %s", canvasElementsSize, inputsNamesFromTable.size()), inputsNamesFromTable.size() == canvasElementsSize);
+		
+		for (String instanceName :inputsNamesFromTable){
+			String resourceName = instanceName.split(" ")[0];
+			ResourceReqDetails resource = new ResourceReqDetails();
+			resource.setName(resourceName);
+			resource.setVersion("1.0");
+			if (resourceName.equals("Port")){
+				resource.setResourceType(ResourceTypeEnum.CP.toString());
+			} else {
+			    resource.setResourceType(ResourceTypeEnum.VFC.toString());
+			}
+			RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
+			Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
+			
+			List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(resourceName);
+			assertTrue("Some properties are missing in table. Instance name is : " + resourceName, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
+			VfVerificator.verifyVfInputs(instanceName, propertiesNameTypeJson, propertyRowsFromTable);
+			
+			GeneralUIUtils.clickOnElementByText(resourceName);
+		}		
+	}
+	
+	@Test
+	public void addAllInformationalArtifactPlaceholdersInDCAEAssetTest() throws Exception{		
+		createDCAEAsset();
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+			ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+		}
+		
+		assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length));
+	}
+	
+	@Test
+	public void verifyToscaArtifactsExistDCAEAssetTest() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		
+		final int numOfToscaArtifacts = 2;
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+		
+		for(int i = 0; i < numOfToscaArtifacts; i++){
+			String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
+			assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
+		}
+		
+		ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName());
+		VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
+	}
+	
+	@Test
+	public void DCAEAssetCertificationTest() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		
+		String vfName = vfMetaData.getName();
+		
+		ResourceGeneralPage.clickCheckinButton(vfName);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		TesterOperationPage.certifyComponent(vfName);
+		
+		vfMetaData.setVersion("1.0");
+		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+	}
+	
+	@Test
+	public void deleteDCAEAssetCheckedoutTest() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		
+		vfMetaData.setVersion("0.1");
+		VfVerificator.verifyVfDeleted(vfMetaData, getUser());
+	}
+	
+	@Test
+	public void revertDCAEAssetMetadataTest() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		
+		ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
+		vfRevertDetails.setName("ciUpdatedName");
+		vfRevertDetails.setDescription("kuku");
+		vfRevertDetails.setCategories(vfMetaData.getCategories());
+		vfRevertDetails.setVendorName("updatedVendor");
+		vfRevertDetails.setVendorRelease("updatedRelease");
+		ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
+		
+		GeneralPageElements.clickRevertButton();
+		
+		VfVerificator.verifyVFMetadataInUI(vfMetaData);
+	}
+	
+	@Test
+	public void addDeploymentArtifactInCompositionScreenDCAEAssetTest() throws Exception{
+		createDCAEAsset();
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER");
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+		
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
+		Assert.assertEquals(1, actualArtifactList.size());
+	}
+	
+	// future removed from ui
+	@Test(enabled = false)
+	public void addPropertyInCompositionScreenDCAEAssetTest() throws Exception{
+		createDCAEAsset();
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		CompositionPage.showPropertiesAndAttributesTab();
+		List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+		int propertiesCount = CompositionPage.getProperties().size();
+		for (PropertyTypeEnum prop : propertyList){
+			PropertiesUIUtils.addNewProperty(prop);
+		}
+		assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
+	}
+	
+	@Test
+	public void addDeploymentArtifactAndVerifyInCompositionScreenDCAEAssetTest() throws Exception{
+		createDCAEAsset();
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+		ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+		DeploymentArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+		assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		CompositionPage.showDeploymentArtifactTab();
+		List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
+		assertTrue(1 == deploymentArtifactsFromScreen.size());
+		
+		String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
+		assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
+	}
+	
+	@Test
+	public void checkoutDCAEAssetTest() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		GeneralPageElements.clickCheckoutButton();
+		
+		vfMetaData.setVersion("0.2");
+		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		
+		vfMetaData.setVersion("1.1");
+		vfMetaData.setUniqueId(null);
+		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+	}
+	
+	@Test
+	public void deleteInstanceFromDCAEAssetCanvas() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
+		
+		vfCanvasManager.clickOnCanvaElement(computeElement);
+		vfCanvasManager.deleteElementFromCanvas(computeElement);
+				
+		VfVerificator.verifyNumOfComponentInstances(vfMetaData, 2, getUser());
+	}
+	
+	@Test
+	public void changeInstanceNameInDCAEAssetTest() throws Exception{
+		createDCAEAsset();
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement computeElement = CompositionPage.addElementToCanvasScreen(LeftPanelCanvasItems.COMPUTE, vfCanvasManager);
+		
+		String updatedInstanceName = "updatedName";
+		vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
+		
+		String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
+		assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
+	}
+	
+	@Test
+	public void submitDCAEAssetForTestingWithNonCertifiedAsset() throws Exception{
+		String fileName = "importVFC_VFC17.yml";
+
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+		
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.addElementToCanvasScreen(atomicResourceMetaData.getName(), canvasManager);
+		
+		try{
+			CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+			assert(false);
+		}
+		catch(Exception e){ 
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+			Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));	
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+		}
+	}
+	
+	@Test
+	public void isDisabledAndReadOnlyInCheckinDCAEAssetTest() throws Exception{
+		ResourceReqDetails vfMetaData = createDCAEAsset();
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		
+		ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
+								   ResourceMetadataEnum.DESCRIPTION, 
+								   ResourceMetadataEnum.VENDOR_NAME, 
+								   ResourceMetadataEnum.VENDOR_RELEASE,
+								   ResourceMetadataEnum.CONTACT_ID,
+								   ResourceMetadataEnum.CATEGORY,
+								   ResourceMetadataEnum.TAGS};
+
+		for (ResourceMetadataEnum field: fieldsForCheck){
+			VfVerificator.verifyIsElementDisabled(field.getValue(), field.name());
+		}
+		VfVerificator.verifyIsElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue(), DataTestIdEnum.LifeCyleChangeButtons.CREATE.name());
+	}
+	
+	@Test
+	public void removeFileFromGeneralPageDCAEAssetTest() throws Exception{
+		String fileName2 = "service_input_test_VF2.csar";		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsarNoCreate(resourceMetaData, filePath, fileName2, getUser());
+		GeneralPageElements.clickDeleteFile();
+		
+		try{
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30);
+			assert(false);
+		}
+		catch(Exception e){
+			assert(true);	
+		}
+	}
+	
+	@Test
+	public void activityLogDCAEAssetTest() throws Exception{
+			createDCAEAsset();
+			
+	        ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+			
+			ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+			InformationalArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+			
+			ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen();
+			
+			int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size();
+			assertTrue("Wrong rows number, should be 2", numberOfRows == 2);
+	}
+	
+	@Test
+	public void checkinCheckoutChangeDeleteVersionDCAEAssetTest() throws Exception{
+		ResourceReqDetails atomicResourceMetaData = createDCAEAsset();
+		
+		ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+		GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+		GeneralPageElements.clickCheckoutButton();		
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+		
+		GeneralPageElements.selectVersion("V0.1");
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN);
+		GeneralUIUtils.clickJSOnElementByText("latest version");
+		
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+		String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText();
+		assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1"));
+	}
+	
+	@Test
+	public void badFileDCAEAssetTest() throws Exception {
+		String customFileName = "badVF.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());		
+		try{
+			ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, customFileName, getUser());
+			assert(false);
+		}
+		catch(Exception e){
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.CSAR_INVALID.name());
+			SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating error messdge...")); 
+			Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));	
+		}
+	}
+	
+	@Test
+	public void validContactAfterCreateDCAEAssetTest() throws Exception{
+		String fileName2 = "service_input_test_VF2.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating that userID equal to user that was logged in...")); 
+		assertTrue("wrong userId", resourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+	}			
+	
+	public ResourceReqDetails createDCAEAsset() throws Exception{
+		String fileName2 = "service_input_test_VF2.csar";		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+		resourceMetaData.setVersion("0.1");
+		return resourceMetaData;
+	}	
+	
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
new file mode 100644
index 0000000..92e9a2f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/ImportVFCAsset.java
@@ -0,0 +1,353 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.VFCverificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class ImportVFCAsset extends SetupCDTest {
+	
+	private ResourceReqDetails atomicResourceMetaData;
+	
+	private String filePath;
+	@BeforeClass
+	public void beforeClass(){
+		filePath = System.getProperty("filepath");
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "";
+		}
+	}
+	
+	@DataProvider(name = "assetFiles", parallel = false)
+    public Object[][] createDataX() {
+             return new Object[][] { { "importVFC_VFC9.yml" }, { "CP.yml" }, {"VL.yml"} };
+    }
+	
+	@Test
+	public void importVFCTest() throws Exception {
+		String fileName = "importVFC_VFC1.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+	}
+	
+	@Test
+	public void importDuplicateVFCTest() throws Exception {
+		String fileName = "importVFC_VFC2.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName()); 
+		
+		ResourceReqDetails atomicResourceMetaDataDup = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_INFRASTRUCTURE, getUser());
+		try{
+			ResourceUIUtils.importVfc(atomicResourceMetaDataDup, filePath, fileName, getUser());
+			assert(false);
+		}
+		catch(Exception e){
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.RESOURCE_ALREADY_EXISTS.name());
+			Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));	
+		} 
+	}
+	
+	@Test
+	public void badFileVFCTest() throws Exception {
+		String fileName = "importVFC_VFC3.yml";
+		String customFileName = "Heat-File 1.yaml";
+
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());		
+		try{
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, customFileName, getUser());
+			assert(false);
+		}
+		catch(Exception e){
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.INVALID_TOSCA_TEMPLATE.name());
+			Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));	
+		}
+	}
+	
+	@Test
+	public void validContactAfterCreateVFCTest() throws Exception{
+		String fileName = "importVFC_VFC4.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		
+		assertTrue("wrong userId", atomicResourceMetaData.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+	}
+	
+	@Test
+	public void validContactAfterUpdateVFCTest() throws Exception{
+		String fileName = "importVFC_VFC5.yml";
+		String userIdUpdated = "up1234";
+
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		
+		ResourceUIUtils.defineUserId(userIdUpdated);
+		assertTrue("userId is not updated",userIdUpdated.equals(ResourceGeneralPage.getContactIdText()));
+	}
+	
+	@Test
+	public void addUpdateDeleteDeploymentArtifactToVFCTest() throws Exception {
+		String fileName = "importVFC_VFC6.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));		
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact, new UploadArtifactPopup(true) );
+		}
+		assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+		
+		String newDescription = "new description";
+		DeploymentArtifactPage.updateDescription(newDescription, deploymentArtifactList.get(0));
+		String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+		assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.clickOK();
+		assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+		
+		assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+	}
+	
+	@Test
+	public void addUpdateDeletePlaceholdersInformationalArtefactVFCTest() throws Exception{
+		String fileName = "importVFC_VFC7.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		
+        ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+        
+		// create artifacts
+        List<ArtifactInfo> informationalArtifactList = new ArrayList<ArtifactInfo>();
+        informationalArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+        informationalArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuuuuku", "artifact3", "HEAT"));
+        for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+        	InformationalArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+		}		
+		assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(informationalArtifactList.size()));
+		
+		// update artifact description
+		String newDescription = "new description";
+		InformationalArtifactPage.clickEditArtifact(informationalArtifactList.get(0).getArtifactLabel());
+		InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+		InformationalArtifactPage.artifactPopup().clickDoneButton();
+		String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifactList.get(0).getArtifactLabel());
+		assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		// delete artifacts 
+		for (ArtifactInfo informationalArtifact : informationalArtifactList) {
+			InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+			InformationalArtifactPage.clickOK();
+		}
+		
+		assertTrue("not all artifacts is deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+		
+		// fill placeholders
+		for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+			ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+		}		
+		InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length);
+	}
+	
+	@Test
+	public void addSimplePropertiesToVFCTest() throws Exception{
+		String fileName = "importVFC_VFC8.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			
+		ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+		List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER, PropertyTypeEnum.FLOAT);
+		int propertiesCount = PropertiesPage.getElemenetsFromTable().size();	
+		for (PropertyTypeEnum prop : propertyList){
+			PropertiesUIUtils.addNewProperty(prop);
+		}
+		assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+		
+	}
+	
+		
+	@Test(dataProvider = "assetFiles")
+	public void checkinCheckoutChangeDeleteVersionVFCTest(String customfileName) throws Exception{
+		setLog(customfileName);		
+//		getExtendTest().setDescription(customfileName);
+		
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, customfileName, getUser());
+		
+		ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+		GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+		GeneralPageElements.clickCheckoutButton();		
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+		
+		GeneralPageElements.selectVersion("V0.1");
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKIN);
+		GeneralUIUtils.clickJSOnElementByText("latest version");
+		
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+		String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText();
+		assertTrue("Expected version: V0.1, Actual version: " + actualVersion, actualVersion.equals("V0.1"));
+	}
+	
+	@Test
+	public void certificationVFCTest() throws Exception{
+		String fileName = "importVFC_VFC10.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		
+		String vfName = atomicResourceMetaData.getName();
+		
+		ResourceGeneralPage.clickCheckinButton(vfName);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		TesterOperationPage.certifyComponent(vfName);
+		
+		atomicResourceMetaData.setVersion("1.0");
+		VfVerificator.verifyVFLifecycle(atomicResourceMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+	}
+	
+	@Test
+	public void activityLogVFCTest() throws Exception{
+		String fileName = "importVFC_VFC11.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		
+        ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+		InformationalArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+		
+		ResourceGeneralPage.getLeftMenu().moveToActivityLogScreen();
+		
+		int numberOfRows = GeneralUIUtils.getElementsByCSS("div[class^='flex-container']").size();
+		assertTrue("Wrong rows number, should be 2", numberOfRows == 2);
+	}
+	
+	@Test
+	public void removeFileFromGeneralPageVFCTest() throws Exception{
+		String fileName = "importVFC_VFC12.yml";
+
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfcNoCreate(atomicResourceMetaData, filePath, fileName, getUser());
+		
+		GeneralPageElements.clickDeleteFile();
+		
+		try{
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), 30);
+			assert(false);
+		}
+		catch(Exception e){
+			assert(true);	
+		}
+	}
+	
+	@Test
+	public void maxLengthGeneralInformationVFCTest() throws Exception{
+		String fileName = "importVFC_VFC13.yml";
+		atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, 
+				ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());		
+		ResourceUIUtils.fillMaxValueResourceGeneralInformationPage(atomicResourceMetaData);
+		GeneralPageElements.clickUpdateButton();
+		VFCverificator.verifyVFCUpdatedInUI(atomicResourceMetaData);
+		GeneralPageElements.clickDeleteVersionButton();
+	}	
+	
+	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
new file mode 100644
index 0000000..3931173
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Onboard.java
@@ -0,0 +1,355 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GovernorOperationPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.OpsOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+import com.aventstack.extentreports.Status;
+import com.aventstack.extentreports.ExtentTest;
+
+public class Onboard extends SetupCDTest {
+	
+	public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) {
+		Object[][] arObject = new Object[fileNamesFromFolder.length][];
+
+		int index = 0;
+		for (Object obj : fileNamesFromFolder) {
+			arObject[index++] = new Object[] { filepath, obj };
+		}
+		return arObject;
+	}
+
+	@DataProvider(name = "VNF_List" , parallel = true)
+	private static final Object[][] VnfList() throws Exception {
+		String filepath = getFilePath();
+		
+		Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+		System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length));
+		return provideData(fileNamesFromFolder, filepath);
+	}
+
+	public static String getFilePath() {
+		String filepath = System.getProperty("filepath");
+		if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+			filepath = FileHandling.getResourcesFilesPath() +"VNFs";
+		}
+		
+		else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+				filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator +"VNFs";
+		}
+		return filepath;
+	}
+	
+	@Test
+	public void onboardVNFTestSanity() throws Exception, Throwable {
+//		String filepath = getFilePath();
+//		String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+		String filepath = getFilePath();
+		Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+		String vnfFile = fileNamesFromFolder[0].toString();
+		runOnboardToDistributionFlow(filepath, vnfFile);
+	}
+
+	public void runOnboardToDistributionFlow(String filepath, String vnfFile) throws Exception, AWTException {
+		Pair<String,Map<String,String>> onboardAndValidate = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
+		String vspName = onboardAndValidate.left;
+		
+		DeploymentArtifactPage.getLeftPanel().moveToCompositionScreen();
+		ExtentTestActions.addScreenshot(Status.INFO, "TopologyTemplate_" + vnfFile ,"The topology template for " + vnfFile + " is as follows : ");
+		
+		DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vspName);
+		TesterOperationPage.certifyComponent(vspName);
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		// create service
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+
+		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CompositionPage.searchForElement(vspName);
+		CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+		ArtifactsCorrelationManager.addVNFtoServiceArtifactCorrelation(serviceMetadata.getName(), vspName);
+		
+		assertNotNull(vfElement);
+		ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+		ExtentTestActions.addScreenshot(Status.INFO, "ServiceComposition_" + vnfFile ,"The service topology is as follows : ");
+
+		ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.GOVERNOR);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.OPS);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		OpsOperationPage.distributeService();
+		OpsOperationPage.displayMonitor();
+
+		List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+		AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+		OpsOperationPage.waitUntilArtifactsDistributed(0);
+		
+//		validateInputArtsVSouput(serviceMetadata.getName());
+
+		getExtendTest().log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
+	}
+
+//	protected synchronized void validateInputArtsVSouput(String serviceName) {
+//		
+//		
+//		String filepath = System.getProperty("filepath");
+//		if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+//			filepath = FileHandling.getResourcesFilesPath() + folder + File.separator;
+//		}
+//		
+//		Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> serviceArtifactCorrelationMap = ArtifactsCorrelationManager.getServiceArtifactCorrelationMap(serviceName);
+//		
+//	}
+
+	@Test(dataProvider = "VNF_List")
+	public void onboardVNFTest(String filepath, String vnfFile) throws Exception, Throwable {
+		setLog(vnfFile);
+		runOnboardToDistributionFlow(filepath, vnfFile);
+	}
+
+	
+	@Test
+	public void onboardUpdateVNFTest() throws Exception, Throwable {
+		String filepath = getFilePath();
+		Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+		String vnfFile = fileNamesFromFolder[0].toString();
+		
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(filepath, vnfFile, getUser());
+		String vspName = vsp.left;
+		ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vspName);
+		TesterOperationPage.certifyComponent(vspName);
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		// create service
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+
+		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CompositionPage.searchForElement(vspName);
+		CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vspName);
+		assertNotNull(vfElement);
+		ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+		HomePage.navigateToHomePage();
+		
+		///update flow
+		String updatedVnfFile = fileNamesFromFolder[1].toString();
+
+		getExtendTest().log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
+		// update VendorSoftwareProduct
+		OnboardingUtils.updateVnfAndValidate(filepath, vsp, updatedVnfFile, getUser());
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vspName);
+		TesterOperationPage.certifyComponent(vspName);
+
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		// replace exiting VFI in service with new updated
+		
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		serviceCanvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.changeComponentVersion(serviceCanvasManager, vfElement, "2.0");
+		ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", 1, getUser());
+
+		ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.GOVERNOR);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.OPS);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		OpsOperationPage.distributeService();
+		OpsOperationPage.displayMonitor();
+
+		List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+		AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+		OpsOperationPage.waitUntilArtifactsDistributed(0);
+
+		getExtendTest().log(Status.INFO, String.format("onboarding %s test is passed ! ", vnfFile));
+		
+		
+	}
+
+	@Test
+	public void threeVMMSCsInServiceTest() throws Exception{
+		String filepath = getFilePath();
+		
+		
+		List<String> vmmscList = new ArrayList<String>();
+		vmmscList = Arrays.asList(new File(filepath).list()).stream().filter(e -> e.contains("vmmsc") && e.endsWith(".zip")).collect(Collectors.toList());
+		assertTrue("Did not find vMMSCs", vmmscList.size() > 0);
+		
+		Map<String, String> vspNames = new HashMap<String, String>(); 
+		for (String vnfFile : vmmscList){
+			getExtendTest().log(Status.INFO, String.format("going to onboard the VNF %s......", vnfFile));
+			System.out.println(String.format("going to onboard the VNF %s......", vnfFile));
+
+			OnboardingUtils.createVendorLicense(getUser());
+			Pair<String,Map<String,String>> createVendorSoftwareProduct = OnboardingUtils.createVendorSoftwareProduct(vnfFile, filepath, getUser());
+
+			getExtendTest().log(Status.INFO, String.format("searching for onboarded %s", vnfFile));
+			HomePage.showVspRepository();
+			getExtendTest().log(Status.INFO,String.format("going to import %s......", vnfFile.substring(0, vnfFile.indexOf("."))));
+			OnboardingUtils.importVSP(createVendorSoftwareProduct);
+			
+			ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+			DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+			
+			String vspName = createVendorSoftwareProduct.left;
+			DeploymentArtifactPage.clickSubmitForTestingButton(vspName);
+			
+			vspNames.put(vnfFile, vspName);
+		}
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		for (String vsp : vspNames.values()){
+			GeneralUIUtils.findComponentAndClick(vsp);
+			TesterOperationPage.certifyComponent(vsp);
+		}
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		// create service
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		ServiceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager serviceCanvasManager = CanvasManager.getCanvasManager();
+
+		for (String vsp : vspNames.values()){
+			CompositionPage.searchForElement(vsp);
+			CanvasElement vfElement = serviceCanvasManager.createElementOnCanvas(vsp);
+			assertNotNull(vfElement);
+		}
+		ServiceVerificator.verifyNumOfComponentInstances(serviceMetadata, "0.1", vspNames.values().size(), getUser());
+		File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Info_" + getExtendTest().getModel().getName());
+		final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+		SetupCDTest.getExtendTest().log(Status.INFO, "Three kinds of vMMSC are in canvas now." + getExtendTest().addScreenCaptureFromPath(absolutePath));
+		
+		ServiceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.GOVERNOR);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		GovernorOperationPage.approveSerivce(serviceMetadata.getName());
+
+		reloginWithNewRole(UserRoleEnum.OPS);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		OpsOperationPage.distributeService();
+		OpsOperationPage.displayMonitor();
+
+		List<WebElement> rowsFromMonitorTable = OpsOperationPage.getRowsFromMonitorTable();
+		AssertJUnit.assertEquals(1, rowsFromMonitorTable.size());
+
+		OpsOperationPage.waitUntilArtifactsDistributed(0);
+
+	}
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
new file mode 100644
index 0000000..cb647ae
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/OnboardViaApis.java
@@ -0,0 +1,303 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.charset.StandardCharsets;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.bouncycastle.util.encoders.Base64;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.clearspring.analytics.util.Pair;
+import com.google.gson.Gson;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.LoggerContext;
+import fj.data.Either;
+
+public class OnboardViaApis{
+	
+
+	private static final String FULL_PATH = "C://tmp//CSARs//";
+	
+	public static Object[][] provideData(Object[] fileNamesFromFolder, String filepath) {
+		Object[][] arObject = new Object[fileNamesFromFolder.length][];
+
+		int index = 0;
+		for (Object obj : fileNamesFromFolder) {
+			arObject[index++] = new Object[] { filepath, obj };
+		}
+		return arObject;
+	}
+
+	@DataProvider(name = "VNF_List" , parallel = false)
+	private static final Object[][] VnfList() throws Exception {
+		String filepath = FileHandling.getVnfRepositoryPath();
+		
+		Object[] fileNamesFromFolder = FileHandling.getZipFileNamesFromFolder(filepath);
+		System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.length));
+		return provideData(fileNamesFromFolder, filepath);
+	}
+
+	
+//-------------------------------------------------------------------------------------------------------
+	User sdncDesignerDetails1 = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
+		private static String vendorId;
+		private static String vendorLicenseName;
+		private static String vendorLicenseAgreementId;
+		private static String featureGroupId;
+		ResourceReqDetails resourceDetails;
+		Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+        
+        
+		@BeforeMethod
+		public void before(){
+			LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
+			lc.getLogger("org.apache").setLevel(Level.OFF);
+			lc.getLogger("org.*").setLevel(Level.OFF);
+			lc.getLogger("org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest").setLevel(Level.OFF);
+			resourceDetails = ElementFactory.getDefaultResource();
+			
+		}
+		
+	@Test(dataProvider = "VNF_List")
+	public void onboardVNFTestViaApis(String filepath, String vnfFile) throws Exception, Throwable {
+		Service service = null;
+		String fullFileName = FULL_PATH + vnfFile + ".csar";
+		Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+		System.err.println(timestamp + " Starting test with VNF: " + vnfFile);
+		service = runOnboardViaApisOnly(filepath, vnfFile);
+		timestamp = new Timestamp(System.currentTimeMillis());
+		System.err.println(timestamp + " Finished test with VNF: " + vnfFile);
+		timestamp = new Timestamp(System.currentTimeMillis());
+		System.err.println(timestamp + " Starting download service csar file: " + vnfFile);
+		File file = new File(fullFileName);
+		downloadToscaCsarToDirectory(service, file);
+		timestamp = new Timestamp(System.currentTimeMillis());
+		System.err.println(timestamp + " Finished download service csar file: " + vnfFile);
+		System.out.println("end");
+		
+	}
+	
+	public static void downloadToscaCsarToDirectory(Service service, File file) {
+		try {
+			Either<String,RestResponse> serviceToscaArtifactPayload = AtomicOperationUtils.getServiceToscaArtifactPayload(service, "assettoscacsar");
+			if(serviceToscaArtifactPayload.left().value() != null){
+				Gson gson = new Gson();
+				@SuppressWarnings("unchecked")
+				Map<String, String> fromJson = gson.fromJson(serviceToscaArtifactPayload.left().value(), Map.class);
+				String string = fromJson.get("base64Contents").toString();
+				byte[] byteArray = Base64.decode(string.getBytes(StandardCharsets.UTF_8));
+				File downloadedFile = new File(file.getAbsolutePath());
+				FileOutputStream fos = new FileOutputStream(downloadedFile);
+				fos.write(byteArray);
+				fos.flush();
+				fos.close();
+			}
+			
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+	}
+	
+	public Service runOnboardViaApisOnly(String filepath, String vnfFile) throws Exception, AWTException {
+		Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+		System.err.println(timestamp + " Starting onboard VNF: " + vnfFile);
+		Pair<String,Map<String,String>> onboardAndValidate = onboardAndValidateViaApi(filepath, vnfFile, sdncDesignerDetails1);
+		String vspName = onboardAndValidate.left;
+		timestamp = new Timestamp(System.currentTimeMillis());
+		System.err.println(timestamp + " Finished onboard VNF: " + vnfFile);
+		Resource resource = AtomicOperationUtils.getResourceObject(resourceDetails.getUniqueId());
+		
+		AtomicOperationUtils.changeComponentState(resource, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true);
+		resource = AtomicOperationUtils.getResourceObject(resource.getUniqueId());
+		// create service
+		
+		Service service = AtomicOperationUtils.createDefaultService(UserRoleEnum.DESIGNER, true).left().value();
+		Either<ComponentInstance,RestResponse> addComponentInstanceToComponentContainer = AtomicOperationUtils.addComponentInstanceToComponentContainer(resource, service, UserRoleEnum.DESIGNER, true);
+		service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+		return service;
+	}	
+	
+	
+	
+	public Pair<String, Map<String, String>> onboardAndValidateViaApi(String filepath, String vnfFile, User user) throws Exception {
+	
+		createVendorLicense(user);
+		Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user);
+		String vspName = createVendorSoftwareProduct.left;
+		List<String> tags = new ArrayList<>();
+		tags.add(vspName);
+		Map<String, String> map = createVendorSoftwareProduct.right;
+		
+		resourceDetails.setCsarUUID(map.get("vspId"));
+		resourceDetails.setCsarVersion("1.0");
+		resourceDetails.setName(vspName);
+		resourceDetails.setTags(tags);
+		resourceDetails.setResourceType(map.get("componentType"));
+		resourceDetails.setVendorName(map.get("vendorName"));
+		resourceDetails.setVendorRelease("1.0");
+		resourceDetails.setResourceType("VF");
+		RestResponse createResource = ResourceRestUtils.createResource(resourceDetails, sdncDesignerDetails1);
+		
+		return createVendorSoftwareProduct;
+	}
+	
+	public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user)
+			throws Exception {
+		Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user);
+		
+		String vspid = pair.right.get("vspId");
+				
+		prepareVspForUse(user, vspid);
+		
+		return pair;
+	}
+	
+	public static void prepareVspForUse(User user, String vspid) throws Exception {
+		RestResponse checkin = OnboardingUtils.checkinVendorSoftwareProduct(vspid, user);
+		assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
+
+		RestResponse submit = OnboardingUtils.submitVendorSoftwareProduct(vspid, user);
+		assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
+
+		RestResponse createPackage = OnboardingUtils.createPackageOfVendorSoftwareProduct(vspid, user);
+		assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+
+	}
+	public static void createVendorLicense(User user) throws Exception {
+		vendorLicenseName = "ciLicense" + UUID.randomUUID().toString().split("-")[0];
+		RestResponse vendorLicenseResponse = OnboardingUtils.createVendorLicenseModels_1(vendorLicenseName, user);
+		assertEquals("did not succeed to create vendor license model", 200,
+				vendorLicenseResponse.getErrorCode().intValue());
+		vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value");
+
+		RestResponse vendorKeyGroupsResponse = OnboardingUtils.createVendorKeyGroups_2(vendorId, user);
+		assertEquals("did not succeed to create vendor key groups", 200,
+				vendorKeyGroupsResponse.getErrorCode().intValue());
+		String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value");
+
+		RestResponse vendorEntitlementPool = OnboardingUtils.createVendorEntitlementPool_3(vendorId, user);
+		assertEquals("did not succeed to create vendor entitlement pool", 200,
+				vendorEntitlementPool.getErrorCode().intValue());
+		String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(),
+				"value");
+
+		RestResponse vendorLicenseFeatureGroups = OnboardingUtils.createVendorLicenseFeatureGroups_4(vendorId, keyGroupId,
+				entitlementPoolId, user);
+		assertEquals("did not succeed to create vendor license feature groups", 200,
+				vendorLicenseFeatureGroups.getErrorCode().intValue());
+		featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value");
+
+		RestResponse vendorLicenseAgreement = OnboardingUtils.createVendorLicenseAgreement_5(vendorId, featureGroupId, user);
+		assertEquals("did not succeed to create vendor license agreement", 200,
+				vendorLicenseAgreement.getErrorCode().intValue());
+		vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(),
+				"value");
+
+		RestResponse checkinVendorLicense = OnboardingUtils.checkinVendorLicense(vendorId, user);
+		assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+
+		RestResponse submitVendorLicense = OnboardingUtils.submitVendorLicense(vendorId, user);
+		assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+
+	}
+	
+	
+	public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user) throws Exception {
+		String vspName = OnboardingUtils.handleFilename(HeatFileName);
+		
+		Pair<RestResponse, Map<String, String>> createNewVspPair = OnboardingUtils.createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, user);
+		RestResponse createNewVendorSoftwareProduct = createNewVspPair.left;
+		assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue());
+		String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId");
+		String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId");
+		
+		Map<String, String> vspMeta = createNewVspPair.right;
+		Map<String, String> vspObject = new HashMap<String, String>();
+		Iterator<String> iterator = vspMeta.keySet().iterator();
+		while(iterator.hasNext()){
+			Object key = iterator.next();
+			Object value = vspMeta.get(key);
+			vspObject.put(key.toString(), value.toString());
+		}
+		vspObject.put("vspId", vspid);
+		vspObject.put("componentId", componentId);
+		vspObject.put("vendorName", vendorLicenseName);
+		vspObject.put("attContact", user.getUserId());
+		
+		RestResponse uploadHeatPackage = OnboardingUtils.uploadHeatPackage(filepath, HeatFileName, vspid, user);
+		assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+		
+		RestResponse validateUpload = OnboardingUtils.validateUpload(vspid, user);
+		assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+		
+		Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject);
+		
+		return pair;
+	}
+
+	
+	
+	
+	
+	
+	
+	
+	
+//	----------------------------------------------------------------------------------------------------------------------------------------
+	
+	
+	
+	
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java
new file mode 100644
index 0000000..e0e13b7
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Product.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.io.File;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ProductGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ProductUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class Product extends SetupCDTest {
+	
+	private String filePath;
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = System.getProperty("filepath");
+	
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		}
+	}
+
+	
+	@Test
+	public void createProductAndAddCertifiedServiceInstance() throws Exception {		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ProductReqDetails productReqDetails = ElementFactory.getDefaultProduct();
+		
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		GeneralPageElements.clickSubmitForTestingButton(serviceMetadata.getName());
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+		reloginWithNewRole(UserRoleEnum.PRODUCT_MANAGER1);
+		ProductUIUtils.createProduct(productReqDetails, getUser());
+		ProductGeneralPage.getProductLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CanvasElement canvasElement = CompositionPage.addElementToCanvasScreen(serviceMetadata.getName(), canvasManager);
+		canvasManager.clickOnCanvaElement(canvasElement);
+	}
+	
+	@Test
+	public void loginAsProductStrateger() throws Exception {		
+		reloginWithNewRole(UserRoleEnum.PRODUCT_STRATEGIST1);
+	}
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
new file mode 100644
index 0000000..86e52a2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Service.java
@@ -0,0 +1,698 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ServiceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.CatalogUIUtilitis;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ServiceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.DeploymentViewVerificator;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.SkipException;
+import org.testng.TestException;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class Service extends SetupCDTest {
+	
+	private static final String DESCRIPTION = "kuku";
+	private static final String ARTIFACT_LABEL = "artifact3";
+	private static final String ARTIFACT_LABEL_UPDATE = "artifactUpdate";
+	private static final String GET_ARTIFACT_LIST_BY_CLASS_NAME = "i-sdc-designer-sidebar-section-content-item-artifact";
+	private static final String HEAT_FILE_YAML_NAME = "Heat-File.yaml";
+	private static final String HEAT_FILE_YAML_UPDATE_NAME = "Heat-File-Update.yaml";
+	private String filePath;
+	
+	@BeforeMethod
+	public void beforeTest(){
+		filePath = FileHandling.getFilePath("");
+	}
+
+	
+	@Test
+	public void createService() throws Exception {		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());	
+	}
+	
+	@Test
+	public void validDefaultContactAndTagAfterCreateService() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createServiceWithDefaultTagAndUserId(serviceMetadata, getUser());
+		
+		assertTrue("wrong userId", getUser().getUserId().equals(ResourceGeneralPage.getContactIdText()));
+		
+		List<String> actualTags = Arrays.asList(ServiceGeneralPage.getTags());
+		assertTrue("wrong tags", (actualTags.size() == 1) && actualTags.get(0).equals(serviceMetadata.getName()));
+	}
+	
+	@Test
+	public void updateService() throws Exception {
+		// Create Service
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+        // Update Service
+		ServiceGeneralPage.deleteOldTags(serviceMetadata);
+		serviceMetadata.setName("ciUpdatedNameSanity");
+		serviceMetadata.setDescription("updatedDescriptionSanity");
+		serviceMetadata.setProjectCode("654321");
+		serviceMetadata.setContactId("cs6543");
+		serviceMetadata.getTags().addAll(Arrays.asList("updatedTag", "oneMoreUpdatedTag", "lastOne UpdatedTag"));
+		ServiceUIUtils.setServiceCategory(serviceMetadata, ServiceCategoriesEnum.VOIP);
+		ServiceUIUtils.fillServiceGeneralPage(serviceMetadata, getUser());
+		GeneralPageElements.clickCreateButton();
+		
+		ServiceVerificator.verifyServiceUpdatedInUI(serviceMetadata);	
+	}
+	
+	@Test
+	public void deleteService() throws Exception {
+		
+		// create service
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		// Delete service
+		//GeneralUIUtils.HighlightMyElement(GeneralUIUtils.getWebButton("delete_version"));
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		
+		// Verification
+		CatalogUIUtilitis.clickTopMenuButton(TopMenuButtonsEnum.CATALOG);
+		CatalogUIUtilitis.catalogSearchBox(serviceMetadata.getName());
+		ServiceVerificator.verifyServiceDeletedInUI(serviceMetadata);	
+	}
+	
+	@Test
+	public void checkoutServiceTest() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+		
+		ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		GeneralPageElements.clickCheckoutButton();
+		
+		serviceMetadata.setVersion("0.2");
+		ServiceVerificator.verifyServiceLifecycle(serviceMetadata, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+		ServiceVerificator.verifyVersionUI(serviceMetadata.getVersion());
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		
+		serviceMetadata.setVersion("1.1");
+		serviceMetadata.setUniqueId(null);
+		ServiceVerificator.verifyServiceLifecycle(serviceMetadata, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+		ServiceVerificator.verifyVersionUI(serviceMetadata.getVersion());
+	}
+	
+	@Test
+	public void submitServiceForTestingWithNonCertifiedAsset() throws Exception{
+
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.createResource(atomicResourceMetaData, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(atomicResourceMetaData.getName());
+		canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+		
+		try{
+			CompositionPage.clickSubmitForTestingButton(serviceMetadata.getName());
+			assert(false);
+		}
+		catch(Exception e){
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+			assertTrue(errorMessage.contains(checkUIResponseOnError));	
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+		}
+		
+	}
+	
+	@Test
+	public void addDeploymentArtifactInCompositionScreenTest() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+		
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		AssertJUnit.assertEquals(1, actualArtifactList.size());
+		
+		for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+			assertTrue(HEAT_FILE_YAML_NAME.equals(actualArtifactFileName.getText()));
+		}				
+		
+	}
+	
+	@Test
+	public void addInformationArtifactInCompositionScreenTest() throws Exception{
+		String fileName        = HEAT_FILE_YAML_NAME;
+		String descriptionText = DESCRIPTION;
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER");
+		CompositionPage.showInformationArtifactTab();
+		List<WebElement> beforeArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifactInfo, CompositionPage.artifactPopup());
+		
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		assertTrue(String.format("Wrong number of artifacts, Expected: %s Actual: %s", beforeArtifactList.size() + 1, actualArtifactList.size()),
+				                                                                  (beforeArtifactList.size() + 1) == actualArtifactList.size());
+		for(DataTestIdEnum.InformationalArtifactsService artifact: DataTestIdEnum.InformationalArtifactsService.values()){
+			ArtifactUIUtils.fillPlaceHolderInformationalArtifact(artifact, filePath, fileName, descriptionText);
+		}
+	    int numberOfFiles = CompositionPage.getAllAddedArtifacts().size();
+	    assertTrue(String.format("Wrong number of artifacts, Expected: %s Actual: %s", (beforeArtifactList.size() + 1), numberOfFiles), (beforeArtifactList.size() + 1) == numberOfFiles);
+	    
+	    for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+			assertTrue(fileName.equals(actualArtifactFileName.getText()));
+		}
+	    
+	}
+	
+	@Test
+	public void addAPIArtifactInCompositionScreenTest() throws Exception{
+		
+		if(true){
+			throw new SkipException("Open bug 292017");			
+		}
+		
+		String fileName        = HEAT_FILE_YAML_NAME,
+			   descriptionText = DESCRIPTION,
+		       url             = "http://kuku.com";
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		ArtifactInfo artifactInfo = new ArtifactInfo(filePath, fileName, descriptionText, ARTIFACT_LABEL,"OTHER");
+		CompositionPage.showAPIArtifactTab();
+
+		for(DataTestIdEnum.APIArtifactsService artifact: DataTestIdEnum.APIArtifactsService.values()){
+			ArtifactUIUtils.fillPlaceHolderAPIArtifact(artifact, filePath, fileName, descriptionText, url);
+		}
+	    int numberOfFiles = CompositionPage.getAllAddedArtifacts().size(),
+	    numberOfPlacehoders = DataTestIdEnum.APIArtifactsService.values().length;
+	    assertTrue(String.format("Wrong file count, should be %s files", numberOfPlacehoders), numberOfPlacehoders  == numberOfFiles);
+	    
+	    for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+			assertTrue(fileName.equals(actualArtifactFileName.getText()));
+		}
+	}
+	
+	@Test
+	public void ManagmentWorkflowTest() throws Exception{
+		
+		if(true){
+			throw new SkipException("Open bug 287416");			
+		}
+		
+		String descriptionText     = DESCRIPTION,
+			   descriptionTextEdit = "kuku2";
+
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		ServiceGeneralPage.getServiceLeftMenu().moveToManagmentWorkflow();
+		ServiceGeneralPage.fillAndAddNewWorkflow(descriptionText, descriptionText);
+		ServiceVerificator.verifyManagmentWorkflow(descriptionText, descriptionText);
+		
+		ServiceGeneralPage.clickAddWorkflow();
+		ServiceGeneralPage.fillAndAddNewWorkflow(descriptionTextEdit, descriptionTextEdit);
+	}
+	
+	@Test
+	public void deleteChangeVersionTest() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+        ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,"OTHER");
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+		
+		ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		GeneralPageElements.clickCheckoutButton();
+		
+		changeDeleteAndValidateVersionOnGeneralPage("0.1", "0.2", serviceMetadata.getName());
+		
+		GeneralPageElements.clickCheckoutButton();		
+		ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		
+		changeDeleteAndValidateVersionOnGeneralPage("1.0", "1.1", serviceMetadata.getName());
+	}
+	
+	@Test
+	public void compositionScreenRightSideButtonsTest() throws Exception{
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		CompositionPage.showInformationTab();
+		ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.INFORMATION);
+		
+		//feature removed from UI
+//		CompositionPage.showCompositionTab();
+//		ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.COMPOSITION);
+		
+		CompositionPage.showDeploymentArtifactTab();
+		ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
+		
+		CompositionPage.showInputsTab();
+		assertTrue(CompositionPage.getOpenTabTitle().size() == 0);				
+		
+		CompositionPage.showAPIArtifactTab();
+		ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.API);
+		
+		CompositionPage.showInformationArtifactTab();
+		ServiceVerificator.verifyOpenTabTitle(CompositionScreenEnum.INFORMATION_ARTIFACTS);
+		
+	}
+	
+	@Test
+	public void addDeploymentArtifactToVFInstanceTest() throws Exception{
+		
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+		
+		CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+		checkInService(serviceMetadata);
+		clickOncanvasElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);				
+	}
+
+	@Test
+	public void deleteDeploymentArtifactFromVFInstanceTest() throws Exception{
+		
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+		
+		CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+		clickOncanvasElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		deleteAndVerifyArtifact(actualArtifactList);
+		
+	}
+	
+	@Test
+	public void deleteDeploymentArtifactFromVFInstanceNextVersionTest() throws Exception{
+		
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+		
+		CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+		checkInService(serviceMetadata);
+		ResourceGeneralPage.clickCheckoutButton();
+		clickOncanvasElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		deleteAndVerifyArtifact(actualArtifactList);
+//		change container version
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+		GeneralPageElements.selectVersion("V0.1");
+		clickOncanvasElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+		
+	}
+
+//	service version V0.1 default artifact, service version V0.2 updated artifact 	
+	@Test
+	public void updateDeploymentArtifactOnVFInstanceNextVersionTest() throws Exception{
+		
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ArtifactInfo artifact = new ArtifactInfo(filePath, HEAT_FILE_YAML_NAME, DESCRIPTION, ARTIFACT_LABEL,ArtifactTypeEnum.SNMP_POLL.getType());
+		ArtifactInfo artifactUpdate = new ArtifactInfo(filePath, HEAT_FILE_YAML_UPDATE_NAME, DESCRIPTION, ARTIFACT_LABEL_UPDATE,ArtifactTypeEnum.DCAE_INVENTORY_DOC.getType());
+		
+		CanvasElement computeElement = createServiceWithRiArtifact(atomicResourceMetaData, serviceMetadata, artifact);
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+		checkInService(serviceMetadata);
+		ResourceGeneralPage.clickCheckoutButton();
+		clickOncanvasElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		deleteAndVerifyArtifact(actualArtifactList);
+//		upload new artifact
+		addDeploymentArtifact(artifactUpdate, CanvasManager.getCanvasManager(), computeElement);
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_UPDATE_NAME);
+//		change container version
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+		GeneralPageElements.selectVersion("V0.1");
+		clickOncanvasElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		checkArtifactIfAdded(1, HEAT_FILE_YAML_NAME);
+		
+	}
+	
+	public void clickOncanvasElement(CanvasElement computeElement) {
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		canvasManager.clickOnCanvaElement(computeElement);
+	}
+
+	public void checkInService(ServiceReqDetails serviceMetadata) throws Exception {
+		ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+	}
+
+	public static void deleteAndVerifyArtifact(List<WebElement> actualArtifactList) {
+		if (actualArtifactList.size()>0){
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue() + ARTIFACT_LABEL);
+			SetupCDTest.getExtendTest().log(Status.INFO, "Going to delete "  +  HEAT_FILE_YAML_NAME + " artifact" + " and check if deleted");
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + ARTIFACT_LABEL);
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+			assertTrue("Artifact does not deleted", !GeneralUIUtils.waitForElementInVisibilityByTestId(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME)));
+		}
+	}
+
+
+	public void checkArtifactIfAdded(Integer expectedNumOfARtifacts, String expectedArtifactName) {
+		
+		List<WebElement> actualArtifactList;
+		actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className(GET_ARTIFACT_LIST_BY_CLASS_NAME));
+		assertTrue("Expected artifact count is: " + expectedNumOfARtifacts + ", but was " + actualArtifactList.size(),expectedNumOfARtifacts==actualArtifactList.size());
+		
+		if(expectedNumOfARtifacts != 0){
+			for(WebElement actualArtifactFileName : CompositionPage.getAllAddedArtifacts()){
+				assertTrue("Artifact name does not match, expected " + expectedArtifactName + ", but was " + actualArtifactFileName.getText(), expectedArtifactName.equals(actualArtifactFileName.getText()));
+			}
+		}
+		
+	}
+
+
+	public CanvasElement createServiceWithRiArtifact(ResourceReqDetails atomicResourceMetaData, ServiceReqDetails serviceMetadata, ArtifactInfo artifact) throws Exception, AWTException {
+		ResourceUIUtils.createResource(atomicResourceMetaData, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+		
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(atomicResourceMetaData.getName());
+		CanvasElement computeElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+		addDeploymentArtifact(artifact, canvasManager, computeElement);
+		
+		return computeElement;
+	}
+
+
+	public void addDeploymentArtifact(ArtifactInfo artifact, CanvasManager canvasManager, CanvasElement computeElement) throws Exception {
+		canvasManager.clickOnCanvaElement(computeElement);
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+	}
+	
+	@Test
+	public void isDisabledAndReadOnlyInCheckin() throws Exception{
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		GeneralPageElements.clickCheckinButton(serviceMetadata.getName());
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		
+		ServiceMetadataEnum[] fieldsForCheck = {ServiceMetadataEnum.SERVICE_NAME,
+		                                        ServiceMetadataEnum.CONTACT_ID,
+		                                        ServiceMetadataEnum.DESCRIPTION,
+		                                        ServiceMetadataEnum.PROJECT_CODE,
+		                                        ServiceMetadataEnum.TAGS};
+		for (ServiceMetadataEnum field: fieldsForCheck){
+			assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
+		}
+		
+		assertTrue(GeneralUIUtils.isElementDisabled(ServiceMetadataEnum.CATEGORY.getValue()));
+		assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
+	}
+	
+	// future removed from ui
+    @Test(enabled = false)
+	public void inputsTest() throws Exception{
+		String fileName = "service_input_test_VF2.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());		
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		GeneralPageElements.clickCheckinButton(resourceMetaData.getName());
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		String selectedInstanceName = addResourceToServiceInCanvas(resourceMetaData);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		DeploymentArtifactPage.getLeftMenu().moveToInputsScreen();
+		
+		InputsPage.addInputToService(selectedInstanceName, "volume_id");
+		InputsPage.deleteServiceInput(selectedInstanceName, "volume_id");
+		
+		// Trying to find deleted service input
+		try{
+			InputsPage.getServiceInput(selectedInstanceName, "volume_id");
+			assert(false);
+		}
+		catch(TestException e){	
+		}
+	}
+	
+	@Test
+	public void deploymentViewServiceTest() throws Exception{
+		
+		if(true){
+			throw new SkipException("Open bug 295220, 295180");			
+		}
+		
+		String fileName2 = "vSeGW.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+		ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		addResourceToServiceInCanvas(resourceMetaData);
+	
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		DeploymentArtifactPage.getLeftMenu().moveToDeploymentViewScreen();
+		
+		serviceMetadata.setVersion("0.1");
+		List<WebElement> instanceRowsFromTable = GeneralUIUtils.getElementsByCSS("div[data-tests-id^='hierarchy-instance'] span[class^='expand-collapse-title-text']");
+		for(WebElement instanceRow: instanceRowsFromTable){
+			String instanceRowText = instanceRow.getText();
+			List<WebElement> instanceModulesList = DeploymentPage.getInstanceModulesList(instanceRowText);
+			for (WebElement instanceModule: instanceModulesList){
+				String instanceModuleText = instanceModule.getText();
+				ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance");
+								
+				ServiceVerificator.verifyDeploymentPageSubElements(instanceModuleText.split("\\.\\.")[1], new DeploymentViewVerificator(filePath + fileName2));
+				
+				ServiceVerificator.verifyDisabledServiceProperties();
+				String isBaseValue = ServiceVerificator.getVFModulePropertieValue(serviceMetadata, "isBase", instanceModuleText);
+				if (isBaseValue.equals("false"))
+					ServiceVerificator.verifyEnabledServiceProperties();
+				
+				ResourceUIUtils.clickOnElementByText(instanceModuleText, "instance");
+			}												
+		}			
+	}
+	
+	@Test
+	public void vfModuleCustomizationUUIDServiceTest() throws Exception{
+		String fileName2 = "vSeGW.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+		ResourceGeneralPage.clickCheckinButton(resourceMetaData.getName());
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		addResourceToServiceInCanvas(resourceMetaData);
+	    
+		serviceMetadata.setVersion("0.1");
+		ServiceVerificator.verifyVFModuleCustomizationUUID(serviceMetadata);		
+	}
+	
+	@Test
+	public void checkoutCertifyRemainSameCustomizationUUIDServiceTest() throws Exception{
+		String fileName2 = "vSeGW.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName2, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(resourceMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(resourceMetaData.getName());
+		TesterOperationPage.certifyComponent(resourceMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		
+		ServiceReqDetails serviceMetadata = ElementFactory.getDefaultService();
+		ServiceUIUtils.createService(serviceMetadata, getUser());
+		
+		addResourceToServiceInCanvas(resourceMetaData);
+	    
+		serviceMetadata.setVersion("0.1");
+		ServiceVerificator.verifyVFModuleCustomizationUUID(serviceMetadata);
+		List<String> allVFModuleCustomizationUUIDs = ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata);
+		
+		ResourceGeneralPage.clickCheckinButton(serviceMetadata.getName());
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		GeneralPageElements.clickCheckoutButton();
+		
+		serviceMetadata.setVersion("0.2");
+		assertTrue(ServiceVerificator.isEqualCustomizationUUIDsAfterChanges(allVFModuleCustomizationUUIDs, ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata)));
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(serviceMetadata.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		TesterOperationPage.certifyComponent(serviceMetadata.getName());
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(serviceMetadata.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		
+		serviceMetadata.setVersion("1.1");
+		serviceMetadata.setUniqueId(null);
+		assertTrue(ServiceVerificator.isEqualCustomizationUUIDsAfterChanges(allVFModuleCustomizationUUIDs, ServiceVerificator.getAllVFModuleCustomizationUUIDs(serviceMetadata)));
+	}
+
+
+	public synchronized String addResourceToServiceInCanvas(ResourceReqDetails resourceMetaData) throws Exception {
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(resourceMetaData.getName());
+		CanvasElement computeElement = canvasManager.createElementOnCanvas(resourceMetaData.getName());
+		canvasManager.clickOnCanvaElement(computeElement);
+		String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+		return selectedInstanceName;
+	}
+		
+	public static void changeDeleteAndValidateVersionOnGeneralPage(String previousVersion, String currentVersion, String serviceName) throws Exception{
+		GeneralPageElements.selectVersion("V" + previousVersion);
+		ServiceVerificator.verifyVersionUI(previousVersion);
+		GeneralUIUtils.clickJSOnElementByText("latest version");
+		ServiceVerificator.verifyVersionUI(currentVersion);
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		GeneralUIUtils.findComponentAndClick(serviceName);
+		ServiceVerificator.verifyVersionUI(previousVersion);		
+	}	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
new file mode 100644
index 0000000..2c7dc98
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VFCArtifacts.java
@@ -0,0 +1,402 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.verificator.VFCArtifactVerificator;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class VFCArtifacts extends SetupCDTest {
+	
+	private static final String DEPLOYMENT = "Deployment";
+	private static final String INFORMATIONAL = "Informational";
+	private static final String ARTIFACTS = "artifacts";
+	private static final String DEPLOYMENT_ARTIFACTS = "deploymentArtifacts";
+	private String filePath;
+	private Object object;
+	@BeforeClass
+	public void beforeClass(){
+		filePath = System.getProperty("filepath");
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath() + "VFCArtifacts"+ File.separator;
+		}
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator + "VFCArtifacts"+ File.separator;
+		}
+	}
+
+	@Test
+	public void ImportMultiVFCTest_TC1407998() throws Exception{
+		
+		String csarFile = "Import_Multi_VFC.csar";
+		
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		resourceMetaData.setVersion("0.1");
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+		
+		RestResponse getResponse = RestCDUtils.getResource(resourceMetaData, getUser());
+		assertTrue(getResponse.getErrorCode().intValue() == 200);
+		
+		Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = verifyVfcArtifacts(filePath, csarFile, resourceMetaData, getResponse);
+		
+		VFCArtifactVerificator.verifyVFCArtifactsNotInVFArtifactList(resourceMetaData, getUser(), getResponse, expectedArtifactMap);
+		
+		
+	}
+
+	@Test
+	public void updateCsarWithVFCArtifacts_ModifyArtifacts_TC1449482() throws Exception{
+		
+		String csarFile = "LDSA-ORIG.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		resourceMetaData.setVersion("0.1");
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+		
+		Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + csarFile);
+		List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : vfcKeys){
+			VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser());
+		}
+		
+		String updatedCsarFile = "LDSA-MODIFY.csar";
+		ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+		
+		Map<String, Object> updatedArtifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + updatedCsarFile);
+		List<String> updatedVfcKeys = updatedArtifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : updatedVfcKeys){
+			verifyVfcInstanceArtifacts(resourceMetaData, null, updatedArtifactsFromCsar, key);
+			VFCArtifactVerificator.verifyVfcArtifactUpdated(key, resourceMetaData, getUser());
+		}
+	}
+	
+	@Test
+	public void updateCsarWithVFCArtifacts_DeleteAndAddArtifacts_TC1449473() throws Exception{
+		String csarFile = "LDSA-ORIG.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		resourceMetaData.setVersion("0.1");
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+
+		String updatedCsarFile = "LDSA-DELETE-ADD.csar";
+		ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+		
+		verifyVfcArtifacts(filePath, updatedCsarFile, resourceMetaData, null);
+	}
+	
+	@Test
+	public void updateCsarWithVFCArtifacts_AddFirstVFCIdentifier_TC1425896() throws Exception{
+		
+		String csarFile = "LDSA-ORIG-OLD_STRUCTURE.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		resourceMetaData.setVersion("0.1");
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+		
+		VFCArtifactVerificator.verifyNoVfcArtifacts(resourceMetaData, getUser(), null);
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile);
+		String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile);
+		DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen();
+		
+		String updatedCsarFile = "LDSA-ADD.csar";
+		ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+
+		verifyVfcArtifacts(filePath, updatedCsarFile, resourceMetaData, null);
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate);
+	}
+	
+	
+	@Test
+	public void updateCsarWithVFCArtifacts_AddAdditionalVFCIdentifier_TC1425898() throws Exception{
+	
+		String csarFile = "LDSA-SINGLE.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		resourceMetaData.setVersion("0.1");
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+		
+		Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + csarFile);
+		List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : vfcKeys){
+			VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser());
+		}
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile);
+		String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile);
+		DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen();
+		
+		String updatedCsarFile = "LDSA-MULTI.csar";
+		ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+		
+		Map<String, Object> updatedArtifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filePath + updatedCsarFile);
+		List<String> updatedVfcKeys = updatedArtifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : updatedVfcKeys){
+			verifyVfcInstanceArtifacts(resourceMetaData, null, updatedArtifactsFromCsar, key);
+			if (vfcKeys.contains(key)){
+				VFCArtifactVerificator.verifyVFCArtifactNotChanged(key, resourceMetaData, getUser());
+			}
+		}
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate);
+	}
+	
+	@Test
+	public void updateCsarWithVFCArtifacts_DeleteAll_TC1425581() throws Exception{
+		String csarFile = "LDSA-ORIG.csar";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType("ciRes", NormativeTypesEnum.ROOT, ResourceCategoryEnum.APPLICATION_L4_DATABASE, getUser().getUserId(), ResourceTypeEnum.VF.toString());
+		resourceMetaData.setVersion("0.1");
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, csarFile, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		String[] artifactNamesFromFile = ArtifactFromCsar.getArtifactNamesFromCsar(filePath, csarFile);
+		String[] artifactsFromFileBeforeUpdate = DeploymentArtifactPage.verifyArtifactsExistInTable(artifactNamesFromFile);
+		DeploymentArtifactPage.getLeftMenu().moveToGeneralScreen();
+		
+		String updatedCsarFile = "LDSA-DELETE-ALL.csar";
+		ResourceUIUtils.updateVfWithCsar(filePath, updatedCsarFile);
+		
+		VFCArtifactVerificator.verifyNoVfcArtifacts(resourceMetaData, getUser(), null);
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(artifactsFromFileBeforeUpdate);
+	}
+	
+	@Test
+	public void importComplexVFCArtifacts_Onboarding_TC1484153() throws Exception{
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		String vnfFile = "vProbes_FE.zip";
+		String snmpFile = "Fault-alarms-ASDC-vprobes-vLB.zip";
+		
+		OnboardingUtils.createVendorLicense(getUser());
+		Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+		String vspName = createVSP.left;
+		resourceMetaData.setName(vspName);
+		Map<String, String> resourceMeta = createVSP.right;
+		String vspid = resourceMeta.get("vspId");
+		OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
+		OnboardingUtils.prepareVspForUse(getUser(), vspid);
+		
+		String downloadDirectory = getWindowTest().getDownloadDirectory();
+		String csarFile = vspid + ".csar";
+		
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+		HomePage.showVspRepository();
+		OnboardingUtils.importVSP(createVSP);
+		resourceMetaData.setVersion("0.1");
+		
+		verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null);
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile);
+
+	}
+	
+	@Test
+	public void updateComplexVFCArtifacts_AddRemove_Onboarding_TC1484185() throws Exception{
+		
+		//check of version is 1
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		String vnfFile = "vProbes_FE.zip";
+		String snmpPollFile = "vprobes-vLB.zip";
+		String updatedSnmpPollFile = "vprobes-vLBAgent.zip";
+		
+		OnboardingUtils.createVendorLicense(getUser());
+		Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+		String vspName = createVSP.left;
+		resourceMetaData.setName(vspName);
+		Map<String, String> resourceMeta = createVSP.right;
+		String vspid = resourceMeta.get("vspId");
+		String montoringComponentId = OnboardingUtils.addVFCArtifacts(filePath, snmpPollFile, null, vspid, getUser());
+		OnboardingUtils.prepareVspForUse(getUser(), vspid);
+		
+		String downloadDirectory = getWindowTest().getDownloadDirectory();
+		String csarFile = vspid + ".csar";
+		
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+		HomePage.showVspRepository();
+		OnboardingUtils.importVSP(createVSP);
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vspName);
+		TesterOperationPage.certifyComponent(vspName);
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpPollFile, null, montoringComponentId, getUser());
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+		HomePage.showVspRepository();
+		OnboardingUtils.updateVSP(createVSP);
+		resourceMetaData.setVersion("1.1");
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile);
+		
+		verifyVfcArtifacts(downloadDirectory, csarFile, resourceMetaData, null);
+		
+	}
+	
+	@Test
+	public void updateComplexVFCArtifacts_Modify_Onboarding_TC1484195() throws Exception{
+		
+		//check of version is 2
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		
+		String vnfFile = "vProbes_FE.zip";
+		String snmpFile = "vprobes-vLB.zip";
+		String updatedSnmpFile = "vprobes-vLB-Modified.zip";
+		
+		OnboardingUtils.createVendorLicense(getUser());
+		Pair<String, Map<String, String>> createVSP = OnboardingUtils.createVSP(vnfFile, filePath, getUser());
+		String vspName = createVSP.left;
+		resourceMetaData.setName(vspName);
+		Map<String, String> resourceMeta = createVSP.right;
+		String vspid = resourceMeta.get("vspId");
+		String monitoringId = OnboardingUtils.addVFCArtifacts(filePath, snmpFile, null, vspid, getUser());
+		OnboardingUtils.prepareVspForUse(getUser(), vspid);
+		
+		String downloadDirectory = getWindowTest().getDownloadDirectory();
+		String csarFile = vspid + ".csar";
+		
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+		HomePage.showVspRepository();
+		OnboardingUtils.importVSP(createVSP);
+		
+		Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile);
+		List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : vfcKeys){
+			resourceMetaData.setVersion("0.1");
+			VFCArtifactVerificator.setActualVfcArtifactList(key, resourceMetaData, getUser());
+		}
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(vspName);
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vspName);
+		TesterOperationPage.certifyComponent(vspName);
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		OnboardingUtils.updateVspWithVfcArtifacts(filePath, vspid, updatedSnmpFile, null, monitoringId, getUser());
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, vspid);
+		HomePage.showVspRepository();
+		OnboardingUtils.updateVSP(createVSP);
+		resourceMetaData.setVersion("1.1");
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(filePath, vnfFile);
+		
+		Map<String, Object> artifactsFromCsarAfterUpdate = ArtifactFromCsar.getVFCArtifacts(downloadDirectory + csarFile);
+		List<String> vfcKeysAfterUpdate = artifactsFromCsarAfterUpdate.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : vfcKeysAfterUpdate){
+			verifyVfcInstanceArtifacts(resourceMetaData, null, artifactsFromCsarAfterUpdate, key);
+			VFCArtifactVerificator.verifyVfcArtifactUpdated(key, resourceMetaData, getUser());
+		}
+		
+	}
+	
+	
+	
+	
+	
+	
+	
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+	
+	private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcArtifacts(String filepath, String csarFile,
+			ResourceReqDetails resourceMetaData, RestResponse getResponse) throws Exception {
+		ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts");
+		Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap = null;
+		ExtentTestActions.log(Status.INFO, "Reading artifacts in CSAR file");
+		Map<String, Object> artifactsFromCsar = ArtifactFromCsar.getVFCArtifacts(filepath + csarFile);
+		List<String> vfcKeys = artifactsFromCsar.keySet().stream().filter(p -> p.contains("vfc")).collect(Collectors.toList());
+		for (String key : vfcKeys){
+			expectedArtifactMap = verifyVfcInstanceArtifacts(resourceMetaData, getResponse, artifactsFromCsar, key);
+		}
+		return expectedArtifactMap;
+	}
+
+	private Map<String, LinkedList<HeatMetaFirstLevelDefinition>> verifyVfcInstanceArtifacts(
+			ResourceReqDetails resourceMetaData, RestResponse getResponse, Map<String, Object> artifactsFromCsar, String key) {
+		
+		Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap;
+		Map<String,LinkedList<HeatMetaFirstLevelDefinition>> vfcDeploymentArtifacts = (Map<String,LinkedList<HeatMetaFirstLevelDefinition>>)artifactsFromCsar.get(key);
+		LinkedList<HeatMetaFirstLevelDefinition> deploymentList = vfcDeploymentArtifacts.get(DEPLOYMENT);
+		LinkedList<HeatMetaFirstLevelDefinition> informationalList = (LinkedList<HeatMetaFirstLevelDefinition>) artifactsFromCsar.get(INFORMATIONAL);
+		
+		expectedArtifactMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>();
+		if(deploymentList == null){
+			expectedArtifactMap.put(DEPLOYMENT_ARTIFACTS, new LinkedList<HeatMetaFirstLevelDefinition>());
+		}else{
+			expectedArtifactMap.put(DEPLOYMENT_ARTIFACTS, deploymentList);
+		}
+		if(informationalList == null){
+			expectedArtifactMap.put(ARTIFACTS, new LinkedList<HeatMetaFirstLevelDefinition>());
+		}else{
+			expectedArtifactMap.put(ARTIFACTS, informationalList);
+		}
+		
+		
+		VFCArtifactVerificator.verifyVfcArtifacts(resourceMetaData, getUser(), key, expectedArtifactMap, getResponse);
+		return expectedArtifactMap;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
new file mode 100644
index 0000000..078bc69
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/Vf.java
@@ -0,0 +1,687 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ResourceMetadataEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.ToscaArtifactsScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.NormativeTypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.InputsPage;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.TesterOperationPage;
+import org.openecomp.sdc.ci.tests.pages.ToscaArtifactsPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utilities.PropertiesUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.ci.tests.verificator.ServiceVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfModuleVerificator;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.AssertJUnit;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+
+public class Vf extends SetupCDTest {
+
+	private String filePath;
+	@BeforeClass
+	public void beforeClass(){
+		filePath = System.getProperty("filepath");
+		if (filePath == null && System.getProperty("os.name").contains("Windows")) {
+			filePath = FileHandling.getResourcesFilesPath();
+		}
+		else if(filePath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+			filePath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		}
+	}
+	
+	@BeforeMethod
+	public void beforeTest(){
+		System.out.println("File repository is : " + filePath);
+		getExtendTest().log(Status.INFO, "File repository is : " + filePath);
+	}
+	
+
+	@Test
+	public void updateVF() throws Exception {
+
+		// create Resource
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(resourceMetaData, getUser());
+
+		// update Resource
+		ResourceReqDetails updatedResource = new ResourceReqDetails();
+		updatedResource.setName("ciUpdatedName");
+		updatedResource.setDescription("kuku");
+		updatedResource.setVendorName("updatedVendor");
+		updatedResource.setVendorRelease("updatedRelease");
+		updatedResource.setContactId("ab0001");
+		updatedResource.setCategories(resourceMetaData.getCategories());
+		updatedResource.setVersion("0.1");
+		updatedResource.setResourceType(ResourceTypeEnum.VF.getValue());
+ 		List<String> newTags = resourceMetaData.getTags();
+		newTags.remove(resourceMetaData.getName());
+		newTags.add(updatedResource.getName());
+		updatedResource.setTags(newTags);
+		ResourceUIUtils.updateResource(updatedResource, getUser());
+
+		VfVerificator.verifyVFMetadataInUI(updatedResource);
+		VfVerificator.verifyVFUpdated(updatedResource, getUser());
+	}
+
+	@Test
+	public void vfcLinkedToComputeInVfFlow() throws Exception {
+		String fileName = "vFW_VFC2.yml";
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		
+		try{
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+			
+			reloginWithNewRole(UserRoleEnum.TESTER);
+			GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+			TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+	
+			reloginWithNewRole(UserRoleEnum.DESIGNER);
+			ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			ResourceUIUtils.createResource(vfMetaData, getUser());
+	
+			DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+			CanvasManager canvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.searchForElement(String.format("%s %s", LeftPanelCanvasItems.COMPUTE.getValue() , "1.0"));
+			CanvasElement computeElement = canvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+			CompositionPage.searchForElement(atomicResourceMetaData.getName());
+			CanvasElement cpElement = canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+			AssertJUnit.assertNotNull(cpElement);
+			ServiceVerificator.verifyNumOfComponentInstances(vfMetaData, "0.1", 2, getUser());
+			canvasManager.linkElements(cpElement, computeElement);
+	
+			vfMetaData.setVersion("0.1");
+			VfVerificator.verifyLinkCreated(vfMetaData, getUser(), 1);
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+		}
+
+	}
+
+	@Test
+	public void addUpdateDeleteDeploymentArtifactToVfTest() throws Exception {
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+		List<ArtifactInfo> deploymentArtifactList = new ArrayList<ArtifactInfo>();
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER"));
+		deploymentArtifactList.add(new ArtifactInfo(filePath, "sample-xml-alldata-1-1.xml", "cuku", "artifact2", "YANG_XML"));
+		for (ArtifactInfo deploymentArtifact : deploymentArtifactList) {
+			DeploymentArtifactPage.clickAddNewArtifact();
+			ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+		}
+		AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size()));
+		
+		String newDescription = "new description";
+		DeploymentArtifactPage.clickEditArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.artifactPopup().insertDescription(newDescription);
+		DeploymentArtifactPage.artifactPopup().clickDoneButton();
+		String actualArtifactDescription = DeploymentArtifactPage.getArtifactDescription(deploymentArtifactList.get(0).getArtifactLabel());
+		AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		DeploymentArtifactPage.clickDeleteArtifact(deploymentArtifactList.get(0).getArtifactLabel());
+		DeploymentArtifactPage.clickOK();
+		AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(0).getArtifactLabel() + "is not deleted", DeploymentArtifactPage.checkElementsCountInTable(deploymentArtifactList.size() - 1));
+		
+		AssertJUnit.assertTrue("artifact "+ deploymentArtifactList.get(1).getArtifactLabel() + "is not displayed", DeploymentArtifactPage.clickOnArtifactDescription(deploymentArtifactList.get(1).getArtifactLabel()).isDisplayed());
+	}
+	
+
+	@Test
+	public void addUpdateDeleteInformationalArtifact() throws Exception {
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		ArtifactInfo informationalArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+		InformationalArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(informationalArtifact);
+		
+		AssertJUnit.assertTrue("artifact table does not contain artifacts uploaded", InformationalArtifactPage.checkElementsCountInTable(1));
+		
+		String newDescription = "new description";
+		InformationalArtifactPage.clickEditArtifact(informationalArtifact.getArtifactLabel());
+		InformationalArtifactPage.artifactPopup().insertDescription(newDescription);
+		InformationalArtifactPage.artifactPopup().clickDoneButton();
+		String actualArtifactDescription = InformationalArtifactPage.getArtifactDescription(informationalArtifact.getArtifactLabel());
+		AssertJUnit.assertTrue("artifact description is not updated", newDescription.equals(actualArtifactDescription));
+		
+		InformationalArtifactPage.clickDeleteArtifact(informationalArtifact.getArtifactLabel());
+		InformationalArtifactPage.clickOK();
+		AssertJUnit.assertTrue("artifact "+ informationalArtifact.getArtifactLabel() + "is not deleted", InformationalArtifactPage.checkElementsCountInTable(0));
+	}
+
+
+	@Test
+	public void addPropertiesToVfcInstanceInVfTest() throws Exception {
+		
+		if(true){
+			throw new SkipException("Open bug 292047");			
+		}
+		
+		String fileName = "vFW_VFC.yml";
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		
+		try{
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			ResourceGeneralPage.clickCheckinButton(atomicResourceMetaData.getName());
+	
+			ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			ResourceUIUtils.createResource(vfMetaData, getUser());
+	
+			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.searchForElement(atomicResourceMetaData.getName());
+			CanvasElement vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+	
+			vfCanvasManager.clickOnCanvaElement(vfcElement);
+			CompositionPage.showPropertiesAndAttributesTab();
+			List<WebElement> properties = CompositionPage.getProperties();
+			String propertyValue = "abc123";
+			for (int i = 0; i < 2; i++) {
+				WebElement findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-and-attribute-label"));
+				findElement.click();
+				PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(propertyValue);
+				PropertiesPage.getPropertyPopup().clickSave();
+				
+				
+				findElement = properties.get(i).findElement(By.className("i-sdc-designer-sidebar-section-content-item-property-value"));
+				AssertJUnit.assertTrue(findElement.getText().equals(propertyValue));
+			}
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+		}
+	}
+	
+	@Test
+	public void changeInstanceVersionTest() throws Exception{
+		
+		if(true){
+			throw new SkipException("Open bug 291567");			
+		}
+		
+		ResourceReqDetails atomicResourceMetaData = null;
+		ResourceReqDetails vfMetaData = null;
+		CanvasManager vfCanvasManager;
+		CanvasElement vfcElement = null;
+		String fileName = "vFW_VFC3.yml";
+		try{
+			atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+			ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+			ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+			
+			vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+			ResourceUIUtils.createResource(vfMetaData, getUser());
+			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			vfCanvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.searchForElement(atomicResourceMetaData.getName());
+			vfcElement = vfCanvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+			
+		
+			CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+			assert(false);
+		}
+		catch(Exception e){ 
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+			AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));
+			
+			
+			reloginWithNewRole(UserRoleEnum.TESTER);
+			GeneralUIUtils.findComponentAndClick(atomicResourceMetaData.getName());
+			TesterOperationPage.certifyComponent(atomicResourceMetaData.getName());
+			
+			reloginWithNewRole(UserRoleEnum.DESIGNER);
+			GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+			ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+			vfCanvasManager = CanvasManager.getCanvasManager();
+			CompositionPage.changeComponentVersion(vfCanvasManager, vfcElement, "1.0");
+			
+			//verfication
+			VfVerificator.verifyInstanceVersion(vfMetaData, getUser(), atomicResourceMetaData.getName(), "1.0");
+		}
+			
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "1.0");
+		}
+		
+	}
+
+    // future removed from ui
+	@Test(enabled = false)
+	public void addUpdateDeleteSimplePropertiesToVfTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+			
+		ResourceGeneralPage.getLeftMenu().moveToPropertiesScreen();
+		List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+		int propertiesCount = PropertiesPage.getElemenetsFromTable().size();	
+		for (PropertyTypeEnum prop : propertyList){
+			PropertiesUIUtils.addNewProperty(prop);
+		}
+		AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> PropertiesPage.getElemenetsFromTable()));
+		VfVerificator.verifyPropertiesInUI(propertyList);
+		PropertiesPage.verifyTotalProperitesField(propertiesCount + propertyList.size());
+
+
+		PropertyTypeEnum prop = propertyList.get(0);
+		prop.setDescription("updatedDescription");
+		prop.setValue("value");
+		PropertiesUIUtils.updateProperty(prop);
+		
+		PropertiesPage.clickDeletePropertyArtifact(prop.getName());
+		AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size() - 1, () -> PropertiesPage.getElemenetsFromTable()));
+	}
+	
+	// future removed from ui
+	@Test(enabled = false)
+	public void vfcInstancesInputScreenTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		
+		Map<String, String> elementsIntancesMap = new HashMap<String, String>();
+		for (LeftPanelCanvasItems element : Arrays.asList(LeftPanelCanvasItems.DATABASE, LeftPanelCanvasItems.BLOCK_STORAGE)){
+			CanvasElement elementOnCanvas = vfCanvasManager.createElementOnCanvas(element);
+			vfCanvasManager.clickOnCanvaElement(elementOnCanvas);
+			String selectedInstanceName = CompositionPage.getSelectedInstanceName();
+			elementsIntancesMap.put(selectedInstanceName, element.getValue());
+		}
+
+		CompositionPage.moveToInputsScreen();
+		int canvasElementsSize = vfCanvasManager.getCanvasElements().size();
+		AssertJUnit.assertTrue("Instances count is not as expected: " + canvasElementsSize, InputsPage.checkElementsCountInTable(canvasElementsSize));
+		
+		for (String element : elementsIntancesMap.keySet()){
+			String resourceName = elementsIntancesMap.get(element);
+			ResourceReqDetails resource = new ResourceReqDetails();
+			resource.setName(resourceName);
+			resource.setVersion("1.0");
+			resource.setResourceType(ResourceTypeEnum.VFC.toString());
+			RestResponse restResponse = RestCDUtils.getResource(resource, getUser());
+			Map<String, String> propertiesNameTypeJson = ResponseParser.getPropertiesNameType(restResponse);
+			
+			List<WebElement> propertyRowsFromTable = InputsPage.getInstancePropertiesList(element);
+			AssertJUnit.assertTrue("Some properties are missing in table. Instance name is : " + element, propertyRowsFromTable.size() == propertiesNameTypeJson.size());
+			VfVerificator.verifyVfInputs(element, propertiesNameTypeJson, propertyRowsFromTable);
+			
+			GeneralUIUtils.clickOnElementByText(element);
+		}
+		
+	}
+
+
+	@Test
+	public void addAllInformationalArtifactPlaceholdersInVfTest() throws Exception{
+		
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VF, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		
+		for(InformationalArtifactsPlaceholders informArtifact : InformationalArtifactsPlaceholders.values()){
+			ArtifactUIUtils.fillPlaceHolderInformationalArtifact(informArtifact, filePath,"asc_heat 0 2.yaml", informArtifact.getValue());
+		}
+		
+		AssertJUnit.assertTrue(InformationalArtifactPage.checkElementsCountInTable(InformationalArtifactsPlaceholders.values().length));
+	}
+	
+	@Test
+	public void verifyToscaArtifactsExist() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		final int numOfToscaArtifacts = 2;
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		AssertJUnit.assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+		
+		for(int i = 0; i < numOfToscaArtifacts; i++){
+			String typeFromScreen = ToscaArtifactsPage.getArtifactType(i);
+			AssertJUnit.assertTrue(typeFromScreen.equals(ArtifactTypeEnum.TOSCA_CSAR.getType()) || typeFromScreen.equals(ArtifactTypeEnum.TOSCA_TEMPLATE.getType()));
+		}
+		
+		ToscaArtifactsPage.clickSubmitForTestingButton(vfMetaData.getName());
+		VfVerificator.verifyToscaArtifactsInfo(vfMetaData, getUser());
+	}
+	
+	@Test(enabled=false)
+	public void testDownload() throws Exception{
+//		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+//		ResourceUIUtils.createResource(vfMetaData, getUser());
+//		
+//		final int numOfToscaArtifacts = 2;
+//		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+//		assertTrue(ToscaArtifactsPage.checkElementsCountInTable(numOfToscaArtifacts));
+//		GeneralUIUtils.clickOnElementByTestId("download-Tosca Model");
+//		System.out.println("download me");
+		
+		AttFtpClient attFtpClient = AttFtpClient.getInstance();
+		
+		File retrieveLastModifiedFileFromFTP = attFtpClient.retrieveLastModifiedFileFromFTP();
+		attFtpClient.deleteFilesFromFTPserver();
+	}
+	
+	@Test
+	public void vfCertificationTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		String vfName = vfMetaData.getName();
+		
+		ResourceGeneralPage.clickCheckinButton(vfName);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		ResourceGeneralPage.clickSubmitForTestingButton(vfName);
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		TesterOperationPage.certifyComponent(vfName);
+		
+		vfMetaData.setVersion("1.0");
+		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.CERTIFIED);
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(vfName);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CERTIFIED);
+	}
+	
+	@Test
+	public void deleteVfCheckedoutTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		GeneralPageElements.clickTrashButtonAndConfirm();
+		
+		vfMetaData.setVersion("0.1");
+		VfVerificator.verifyVfDeleted(vfMetaData, getUser());
+	}
+	
+	@Test
+	public void revertVfMetadataTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceReqDetails vfRevertDetails = new ResourceReqDetails();
+		vfRevertDetails.setName("ciUpdatedName");
+		vfRevertDetails.setDescription("kuku");
+		vfRevertDetails.setCategories(vfMetaData.getCategories());
+		vfRevertDetails.setVendorName("updatedVendor");
+		vfRevertDetails.setVendorRelease("updatedRelease");
+		ResourceUIUtils.fillResourceGeneralInformationPage(vfRevertDetails, getUser(), false);
+		
+		GeneralPageElements.clickRevertButton();
+		
+		VfVerificator.verifyVFMetadataInUI(vfMetaData);
+		
+	}
+	
+	@Test
+	public void addDeploymentArtifactInCompositionScreenTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		ArtifactInfo artifact = new ArtifactInfo(filePath, "Heat-File.yaml", "kuku", "artifact3","OTHER");
+		CompositionPage.showDeploymentArtifactTab();
+		CompositionPage.clickAddArtifactButton();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(artifact, CompositionPage.artifactPopup());
+		
+		List<WebElement> actualArtifactList = GeneralUIUtils.getWebElementsListBy(By.className("i-sdc-designer-sidebar-section-content-item-artifact"));
+		AssertJUnit.assertEquals(1, actualArtifactList.size());
+	}
+	
+	// future removed from ui
+	@Test(enabled = false)
+	public void addPropertyInCompositionScreenTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		CompositionPage.showPropertiesAndAttributesTab();
+		List<PropertyTypeEnum> propertyList = Arrays.asList(PropertyTypeEnum.STRING, PropertyTypeEnum.INTEGER);
+		int propertiesCount = CompositionPage.getProperties().size();
+		for (PropertyTypeEnum prop : propertyList){
+			PropertiesUIUtils.addNewProperty(prop);
+		}
+		AssertJUnit.assertTrue(GeneralUIUtils.checkElementsCountInTable(propertiesCount + propertyList.size(), () -> CompositionPage.getProperties()));
+	}
+	
+	@Test
+	public void addDeploymentArtifactAndVerifyInCompositionScreen() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+
+		ArtifactInfo deploymentArtifact = new ArtifactInfo(filePath, "asc_heat 0 2.yaml", "kuku", "artifact1", "OTHER");
+		DeploymentArtifactPage.clickAddNewArtifact();
+		ArtifactUIUtils.fillAndAddNewArtifactParameters(deploymentArtifact);
+		AssertJUnit.assertTrue(DeploymentArtifactPage.checkElementsCountInTable(1));
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		CompositionPage.showDeploymentArtifactTab();
+		List<WebElement> deploymentArtifactsFromScreen = CompositionPage.getDeploymentArtifacts();
+		AssertJUnit.assertTrue(1 == deploymentArtifactsFromScreen.size());
+		
+		String actualArtifactFileName = deploymentArtifactsFromScreen.get(0).getText();
+		AssertJUnit.assertTrue("asc_heat-0-2.yaml".equals(actualArtifactFileName));
+	}
+	
+	@Test
+	public void checkoutVfTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		GeneralPageElements.clickCheckoutButton();
+		
+		vfMetaData.setVersion("0.2");
+		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+		
+		ResourceGeneralPage.clickSubmitForTestingButton(vfMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.TESTER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		TesterOperationPage.certifyComponent(vfMetaData.getName());
+		
+		reloginWithNewRole(UserRoleEnum.DESIGNER);
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		ResourceGeneralPage.clickCheckoutButton();
+		
+		vfMetaData.setVersion("1.1");
+		vfMetaData.setUniqueId(null);
+		VfVerificator.verifyVFLifecycle(vfMetaData, getUser(), LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+		VfVerificator.verifyVfLifecycleInUI(LifeCycleStateEnum.CHECKOUT);
+	}
+	
+	@Test
+	public void deleteInstanceFromVfCanvas() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+		CanvasElement portElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.PORT);
+		
+		vfCanvasManager.clickOnCanvaElement(computeElement);
+		vfCanvasManager.deleteElementFromCanvas(computeElement);
+		
+		VfVerificator.verifyNumOfComponentInstances(vfMetaData, 1, getUser());
+	}
+	
+	@Test
+	public void changeInstanceNameInVfTest() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager vfCanvasManager = CanvasManager.getCanvasManager();
+		CanvasElement computeElement = vfCanvasManager.createElementOnCanvas(LeftPanelCanvasItems.COMPUTE);
+		
+		String updatedInstanceName = "updatedName";
+		vfCanvasManager.updateElementNameInCanvas(computeElement, updatedInstanceName);
+		
+		String actualSelectedInstanceName = CompositionPage.getSelectedInstanceName();
+		AssertJUnit.assertTrue(updatedInstanceName.equals(actualSelectedInstanceName));
+	}
+	
+	
+	@Test
+	public void submitVfForTestingWithNonCertifiedAsset() throws Exception{
+		String fileName = "vFW_VFC4.yml";
+
+		ResourceReqDetails atomicResourceMetaData = ElementFactory.getDefaultResourceByTypeNormTypeAndCatregory(ResourceTypeEnum.VFC, NormativeTypesEnum.ROOT, ResourceCategoryEnum.NETWORK_L2_3_ROUTERS, getUser());
+		ResourceUIUtils.importVfc(atomicResourceMetaData, filePath, fileName, getUser());
+		ResourceGeneralPage.clickSubmitForTestingButton(atomicResourceMetaData.getName());
+		
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		DeploymentArtifactPage.getLeftMenu().moveToCompositionScreen();
+		CanvasManager canvasManager = CanvasManager.getCanvasManager();
+		CompositionPage.searchForElement(atomicResourceMetaData.getName());
+		canvasManager.createElementOnCanvas(atomicResourceMetaData.getName());
+		
+		try{
+			CompositionPage.clickSubmitForTestingButton(vfMetaData.getName());
+			assert(false);
+		}
+		catch(Exception e){ 
+			String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+			String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.VALIDATED_RESOURCE_NOT_FOUND.name());
+			AssertJUnit.assertTrue(errorMessage.contains(checkUIResponseOnError));	
+		}
+		finally{
+			ResourceRestUtils.deleteResourceByNameAndVersion(atomicResourceMetaData.getName(), "0.1");
+		}
+	}
+	
+	@Test
+	public void isDisabledAndReadOnlyInCheckin() throws Exception{
+		ResourceReqDetails vfMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.createResource(vfMetaData, getUser());
+		ResourceGeneralPage.clickCheckinButton(vfMetaData.getName());
+		GeneralUIUtils.findComponentAndClick(vfMetaData.getName());
+		
+		ResourceMetadataEnum[] fieldsForCheck = {ResourceMetadataEnum.RESOURCE_NAME,
+				ResourceMetadataEnum.DESCRIPTION, ResourceMetadataEnum.VENDOR_NAME, ResourceMetadataEnum.VENDOR_RELEASE,
+				ResourceMetadataEnum.CONTACT_ID};
+
+		for (ResourceMetadataEnum field: fieldsForCheck){
+			AssertJUnit.assertTrue(GeneralUIUtils.isElementReadOnly(field.getValue()));
+		}
+		
+		AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(ResourceMetadataEnum.CATEGORY.getValue()));
+		AssertJUnit.assertTrue(GeneralUIUtils.isElementDisabled(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue()));
+	}
+	
+	@Test
+	public void exportToscaWithModulePropertiesVFTest() throws AWTException, Exception {
+		String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+		Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		String vspName = vsp.left;
+		ResourceGeneralPage.clickSubmitForTestingButton(vsp.left);
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+		VfModuleVerificator.validateSpecificModulePropertiesFromRequest(resource);
+	}
+	
+	@Test
+	public void exportToscaWithModulePropertiesTemplateCheckVFTest() throws AWTException, Exception {
+		String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+		OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		ResourceGeneralPage.getLeftMenu().moveToToscaArtifactsScreen();
+		GeneralUIUtils.clickOnElementByTestId(ToscaArtifactsScreenEnum.TOSCA_MODEL.getValue());
+		File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		ToscaDefinition toscaDefinition = VfModuleVerificator.getToscaTemplate(latestFilefromDir.getAbsolutePath());
+		VfModuleVerificator.validateSpecificModulePropertiesFromFile(toscaDefinition);
+	}
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
new file mode 100644
index 0000000..2957379
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfArtifacts.java
@@ -0,0 +1,380 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.ci.tests.businesslogic.ArtifactBusinessLogic;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CompositionScreenEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.HomeUtils;
+import org.openecomp.sdc.ci.tests.utilities.OnboardingUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class VfArtifacts extends SetupCDTest{
+	
+	private String filePath;
+	private String vnfsRepositoryPath;
+	private String updatedVnfsRepositoryPath;
+	private String createdEnvFilePath;
+	private static final String PARAMETERS = "parameters";
+	
+	@BeforeMethod
+	public void beforeTest() throws FileNotFoundException{
+		filePath = getWindowTest().getDownloadDirectory();
+		vnfsRepositoryPath = FileHandling.getVnfRepositoryPath();
+//		vnfsRepositoryPath = FileHandling.getFilePath("Old_VNFs");
+		updatedVnfsRepositoryPath = vnfsRepositoryPath + "UpdatedVNFs";
+		Config config = Utils.getConfig();
+		createdEnvFilePath = config.getWindowsDownloadDirectory();
+	}
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+	
+	
+	@DataProvider(name = "heatEnvAndVersion", parallel = false)
+//	parameters: VSP, updatedVsp, expectedHeatVersion, expectedHeatEnvVersion
+	public Object[][] provideData() {
+
+		return new Object[][] { 
+			{ "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_UpdateHeatParams.zip", "2", "1" }, //	expected heat version 2 and heatEnv 1
+			{ "2016-043_vsaegw_fdnt_30_1607_e2e.zip", "FDNT_WithoutEnvFiles.zip", "1", "1" }, //	expected heat version 1 and heatEnv 1
+			{ "2016-014_vlandslide_ldsa_30_1607_e2e.zip", "2016-209_vjsa_vjsa_30_1610_e2e.zip", "1", "0" }, //	expected heat version 1 and heatEnv 0
+			{ "2016-045_vlb_lmsp_30_1607_e2e.zip", "2016-045_vlb_lmsp_30_1607_e2e.zip", "1", "1" }, //	expected heat version 1 and heatEnv 1(DE270634)
+			{ "2016-109_mobt_mobt_30_1607_e2e.zip", "2016-109_mobt_mobt_30_1607_e2e_DifferentParams.zip", "2", "1" } //	expected heat version 2 and heatEnv 1
+		};
+	}
+	
+//	update first env file and verify parameters value
+	@Test
+	public void uploadUpdatedHeatEnv() throws Exception{
+		
+		String vnfFile = "2016-042_vmsp_pxmc_30_1607_e2e.zip";
+		File updateEnvFile = null;
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = vsp.left;
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+		Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+		List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+//		create env file and update it
+		if(envFilesList.size()>0){
+//		select index of env file to be updated 
+			HeatWithParametersDefinition selectedEnvFileToUpdate = envFilesList.get(0);
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel());
+			updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
+			ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile);
+		}
+		else{
+			SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
+		}
+	}
+
+//	update all env files and verify parameters value in Deployment Artifact View
+	@Test
+	public void uploadUpdatedAllHeatEnv() throws Exception{
+		
+		String vnfFile = "2016-044_vfw_fnat_30_1607_e2e.zip";
+		File updateEnvFile = null;
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = vsp.left;
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+		Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+		List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+		if(envFilesList.size()>0){
+			for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){
+	//			create env file and update it
+				GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatEnvLabel());
+				updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
+				ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile);
+				}
+		}else{
+			SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
+		}
+	}
+	
+//	update all env files and verify parameters value in Composition
+	@Test
+	public void uploadUpdatedAllHeatEnvComposition() throws Exception{
+		
+		String vnfFile = "2016-014_vlandslide_ldst_30_1607_e2e.zip";
+		File updateEnvFile = null;
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = vsp.left;
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, vspName, "0.1");
+		Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+		List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.StepsEnum.COMPOSITION.getValue());
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB.getValue());
+		if(envFilesList.size()>0){
+			for(HeatWithParametersDefinition selectedEnvFileToUpdate : envFilesList){
+	//			create env file and update it
+				String dataTestId = DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ITEM.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName();
+				GeneralUIUtils.hoverOnAreaByTestId(dataTestId);
+				GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue()+selectedEnvFileToUpdate.getHeatArtifactDisplayName());
+				updateEnvFile = ArtifactUIUtils.uploadCreatedUpdateParametersEnvFile(selectedEnvFileToUpdate, createdEnvFilePath);
+				ArtifactUIUtils.verifyUpdatedEnvParameters(selectedEnvFileToUpdate, updateEnvFile, dataTestId);
+				}
+		}else{
+			SetupCDTest.getExtendTest().log(Status.INFO, "Resource does not contain HEAT files");
+		}
+	}
+	
+//	expected heat version 1 and heatEnv 0
+	@Test
+	// Download ENV file from VF level Update VSP.
+	public void downloadEnvFromVFLevelUpdateVSP() throws Throwable {
+		String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+		String updatedVnfFile="2016-014_vlandslide_ldsa_30_1607_e2e.zip";
+		String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+		Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = CreatedVsp.left;
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+		OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, CreatedVsp, updatedVnfFile, getUser());
+		//get updated vsp env files
+		Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, downloadDirPath);
+		GeneralUIUtils.findComponentAndClick(vspName);
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
+		
+		for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
+			if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
+				DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
+				GeneralUIUtils.ultimateWait();
+				File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+				ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir, currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
+				}
+		}
+	}
+	
+	@Test
+	// Download ENV file from VF level Work-Space.
+	public void downloadEnvFromVFLevelWorkSpace() throws AWTException, Exception {
+		String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+		String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+		
+		Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		
+		Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
+		GeneralUIUtils.findComponentAndClick(vsp.left);
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		List<String> deploymentArtifcatsList = DeploymentArtifactPage.getDeploymentArtifactsNamesWorkSpace();
+		
+		for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
+			
+			if (DeploymentArtifactPage.getArtifactType(deploymentArtifcatsList.get(i)).equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
+				DeploymentArtifactPage.clickDownloadEnvArtifact(deploymentArtifcatsList.get(i));
+				GeneralUIUtils.ultimateWait();
+				File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+				ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(deploymentArtifcatsList.get(i)), PARAMETERS);
+			}
+		}
+	}
+	
+	@Test
+	// Download ENV file from VF level Composition.
+	public void downloadEnvVFLevelComposition() throws AWTException, Exception {
+		
+		String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+		String vnfFile = "2016-043_vsaegw_fdnt_30_1607_e2e.zip";
+		
+		Pair<String, Map<String, String>> vsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		Map<String, File> currentZipEnvfiles=ArtifactBusinessLogic.createEnvFilesListFromCsar(vsp.left,downloadDirPath);
+		GeneralUIUtils.findComponentAndClick(vsp.left);
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		CompositionPage.clickOnTabTestID(CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
+		List<WebElement> deploymentArtifcatsList = CompositionPage.getCompositionEnvArtifacts();
+		
+		for (int i = 0; i < deploymentArtifcatsList.size(); i++) {
+	    String fileName = GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)).replace(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue(), "");
+			if (GeneralUIUtils.isElementVisibleByTestId(GeneralUIUtils.getDataTestIdAttributeValue(deploymentArtifcatsList.get(i)))) {
+				CompositionPage.clickDownloadEnvArtifactComposition(fileName).click();
+				GeneralUIUtils.ultimateWait();
+				File latestFilefromDir = FileHandling.getLastModifiedFileFromDir(downloadDirPath);
+				ArtifactUIUtils.compareYamlFilesByPattern(latestFilefromDir,currentZipEnvfiles.get(fileName), PARAMETERS);
+			}
+		}
+	}
+	
+	@Test
+	// Download ENV file from VF level Update parameters in UI.
+	public void downloadEnvVFLevelUpdateParameters() throws AWTException, Exception {
+		
+		String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+		String downloadDirPath=SetupCDTest.getConfig().getWindowsDownloadDirectory();
+		Pair<String, Map<String, String>> CreatedVsp=OnboardingUtils.onboardAndValidate(Onboard.getFilePath(), vnfFile, getUser());
+		
+		Resource resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
+        Map<String, ArtifactDefinition> deploymentArtifacts = resource.getDeploymentArtifacts();
+        List<HeatWithParametersDefinition> envFilesList = ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts);
+        
+        for (int i = 0; i < envFilesList.size(); i++) {
+        	String artifactName = envFilesList.get(i).getHeatArtifactDisplayName();
+			if (envFilesList.get(i).getHeatArtifactType().equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType())) {
+				ExtentTestActions.log(Status.INFO, String.format("Opening the edit/view artifact parameters form of %s resource...", vnfFile));
+				DeploymentArtifactPage.clickEditEnvArtifact(envFilesList.get(i).getHeatArtifactDisplayName());
+				
+				ExtentTestActions.log(Status.INFO, String.format("Going To locating all artifact parameters from UI of  %s artifact...", artifactName));
+				Map<?, ?> dataToWriteInUI = ArtifactUIUtils.getDataToWriteInUI(envFilesList.get(i).getHeatParameterDefinition());
+				Map<?, ?> data = dataToWriteInUI;
+				ExtentTestActions.log(Status.INFO, String.format("Success to locate all artifact parameters from UI of  %s artifact...", artifactName));
+				
+				List<HeatParameterDataDefinition> listToSearchEnvParametersInUI = envFilesList.get(i).getHeatParameterDefinition();
+				fillHeatEnvParametersInUi(data, listToSearchEnvParametersInUI);
+				
+				DeploymentArtifactPage.clickSaveEnvParameters();
+				GeneralUIUtils.waitForLoader();
+				ExtentTestActions.log(Status.INFO, String.format("Going to get the %s updated resource ...", CreatedVsp.left));
+				resource = AtomicOperationUtils.getResourceObjectByNameAndVersion(UserRoleEnum.DESIGNER, CreatedVsp.left, "0.1");
+		        deploymentArtifacts = resource.getDeploymentArtifacts();
+		        Map<String,List<HeatWithParametersDefinition>> envFilesListupdated = new HashMap<>();
+				ExtentTestActions.log(Status.INFO, String.format("Mapping the %s artifact parameters ...", artifactName));
+		        envFilesListupdated.put(artifactName,ArtifactBusinessLogic.extractHeatWithParametersDefinition(deploymentArtifacts));
+		        List<HeatWithParametersDefinition> heatEnvUpdatedParameters=envFilesListupdated.get(artifactName);
+				DeploymentArtifactPage. clickDownloadEnvArtifact(artifactName);
+
+				Map<String,Object> mapExpectedProperties = new HashMap<>();
+				for (HeatParameterDataDefinition param : heatEnvUpdatedParameters.get(i).getHeatParameterDefinition()) {
+					mapExpectedProperties.put(param.getName(), ArtifactUIUtils.getValue(param));
+				}
+				ArtifactUIUtils.compareYamlParametersByPattern(mapExpectedProperties, FileHandling.getLastModifiedFileFromDir(downloadDirPath), PARAMETERS);
+			}
+        }
+	}
+
+
+	@Test
+	public void checkDefaultCreatedEnvArtifacts() throws Exception{
+		String vnfFile = "2016-017_vixia_ixla_30_1607_e2e.zip";
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = vsp.left;
+		Map<String, File> generatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
+		HomeUtils.findComponentAndClick(vspName);
+		GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+		for(Entry<String, File> envFileEntry : generatedEnvFileList.entrySet()){
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+			ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+			ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "0", ArtifactTypeEnum.HEAT_ENV);
+			ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT);
+		}
+	}
+	
+//	-------------------------------------------------------------------------------
+	@Test(dataProvider = "heatEnvAndVersion")
+	public void checkDefaultCreatedEnvArtifactsAfterVspUpdate(String vnfFile, String updatedVnfFile, String expectedHeatVersion, String expectedHeatEnvVersion) throws Throwable{
+		String stringForLog = String.format("%s:%s:%s:%s", vnfFile, updatedVnfFile, expectedHeatVersion, expectedHeatEnvVersion);
+		setLog(stringForLog);		
+		
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = vsp.left;
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+		OnboardingUtils.updateVnfAndValidate(updatedVnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+		Map<String, File> generatedUpdatedEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
+		HomeUtils.findComponentAndClick(vspName);
+		GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+		for(Entry<String, File> envFileEntry : generatedUpdatedEnvFileList.entrySet()){
+//			TODO test will pass on case all objects on deployment view are visible 
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+			ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+			ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatEnvVersion, ArtifactTypeEnum.HEAT_ENV);
+			ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), expectedHeatVersion, ArtifactTypeEnum.HEAT);
+		}
+	}
+	
+//	expected heat version 1 and heatEnv 2
+	@Test
+	public void checkDefaultCreatedEnvArtifactsVspUpdatedWithSameVspTwice() throws Throwable{
+		String vnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+		String updatedVnfFile = "2016-044_vfw_fcgi_30_1607_e2e.zip";
+		Pair<String,Map<String,String>> vsp = OnboardingUtils.onboardAndValidate(vnfsRepositoryPath, vnfFile, getUser());
+		String vspName = vsp.left;
+		
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+		OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+		OnboardingUtils.updateVnfAndValidate(vnfsRepositoryPath, vsp, updatedVnfFile, getUser());
+		Map<String, File> generatedUpdatedSecondTimeEnvFileList = ArtifactBusinessLogic.createEnvFilesListFromCsar(vspName, filePath);
+		HomeUtils.findComponentAndClick(vspName);
+		GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+		for(Entry<String, File> envFileEntry : generatedUpdatedSecondTimeEnvFileList.entrySet()){
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+			ArtifactUIUtils.compareYamlFilesByPattern(envFileEntry.getValue(), FileHandling.getLastModifiedFileFromDir(), PARAMETERS);
+			ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "2", ArtifactTypeEnum.HEAT_ENV);
+			ArtifactUIUtils.validateArtifactVersionByTypeAndLabel(envFileEntry.getKey(), "1", ArtifactTypeEnum.HEAT);
+		}
+	}
+	
+	
+	public void downloadFile(Entry<String, File> envFileEntry) {
+		int fileCountBefore = FileHandling.getFileCountFromDefaulDownloadDirectory();
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+envFileEntry.getKey());
+		int fileCountAfter = FileHandling.getFileCountFromDefaulDownloadDirectory();
+		assertTrue("Downloaded file is missing", (fileCountAfter - fileCountBefore) == 1 );
+	}
+
+	public static void fillHeatEnvParametersInUi(Map<?, ?> data,List<HeatParameterDataDefinition> listToSearchEnvParametersInUI) {
+		ExtentTestActions.log(Status.INFO, String.format("Going to search parameters in UI and insert new current value to each parameter in UI..."));
+
+		for (HeatParameterDataDefinition paramDefinition : listToSearchEnvParametersInUI){
+			DeploymentArtifactPage.searchBoxEnv(paramDefinition.getName());
+			WebElement currenValueField=GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.EnvParameterView.ENV_CURRENT_VALUE.getValue()+paramDefinition.getName());
+			currenValueField.clear();
+			currenValueField.sendKeys(data.get(paramDefinition.getName()).toString());
+			GeneralUIUtils.ultimateWait();
+			DeploymentArtifactPage.clearSearchBoxEnv();
+		}
+	}
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
new file mode 100644
index 0000000..42c43f3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/sanity/VfDeploymentInformationalArtifacts.java
@@ -0,0 +1,862 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.sanity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.ArtifactUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openecomp.sdc.common.api.ArtifactTypeEnum;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+import org.testng.SkipException;
+import org.testng.annotations.Test;
+
+
+public class VfDeploymentInformationalArtifacts extends SetupCDTest {
+	
+	
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	// START US824719
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1434241 - Import VF Artifacts - Deployment Artifacts - One Artifact, One Type
+	@Test
+	public void importVfArtifactsDeploymentArtifactsOneArtifactOneType() throws Exception {
+		String fileName = "TC1434241.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1434245 - Import VF Artifacts - Deployment Artifacts - Multiple Artifacts, Multiple Types
+	@Test
+	public void importVfArtifactsDeploymentArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+		String fileName = "TC1434245.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName,folder, deploymentArtifacts, null);
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1434247 - Import VF Artifacts - Informational Artifacts - One Artifact, One Type
+	@Test
+	public void importVfArtifactsInformationalArtifactsOneArtifactOneType() throws Exception {
+		String fileName = "TC1434247.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, informationalArtifacts);
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1434248 - 	Import VF Artifacts - Informational Artifacts - Multiple Artifacts, Multiple Types
+	@Test
+	public void importVfArtifactsInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+		String fileName = "TC1434248.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName,  folder, deploymentArtifacts, informationalArtifacts);
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1434249 - 	Import VF Artifacts - Deployment and Informational Artifacts - Multiple Artifacts, Multiple Types
+	@Test
+	public void importVfArtifactsDeploymentAndInformationalArtifactsMultipleArtifactsMultipleTypes() throws Exception {
+		String fileName = "TC1434249.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+	}
+	
+	// TODO: there is defect in flow: "Updated button enabled for artifact in invalid type folder"
+	// TODO: re-check it after defect fix
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1438310 - Import VF Artifacts - Deployment Artifacts - Artifact Type Invalid
+	@Test
+	public void importVFArtifactsDeploymentArtifactsArtifactTypeInvalid() throws Exception {
+		String fileName = "DeploymentArtifactWithInvalidType.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1438311 - Import VF Artifacts - Informational Artifacts - Artifact Type Invalid
+	@Test
+	public void importVfArtifactsInformationalArtifactsArtifactTypeInvalid() throws Exception {
+		String fileName = "InformationArtifactWithInvalidType.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "ArtifactName.yaml", null, "ArtifactName", ArtifactTypeEnum.OTHER.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1438231 - 	Import VF Artifacts - Deployment Artifacts - Artifact Name To Long
+	@Test
+	public void importVfArtifactsDeploymentArtifactsArtifactNameToLong() throws Exception {		
+		String folder = "US825779";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+	
+		String fileName = "DeploymentArtifactWithLongName.csar";
+		
+		importVfFromCsar(resourceMetaData, folder, fileName, getUser());	
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+        String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+        Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	// US824719 - Import VSP - VF informational artifacts
+	// TC1438232 - Import VF Artifacts - Informational Artifacts - Artifact Name To Long
+	// TODO: make informational artifact name longer then 255
+	// TODO: windows/linux not allowed it
+	@Test(enabled=false)
+	public void importVfArtifactsInformationalArtifactsArtifactNameToLong() throws Exception {
+		String folder ="US825779";
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+	
+		String fileName = "InformationArtifactWithLongName.csar";
+		
+		importVfFromCsar(resourceMetaData, folder, fileName, getUser());	
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+	    String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+	    Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	// END US824719
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	
+	
+	
+	
+	
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	// START US825779
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443736 - Update With One New Deployment Artifact
+	@Test
+	public void updateWithOneNewDeploymentArtifact() throws Exception {
+		String fileName =  "ImportTC1443736.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1443736.csar";
+		deploymentArtifacts.add(new  ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null);
+	}
+	
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443737 - Update With One Removed Deployment Artifact
+	@Test
+	public void updateWithOneRemovedDeploymentArtifact() throws Exception {
+		String fileName =  "ImportTC1443737.csar";
+		String folder ="US825779";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		ArtifactInfo artifactInfo = new  ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
+		deploymentArtifacts.add(artifactInfo);
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1443737.csar";
+		deploymentArtifacts.remove(artifactInfo);
+		
+		List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>();
+		deploymentArtifactsNotExist.add(artifactInfo);
+		
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, deploymentArtifactsNotExist, null);
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443738 - Update With One New Version Deployment Artifact
+	@Test
+	public void updateWithOneNewVersionDeploymentArtifact() throws Exception {
+		String fileName =  "ImportTC1443738.csar";
+		String folder ="US825779";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+			
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		ArtifactInfo artifactInfo = new  ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
+		deploymentArtifacts.add(artifactInfo);
+			
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder, deploymentArtifacts, null);
+			
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "UpdateTC1443738.csar";
+		artifactInfo.setArtifactVersion("2");
+			
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null);
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443887 - Update With One New Informational Artifact
+	@Test
+	public void updateWithOneNewInformationalArtifact() throws Exception {
+		String fileName =  "ImportTC1443887.csar";
+		String folder ="US825779";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+			
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "UpdateTC1443887.csar";
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+			
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null);
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443888 - Update With One Removed Informational Artifact
+	@Test
+	public void updateWithOneRemovedInformationalArtifact() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1443888.csar";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		ArtifactInfo artifactInfo = new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
+		informationalArtifacts.add(artifactInfo);
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "UpdateTC1443888.csar";
+		
+		informationalArtifacts.remove(artifactInfo);
+		
+		List<ArtifactInfo> informationalArtifactNotExist = new ArrayList<ArtifactInfo>();
+		informationalArtifactNotExist.add(artifactInfo);
+			
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, informationalArtifactNotExist);
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443890 - Update With One New Artifact Version Informational Artifact
+	@Test
+	public void updateWithOneNewArtifactVersionInformationalArtifact() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1443890.csar";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		ArtifactInfo artifactInfo = new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
+		informationalArtifacts.add(artifactInfo);
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "UpdateTC1443890.csar";
+		artifactInfo.setArtifactVersion("2");
+			
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null);
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443893 - Update CSAR With Same Artifacts As Imported
+	@Test
+	public void updateCSARWithSameArtifactsAsImported() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportUpdateTC1443893.csar";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1"));	
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "HeatVolArtifactName3.yaml", null, "HeatVolArtifactName3", ArtifactTypeEnum.HEAT_VOL.getType(), "1"));
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1"));
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "ImportUpdateTC1443893.csar";
+			
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, null, null);
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1443954 - Update With Multiple Changes In Deployment And Informational Artifacts
+	@Test
+	public void updateWithMultipleChangesInDeploymentAndInformationalArtifacts() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1443954.csar";
+		
+		ArtifactInfo deploymentHeat1 = new  ArtifactInfo(null, "heatartifactname1.yaml", null, "heatartifactname1", ArtifactTypeEnum.HEAT.getType(), "1");
+		ArtifactInfo deploymentHeat2 = new  ArtifactInfo(null, "heatartifactname2.yaml", null, "heatartifactname2", ArtifactTypeEnum.HEAT.getType(), "1");
+		ArtifactInfo deploymentHeat3 = new  ArtifactInfo(null, "heatartifactname3.yaml", null, "heatartifactname3", ArtifactTypeEnum.HEAT.getType(), "1");
+		
+		ArtifactInfo deploymentHeatVol1 = new  ArtifactInfo(null, "HeatVolArtifactName1.yaml", null, "HeatVolArtifactName1", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
+		ArtifactInfo deploymentHeatVol2 = new  ArtifactInfo(null, "HeatVolArtifactName2.yaml", null, "HeatVolArtifactName2", ArtifactTypeEnum.HEAT_VOL.getType(), "1");
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(deploymentHeat1);
+		deploymentArtifacts.add(deploymentHeat2);
+		deploymentArtifacts.add(deploymentHeat3);
+		deploymentArtifacts.add(deploymentHeatVol1);
+		deploymentArtifacts.add(deploymentHeatVol2);
+		
+		ArtifactInfo infoGuide1 = new  ArtifactInfo(null, "GuideInfoArtifact1.yml", null, "GuideInfoArtifact1", ArtifactTypeEnum.GUIDE.getType(), "1");
+		ArtifactInfo infoGuide2 = new  ArtifactInfo(null, "GuideInfoArtifact2.yml", null, "GuideInfoArtifact2", ArtifactTypeEnum.GUIDE.getType(), "1");
+		
+		ArtifactInfo infoOther1 = new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1");
+		ArtifactInfo infoOther2 = new  ArtifactInfo(null, "artifactname2.txt", null, "artifactname2", ArtifactTypeEnum.OTHER.getType(), "1");
+		ArtifactInfo infoOther3 = new  ArtifactInfo(null, "artifactname3.txt", null, "artifactname3", ArtifactTypeEnum.OTHER.getType(), "1");
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(infoGuide1);
+		informationalArtifacts.add(infoGuide2);
+		informationalArtifacts.add(infoOther1);
+		informationalArtifacts.add(infoOther2);
+		informationalArtifacts.add(infoOther3);
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "UpdateTC1443954.csar";
+		
+		List<ArtifactInfo> informationalArtifactsNotExist = new ArrayList<ArtifactInfo>();
+		List<ArtifactInfo> deploymentArtifactsNotExist = new ArrayList<ArtifactInfo>();
+		
+		// Changes in deployment artifacts
+		deploymentArtifactsNotExist.add(deploymentHeat1);
+		deploymentArtifactsNotExist.add(deploymentHeat2);
+		deploymentArtifacts.remove(deploymentHeat1);
+		deploymentArtifacts.remove(deploymentHeat2);
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname4.yaml", null, "heatartifactname4", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "heatartifactname5.yaml", null, "heatartifactname5", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentHeatVol1.setArtifactVersion("2");
+		deploymentHeatVol2.setArtifactVersion("2");
+		
+		// Changes in informational artifacts
+		infoGuide1.setArtifactVersion("2");
+		infoOther1.setArtifactVersion("2");
+		informationalArtifactsNotExist.add(infoGuide2);
+		informationalArtifactsNotExist.add(infoOther2);
+		informationalArtifacts.remove(infoGuide2);
+		informationalArtifacts.remove(infoOther2);
+		informationalArtifacts.add(new  ArtifactInfo(null, "GuideInfoArtifact3.yml", null, "GuideInfoArtifact3", ArtifactTypeEnum.GUIDE.getType(), "1"));
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname4.txt", null, "artifactname4", ArtifactTypeEnum.OTHER.getType(), "1"));
+			
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, informationalArtifacts, deploymentArtifactsNotExist, informationalArtifactsNotExist);
+	}
+	
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444206 - Update With Existed Deployment Artifact By Artifact With Different Type
+	@Test
+	public void updateWithExistedDeploymentArtifactByArtifactWithDifferentType() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1444206.csar";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+		deploymentArtifacts.add(new  ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+			
+		fileName = "UpdateTC1444206.csar";
+		String filePath = FileHandling.getFilePath(folder); ;
+			
+		ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+	    String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name());
+	    Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444207 - Update With Existed Informational Artifact By Artifact With Different Type
+	@Test
+	public void updateWithExistedInformationalArtifactByArtifactWithDifferentType() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1444207.csar";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));		
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, informationalArtifacts);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1444207.csar";
+		String filePath = FileHandling.getFilePath(folder); ;
+			
+		ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+	    String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name());
+	    Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444208 - Update With Existed Informational Artifact By Deployment Artifact With Different Type
+	@Test
+	public void updateWithExistedInformationalArtifactByDeploymentArtifactWithDifferentType() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1444208.csar";
+			
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.HEAT.getType(), "1"));
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1444208.csar";
+		String filePath = FileHandling.getFilePath(folder); ;
+				
+		ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+	    String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.ARTIFACT_ALRADY_EXIST_IN_DIFFERENT_TYPE_IN_CSAR.name());
+	    Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444520 - Update Deployment Artifact With Name To Long
+	@Test
+	public void updateDeploymentArtifactWithNameToLong() throws Exception {
+		String folder ="US825779";
+		
+		String fileName =  "ImportTC1444520.csar";
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  null, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1444520.csar";
+		String filePath = FileHandling.getFilePath(folder); ;
+				
+		ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+	    String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+	    Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444521 - Update Informational Artifact With Name To Long
+	@Test
+	public void updateInformationalArtifactWithNameToLong() throws Exception {
+		
+		String folder = "US825779";
+		String fileName =  "ImportTC1444521.csar";
+			
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  null, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1444521.csar";
+		String filePath = FileHandling.getFilePath(folder); ;
+				
+		ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+		
+		String errorMessage = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+	    String checkUIResponseOnError = ErrorValidationUtils.checkUIResponseOnError(ActionStatus.EXCEEDS_LIMIT.name());
+	    Assert.assertTrue(errorMessage.contains(checkUIResponseOnError));
+	}
+	
+	// TODO: only after below TODO's it complete test
+	// TODO: verify that if delete/edit button need to be disabled then check that there is no such buttons
+	// TODO: in composition & artifact pages
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444530 - Update Deployment Artifact With Invalid Type
+	@Test
+	public void updateDeploymentArtifactWithInvalidType() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1444530.csar";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1444530.csar";
+		deploymentArtifacts.add(new  ArtifactInfo(null, "artifactname1.yaml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+		
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, deploymentArtifacts, null, null, null);
+	}
+	
+	
+	// US825779 - Story: [BE] Import VSP - VF informational artifacts  - Update
+	// TC1444531 - Update Informational Artifact With Invalid Type
+	@Test
+	public void updateInformationalArtifactWithInvalidType() throws Exception {
+		String folder ="US825779";
+		String fileName =  "ImportTC1444531.csar";
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  null, null);
+		
+		GeneralUIUtils.clickOnElementByTestId("breadcrumbs-button-1");
+		
+		fileName = "UpdateTC1444531.csar";
+		
+		List<ArtifactInfo> informationalArtifacts = new ArrayList<ArtifactInfo>();
+		informationalArtifacts.add(new  ArtifactInfo(null, "artifactname1.xml", null, "artifactname1", ArtifactTypeEnum.OTHER.getType(), "1"));
+		
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, fileName, null, informationalArtifacts, null, null);
+	}
+	
+	
+	@Test
+	public void importValidInformationalArtifactInInvalidFolerTest_TC1438313() throws Exception{
+		String fileName =  "ValidArtifactNameInInvalidFolder.csar";
+		String folder = "US824719";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+		
+		importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(fileName, folder,  deploymentArtifacts, null);
+	}
+	
+	@Test
+	public void updateValidInformationalArtifactInInvalidFolerTest_TC1444533() throws Exception{
+		String fileName =  "ImportTC1444533.csar";
+		String folder = "US824719";
+		String filePath = FileHandling.getFilePath(folder);
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		
+		String updatedCsarFileName = "UpdateTC1444533.csar";
+		
+		List<ArtifactInfo> deploymentArtifacts = new ArrayList<ArtifactInfo>();
+		deploymentArtifacts.add(new  ArtifactInfo(null, "base_ldsa.yaml", null, "base_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));
+		deploymentArtifacts.add(new  ArtifactInfo(null, "module_1_ldsa.yaml", null, "module_1_ldsa", ArtifactTypeEnum.HEAT.getType(), "1"));			
+		
+		updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(folder, updatedCsarFileName, deploymentArtifacts, null, null, null);
+	}
+	
+	
+	
+	
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	// END US825779
+	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+	
+	
+	
+	public void updateVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String folder, String fileName,
+			List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts,
+			List<ArtifactInfo> deploymentArtifactsNotExist, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
+		String filePath = FileHandling.getFilePath(folder);
+		ResourceUIUtils.updateVfWithCsar(filePath, fileName);
+		
+		validateDeploymentArtifactPage(deploymentArtifacts, null);
+		validateInformationalArtifactPage(informationalArtifacts, null);
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		validateDeploymentArtifactInComposition(deploymentArtifacts, null);
+		validateInformationalArtifactInComposition(informationalArtifacts, null);
+		
+	}
+	
+
+	public void importVfFromCsar(ResourceReqDetails resourceMetaData, String folder, String fileName, User user) {
+		String filePath = FileHandling.getFilePath(folder);
+		GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+		// Insert file to the browse dialog
+		WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+		browseWebElement.sendKeys(filePath + fileName);
+
+		// Fill the general page fields.
+		GeneralUIUtils.waitForLoader();
+		ResourceUIUtils.fillResourceGeneralInformationPage(resourceMetaData, getUser(), true);
+		GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+	}
+
+	
+	
+	
+	public void importVfAndValidateInformationalDeploymentArtifactPagesOnPagesAndComposition(String fileName, String folder, List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> informationalArtifacts) throws Exception {
+		String filePath = FileHandling.getFilePath(folder);
+		ResourceReqDetails resourceMetaData = ElementFactory.getDefaultResourceByType(ResourceTypeEnum.VF, getUser());
+		ResourceUIUtils.importVfFromCsar(resourceMetaData, filePath, fileName, getUser());
+		
+		validateDeploymentArtifactPage(deploymentArtifacts, null);
+		validateInformationalArtifactPage(informationalArtifacts, null);
+		
+		ResourceGeneralPage.getLeftMenu().moveToCompositionScreen();
+		
+		validateDeploymentArtifactInComposition(deploymentArtifacts, null);
+		validateInformationalArtifactInComposition(informationalArtifacts, null);
+	}
+	
+	public void validateInformationalArtifactInComposition(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) throws Exception {
+		CompositionPage.showInformationArtifactTab();
+		// Composition informational
+		if(informationalArtifacts != null && informationalArtifacts.size() > 0) {
+			validateEachArtifactOnCompositionRightMenuInformationPage(informationalArtifacts);
+		}
+		if(informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {
+			validateEachArtifactNotExistOnCompositionRightMenuInformationPage(informationalArtifactsNotExist);
+		}
+	}
+	
+	public void validateDeploymentArtifactInComposition(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) throws Exception {
+		CompositionPage.showDeploymentArtifactTab();
+		// Composition deployment
+		if(deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
+			validateEachArtifactOnCompositionRightMenuDeploymentPage(deploymentArtifacts);
+		}
+		if(deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
+			validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(deploymentArtifactsNotExist);
+		}
+	}
+	
+	public void validateInformationalArtifactPage(List<ArtifactInfo> informationalArtifacts, List<ArtifactInfo> informationalArtifactsNotExist) {
+		ResourceGeneralPage.getLeftMenu().moveToInformationalArtifactScreen();
+		// Informational page
+		if(informationalArtifacts != null && informationalArtifacts.size() > 0) {	
+			validateEachArtifactInformationPage(informationalArtifacts);
+		}
+		if(informationalArtifactsNotExist != null && informationalArtifactsNotExist.size() > 0) {	
+			validateEachArtifactNotExistInformationPage(informationalArtifactsNotExist);
+		}
+	}
+	
+	public void validateDeploymentArtifactPage(List<ArtifactInfo> deploymentArtifacts, List<ArtifactInfo> deploymentArtifactsNotExist) {
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		// Deployment page
+		if(deploymentArtifacts != null && deploymentArtifacts.size() > 0) {
+			validateEachArtifactOnDeploymentPage(deploymentArtifacts);
+		}
+		if(deploymentArtifactsNotExist != null && deploymentArtifactsNotExist.size() > 0) {
+			validateEachArtifactNotExistOnDeploymentPage(deploymentArtifactsNotExist);
+		}
+	}
+	
+	// TODO: add validation that if not editable / deleteable then button should not appear
+	public void validateEachArtifactOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			String type = artifact.getArtifactType();
+			String label = artifact.getArtifactLabel();
+			String version = artifact.getArtifactVersion();
+			
+			if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())){
+				ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, false, false, true);
+			}
+			else{
+				ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(label, null, version, type, true, true, true, false);
+			}
+		}
+	}
+	
+	public void validateEachArtifactNotExistOnDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
+		}
+	}
+	
+	public void validateEachArtifactInformationPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			ArtifactUIUtils.validateExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel(), null, artifact.getArtifactVersion(), artifact.getArtifactType(), true, true, true, false);
+		}
+	}
+	
+	public void validateEachArtifactNotExistInformationPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			ArtifactUIUtils.validateNotExistArtifactOnDeploymentInformationPage(artifact.getArtifactLabel());
+		}
+	}
+	
+	public void validateEachArtifactOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			
+			String type = artifact.getArtifactType();
+			String label = artifact.getArtifactLabel();
+			String filename = artifact.getFilename();
+			
+			if (type.equals(ArtifactTypeEnum.HEAT.getType()) || type.equals(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equals(ArtifactTypeEnum.HEAT_NET.getType())){
+				ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, false, true, true, false);
+			}
+			else{
+				ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(filename, label, true, false, true, true);
+			}
+		}
+	}
+	
+	public void validateEachArtifactNotExistOnCompositionRightMenuDeploymentPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
+		}
+	}
+	
+	// TODO: there is defect in this flow
+	// TODO: change isEditable to false when defect fix
+	public void validateEachArtifactOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			ArtifactUIUtils.validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getFilename(), artifact.getArtifactLabel(), true, false, true, true);
+		}
+	}
+	
+	public void validateEachArtifactNotExistOnCompositionRightMenuInformationPage(List<ArtifactInfo> artifactInfoList) {
+		for(ArtifactInfo artifact: artifactInfoList) {
+			ArtifactUIUtils.validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(artifact.getArtifactLabel());
+		}
+	}
+
+
+
+	@Override
+	protected UserRoleEnum getRole() {
+		return UserRoleEnum.DESIGNER;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java
new file mode 100644
index 0000000..7f67978
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ArtifactsCorrelationManager.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+
+public class ArtifactsCorrelationManager {
+
+		private static HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>> vNFArtifactsCorrelationMap = new HashMap<String, LinkedList<HeatMetaFirstLevelDefinition>>();
+		private static HashMap<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>> serviceVNFCorrelationMap = new HashMap<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>();
+
+		public static void addVNFartifactDetails(String vspName,
+				LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts) {
+			
+			vNFArtifactsCorrelationMap.put(vspName, deploymentArtifacts);
+			
+			
+		}
+		
+		public static Entry<String, LinkedList<HeatMetaFirstLevelDefinition>> getVNFartifactDetails(String vnfName){
+			
+			
+			Set<Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>> entrySet = vNFArtifactsCorrelationMap.entrySet();
+			for (Entry<String, LinkedList<HeatMetaFirstLevelDefinition>> entry : entrySet) {
+				String key = entry.getKey();
+				if (key.equals(vnfName)) {
+					return entry;
+				}
+												
+			}
+			return null;
+						
+		}
+		
+		
+		public static void addVNFtoServiceArtifactCorrelation(String service, String vnfName){
+			
+			serviceVNFCorrelationMap.put(service,  getVNFartifactDetails(vnfName));
+			
+		}
+		
+		public static Set<Entry<String, Entry<String, LinkedList<HeatMetaFirstLevelDefinition>>>> getServiceArtifactCorrelationMap(String service){
+			
+			return serviceVNFCorrelationMap.entrySet();
+			
+		}
+		
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
new file mode 100644
index 0000000..1d7c4ae
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/AttFtpClient.java
@@ -0,0 +1,221 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.apache.commons.net.ftp.FTPReply;
+
+public class AttFtpClient {
+
+	private static final AttFtpClient instance = new AttFtpClient();
+
+	public static AttFtpClient getInstance() {
+		return instance;
+	}
+
+	private FTPClient apacheFtpClient;
+
+	private AttFtpClient() {
+		apacheFtpClient = new FTPClient();
+	};
+
+
+	public void init(String server, int port, String user, String pass) {
+
+		try {
+			apacheFtpClient.connect(server, port);
+			showServerReply(apacheFtpClient);
+		
+			
+			int replyCode = apacheFtpClient.getReplyCode();
+			if (!FTPReply.isPositiveCompletion(replyCode)) {
+				System.out.println("Connect failed");
+				return;
+			}
+
+			boolean success = apacheFtpClient.login(user, pass);
+			showServerReply(apacheFtpClient);
+
+			if (!success) {
+				System.out.println("Could not login to the server");
+				return;
+			}
+			
+//			else{
+//				apacheFtpClient.enterLocalPassiveMode();
+//				apacheFtpClient.setFileType(FTP.BINARY_FILE_TYPE);	
+//			}
+		} catch (IOException ex) {
+			System.out.println("Oops! Something wrong happened");
+			ex.printStackTrace();
+		}
+
+	}
+
+	public File retrieveLastModifiedFileFromFTP() throws IOException {
+		FTPFile[] files1 = retrieveListOfFile();
+
+		// sort list by TimeStamp
+		List<FTPFile> sorted = Arrays.asList(files1).stream()
+				.sorted((e1, e2) -> e1.getTimestamp().compareTo(e2.getTimestamp())).collect(Collectors.toList());
+		printFileDetailsList(sorted);
+
+		// retrieve file from FTP
+		FTPFile ftpFile = sorted.get(sorted.size() - 1);
+
+		return retrieveFileFromFTP(ftpFile);
+
+	}
+
+	public FTPFile[] retrieveListOfFile() throws IOException {
+		// Lists files and directories
+		FTPFile[] files = apacheFtpClient.listFiles("");
+		
+		printNames(files);
+		return files;
+	}
+
+	public File retrieveFileFromFTP(FTPFile ftpFile) throws IOException {
+		
+        File downloadFile1 = new File("tmp");
+        OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1));
+        boolean success = apacheFtpClient.retrieveFile(ftpFile.getName(), outputStream1);
+        outputStream1.close();
+
+        if (success) {
+            System.out.println("File #1 has been downloaded successfully.");
+        }
+		
+
+		return downloadFile1;
+
+	}
+
+	public void deleteFilesFromFTPserver() throws IOException {
+		FTPFile[] files = retrieveListOfFile();
+		deleteFiles(files);
+	}
+
+	public void terminateClient() throws IOException {
+
+		String status = apacheFtpClient.getStatus();
+
+		// logs out and disconnects from server
+		try {
+			if (apacheFtpClient.isConnected()) {
+				apacheFtpClient.logout();
+				apacheFtpClient.disconnect();
+			}
+		} catch (IOException ex) {
+			ex.printStackTrace();
+		}
+	}
+
+	private void printFileDetailsList(List<FTPFile> list) {
+		DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+		for (FTPFile ftpFile : list) {
+
+			String details = ftpFile.getName();
+			if (ftpFile.isDirectory()) {
+				details = "[" + details + "]";
+			}
+			details += "\t\t" + ftpFile.getSize();
+			details += "\t\t" + dateFormater.format(ftpFile.getTimestamp().getTime());
+
+			System.out.println(details);
+		}
+	}
+
+	private void printNames(FTPFile[] files) {
+		if (files != null && files.length > 0) {
+			for (FTPFile aFile : files) {
+				System.out.println(aFile);
+			}
+		}
+	}
+
+	private void showServerReply(FTPClient ftpClient) {
+		String[] replies = ftpClient.getReplyStrings();
+		if (replies != null && replies.length > 0) {
+			for (String aReply : replies) {
+				System.out.println("SERVER: " + aReply);
+			}
+		}
+	}
+
+	public class LastModifiedComparator implements Comparator<FTPFile> {
+
+		public int compare(FTPFile f1, FTPFile f2) {
+			return f1.getTimestamp().compareTo(f2.getTimestamp());
+		}
+	}
+
+	public FTPFile getMaxLastModified(FTPFile[] ftpFiles) {
+		return Collections.max(Arrays.asList(ftpFiles), new LastModifiedComparator());
+	}
+
+	public static void displayFiles(File[] files) {
+		for (File file : files) {
+			System.out.printf("File: %-20s Last Modified:" + new Date(file.lastModified()) + "\n", file.getName());
+		}
+	}
+
+	public void deleteFiles(FTPFile[] files) {
+
+		for (FTPFile file : files) {
+
+			boolean deleted = false;
+			try {
+				deleted = apacheFtpClient.deleteFile(file.getName());
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+			if (deleted) {
+				System.out.println("The file was deleted successfully.");
+			} else {
+				System.out.println("Could not delete the  file, it may not exist.");
+			}
+		}
+
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
new file mode 100644
index 0000000..7d0d77a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/DriverFactory.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxProfile;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+
+
+public class DriverFactory {
+
+	private static ThreadLocal<WebDriverThread> driverThread;
+	private static List<WebDriverThread> webDriverThreadPool = Collections.synchronizedList(new ArrayList<WebDriverThread>());
+	private static Config config;
+	
+	public DriverFactory() {
+		try {
+			config = Utils.getConfig();
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	@BeforeSuite(alwaysRun = true)
+	public static void instantiateDriverObject() {
+		
+		
+		File basePath = new File(FileHandling.getBasePath());
+		File[] listFiles = basePath.listFiles(new FilenameFilter() {
+			
+			@Override
+			public boolean accept(File basePath, String name) {
+				return name.startsWith(WebDriverThread.AUTOMATION_DOWNLOAD_DIR);
+			}
+		});
+		Arrays.asList(listFiles).forEach(e -> FileHandling.deleteDirectory(e.getAbsolutePath()));
+		
+		
+		
+		driverThread = new ThreadLocal<WebDriverThread>() {
+			@Override
+			protected WebDriverThread initialValue() {
+				WebDriverThread webDriverThread = new WebDriverThread(config);
+				webDriverThreadPool.add(webDriverThread);
+				return webDriverThread;
+			}
+		};
+	}
+	
+	public static WebDriver getDriver() throws Exception {
+		return driverThread.get().getDriver();
+	}
+	
+	public static FirefoxProfile getDriverFirefoxProfile() throws Exception {
+		return driverThread.get().getFirefoxProfile();
+	}
+	
+	@AfterSuite(alwaysRun = true)
+	public static void quitDriverAfterSuite() throws Exception {
+		for (WebDriverThread webDriverThread : webDriverThreadPool) {
+			if (webDriverThread.getDriver() != null)
+				webDriverThread.quitDriver();
+		}
+		deleteDownloadDirs();
+	}
+
+	private static void deleteDownloadDirs() throws IOException {
+//		System.gc();
+		HashMap<Long,WindowTest> windowMap = WindowTestManager.getWholeMap();
+		for (WindowTest win : windowMap.values()){
+			String downloadDirectory = win.getDownloadDirectory();
+			FileUtils.deleteDirectory(new File(downloadDirectory));
+		}
+	}
+	
+	public static void quitDriver() throws Exception{
+		driverThread.get().quitDriver();
+		driverThread.remove();
+		WindowTestManager.removeWindowTest();
+	}
+
+	public static Config getConfig() {
+		return config;
+	}
+
+	public static void setConfig(Config config) {
+		DriverFactory.config = config;
+	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
new file mode 100644
index 0000000..09dcad7
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentManager.java
@@ -0,0 +1,169 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.AutomationUtils;
+import org.testng.ITestContext;
+
+import com.aventstack.extentreports.ExtentReports;
+import com.aventstack.extentreports.reporter.ExtentHtmlReporter;
+import com.aventstack.extentreports.reporter.ExtentXReporter;
+import com.aventstack.extentreports.reporter.configuration.Protocol;
+import com.aventstack.extentreports.reporter.configuration.Theme;
+
+public class ExtentManager {
+	
+	private static final String VERSIONS_INFO_FILE_NAME = "versions.info";
+	private static ExtentReports extent;
+	private static ExtentHtmlReporter htmlReporter;
+	private static ExtentXReporter extentxReporter;
+	private static final String icon = "$(document).ready(function() {" +"\n"+
+                    "$('.brand-logo').html('').prepend(\"<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As9PvbmBiEDkeS8CSmpuEhCOi6FTW0sAYhiTRNTTM8JBoaGmDpSEODoK65EQM7YpLCCCVC97ciAUODuSU6UpO88Jpxo91NH58xwTHtcSx6vJ2DKUlTSlBVVqKVesnqlrSosaWcFTa0eXFX1nmSmrChjTc1qoCIKwlJ1W8NkDoITUPokAQ6U0I2uYL9FZZ+UNfYnvDkhoWlRnNdhIMP7HWcsqDOonKDsK7znzPLRvsS+PiMCsec4VjwWDvNaUFTh8eS8VbFvpSc4Qh5esJjKbBASDnDlZTqGmEpQQ7yPLoGSGxdIx4xtEZbyhdrA/pGIVk+ParveEt9qOH69d3i1AqTcbg8eE71aF8aH58RY8wbjresjbGiCTzpsb/JYUF9oKwpJZekhLzQkfJMIVnkCMoBY7BGIl90DQyNeEjXdhsaz4UN7V9TwvozK88p31Pzzza5uNykOqDzh2Wlo33ZfHyGlTFrOC58opMGT9DuCG6YGdG/ty0xxxby4pTgEkfKpa6gYrgNRX9ogKHhBHVta4WlPR4xtPtmRPXn/7U73XlGfYCoAf8+o2K0L6OPz7AwJg3H/Mc6aEoLFpUawe0J79RuV76525WXuYLpYrQblwUNCOh0Rk3tuQpL/119WHv4yS3O/lNnBji53OQnS6Kj3UQfn6IypgzHOcvb2ZWQnFRpWavbnDM6XfmelJCXOIKq0fQuCsHScKOmtqbE1H41K2r89Yl9qQPvmh3hnqX+9MXn+GHMGI4TH+vgX2eEtLOXJ09sscUHEx5XOUJWHysGoy+mhltmas9OCOl3/E998O9rO9yub82PMLf0uFkB93kFM+qG44HGNF/dnCSoU7s9Lt4bc+UHUp6cdqwajL6EdS01OaI/eOY469t3nxR9PuFJGTX10W6Wj8+QGFXDIaUE0M5d0XnW+k73pg5HnutJjNG+KMVG12Ba2NjzwWnB2z89O/xLDdoANG3U7baPz6AYlUeflLLHaES++nLius1d3m/bbHnB8Wg0AISEnXFvyv0H7Fu2x727gaU918HH51hkxA1Hr8EyrdkW31vZ7n67MSXqj/chJDXY3O1Zrba8HPgN8DYg2MuI+vgcM4yo4eg1QM4B7m1Kyw++2OlFRvsijEznoTaoMyGkA5wA/AT4IlDR59r4+Ix5Rsxw/L4hBWAAbwF+AZz5SprhmzpcPSnIpNChS14GfBa4HZjSYgu+uTkx2s308cmLETEc5yzvoMrSw2khrwN+AMwAmBrROXPc8b88qQNXTQxy3bQgxpHW0gLeCdxZFdAXfn5jguWtzmg318dnQIbdcLz26U7Chla+KuZ+xRbcAtT0vBc1NL4wJ8yp48zBV6ONZSSUmxrXzwzx/UURaoJZL7cGXPTPg/Yvrq4PvursPzT50xafMc+wGo4LVnRQH9LKG5LiyxNC+g0lpnZU7vXicpO7TyrhqkkBwoZ2fBgQCRFD47xai7uXlnDz/Ah1wf4v9ZOt7ikr2pw73v+qstO1n+z3jYfPmGbYwgyvf6aTqREt+uAB58uTw/rH/rSsNNhrfn8Una7kvkabn+5KsabDJeUNdwuLTGacjwtonFppcs3kIBfWBai0Bu5AhyO58rkuHm92mFFirHltrfXedTH3hWfOqRjtXvn4ZGVYhuWtWxK80CmsZ9rsT+9JiC9+bGYo/J2F0bzcm4NpwWPNDvc12qxsd9mXEoieyraxZER6OQSllsacEoPzqi0uGW+xtNyk1MyvsRL4xZ40H30xTsKT6BrMiBj/vaQu8J7tCXfHg6eXj3ZPfXyOouhD8SMvdHLj3BL99c90XrM17t2edGXpdxZG+OSscEHHSQvJ1m7Bs+0uT7Q4rIm57E4IEp7kCC9+JIxJn/OFdI1JYZ1ZUZ1lFSbnVFssLjOoCeoFN+fxFof3v9DN9m5xqC+mBnNLjL9cNSn4walhvfXaqaER6KSPT/4UdUlDSon221bWd3WdtyfpfS3pSVUSOojBHdQ1FpYZLCwzuGZKkH0pwY64x/pOj7Uxl21xwYGUoDktSAiJK6CYYQFNU0uoYV2jOqgxKaQzM2qwoFT9zIoa1Id1FZcZJI81O1y/Pn6E0QBwJWxPiDf+p9nZ8+mZoS883+4ml1Ue/6tPPscORX1ev3ZFDFfI2eu7vN+12PJkACR8dk6Ym+dHinYyiYoLtNmCVluyJynYkxQcTAmaMq/FHElaSBwJXsagmErBK/OvRkCHgK5haRDQIWRolJka5abGuIDG1IjBlLBOVUCjOqBTbmlF6UNaSP683+amTUl2xL2cf4VKS+u+bHzg479aWvJzQPq1LT5jhaLdiQ812fx2T7r0v63OHftT4m09gxUJ59da/PXUUsrynPcPlZQnSQpwhcRD1YqAKjbTAV3T0FEehaH1/CgDMtzsSgh+uCPJz3eniTmy37+ABiwsM3Z+aW7kf66aGFjlGw6fsULR/N/X11jaFzcm3tmUFld6fWICz7e7PN7icPn4wIh0KmRohIzMyccIHY7k/gM2P9ihVo1kHs2TwM6EmL4z7n0RuFZK2e4bD5+xQFHyOKSUfH5jYv7BlPh4WhDs+36nI7llS5It3d5gDn9ME3PUtOStq7r433VxVre7BaWqdDuS3UlxkSO4llGqZvbx6UuxbsRQxNA+1u7IWVnf1WBlu8snNyTYmxyLqqHF50Ba8Ku9af5nVRfXrOnm4YMOSU8OygnalxLBtJAfBZb4iWE+Y4EhT1UyN/IFC8uM/xnolv7HAZuPAN9eEGFOyfEnvZEW8HKXy0NNDvftt1nX6WJ7HN7+aZBICbrGNOB64DopZcKfsviMJkMyHBmjUQVcf3qlWbGk3OCZVjfnIJHA/QdsmtKCr5wQ4fwaixGKlw4bnoQ9ScEzbQ4PHHBY3uqwLyVUZ4doMHqYEtYJ6RrAG4G/PN5s3z/a/fZ5ZTOk2zpjON4P/BAIPnDA5n0vxGlKif6PLKEmpPOeKUHeOzXI7Oix5X2khVoCXtPh8Z9mm+WtLjsSHk6Pd1FEgrrGL5eW8JZJKrAsJI90OOLqXzekO26Y+cqQMvEZewz6Ns8YjQnAfcBpoJ6+9+xNc+PGBAcHMh4ZTigxuHpSgCsmBplXYmCNwfCfI6HdFmzu9lgT81je6rA25tGQ9NRUZEhXsh8kLKs0+ftppT0CQOxLitSdu1Mf+sbWxC/EG2qGeAIfn8ExVMPxQZS+xqF1Vk/CAwdsvrgpwYZOb+AzZFz6yWGdc6stLqixOL3SHHJW5mAREuKepM2WbI17bOzyeCHmsibmsjchaHN6bUg7zM0L6Ro/PjHKtVODh061Nuby4RfjK84cZ17+7QXRVj/W4TMaDCrGkTEa1cDb6WU0QCVTvXFCgFlRg1u2Jrmv0Sbh9rOakHl9b0Jwz540v9+XZmJI56Ryk6UVJovKDE4oMai0NEpMjUiRjIktIOFJ4p6kOS3ZnfTYHvfY1i3YFvfYnvBoSUs63SyGYgTGqga8tT7AVZMCR5zuYFqytds7pdLSzr9xY+KPw98SnwLp+XMd18tfgxoCpz3Zwcqzy98M3APkrF7rdiV/O2Dz4x0pVnW4uCLPM/a65BFTo9zSmBDUmRLRmRDUqQ3q1AY1qgIapaZOqan0L/Q+9R62kKQ96HKVAYi5klZb0pxWaelNaUFDStBqC5KeMiSMdAFdDi6tC/DjxVGmhI+cu31ra5IvbExwQqnxt1sXRt92SV0gOXqt9EEJUy0CFgNTgCjqzkkCDcALmZ+m0W5oMSnY45BS8udGO5ry5NUhQ+u35LXE1HhHfZDzqi3+2mhz7940L8Rc0gMFEXu9l/AkCU/SmBSs6Tj8uqEfrjnpSSXv7bXLjA0QEjzAkxJPcrhEP8f5RjXZVIKlw5snBbl5XuQoo9HpSh5rcfAkHEzLs//YkF4spFypj73pylnANeTOE4qjAupbBzjOFcAlo9D+DuA2YG8/n5kEvBV4MzAfKCH73dMNbAR+B/yW/AxIFfAZlFc/0vwX5RD0S8GG4/vbkzzR6i4bH9Bee1aVldd3JoZ0PjI9xJsnBHik2eEP+2yebXdoTWce7/nc930+4x0qXivQIxxzYyyDhPEhnQ/PCPGh6SHGZSmc+W+Lw8o2tdzd4YhxOxPiMg1WjnbT+2AC1wLvGeBzu4DvDfCZU/M4znDQDPya7IZDQ6n0fw04k4GTKEsy/VgKXAx8HliVx3feBtSPQt8FeRiOgtcw6sO6tqXLu+jZdrdghZnxIZ13TQ7yh1NK+PtpZXx+bpjTxvUSvTmuZ4U5kFBmalw1KcDvl5Vw4+xwVqPRlBb8YEeKTkddJE+i7Ut5F/xkZ2qsLa1MQw2sgbgYGGgn7tGqUXDIfTe+Dvg5cDaFjR8TeC1wF5kNuQbAHaW+53XNC/Y4VnV445psce7L3R5CZTQWTImpceY4kzPHmdwwQ/Bip8cTLQ6rOlw2dnkcSIvDy5wwdr2EwZJZSaoL6rym2uTt9UHOrbYoyZENlxZw+44UT7Q4h66FBNpsuWBlu7tESvnvMbS68mpgah6fOwkVF3hqtBtcADOAbwIzh3CMJShv5RqgZbQ7NFgKMhxSSi5d2XWiLZi3ocuj3ZFUBYZ2w9YEdc6v0Tm/xiLuSfYkBC/EXFbHPF7qVII9TWml/OX1jU+MmbEy0IU7/GvU1JhbYvC6WovLJwRYUm70ZIVmxZFw1+4UP9qRwu3zDOz2ZKTZFucD/x7tLmaIoDyJfOaw44CLgBUcG76mAbwbNfD7w830p79rcAFwGWp/oWOSgj2Odke8KunJ0p78hvNr8otz5EPU0JhXajCv1OCt9Wo1pNVWS6Uvd3lsjwt2Jz12JQSNKUG3K0l6kBIy96030salTztChlr9mVdqsKzC5Owqi5MqDMYHB/Zy0wLu3JXiKy8n1BSlT19cgbY/KZa91OWVA7ER7mk25gJnFPD516HygMbaikO2u6YOuJzc05O9wN+A9aipzhzgysy/fQmgAr9/AHLtwjVaj8W8zluQ4eh2ZUBDe5WUELMlv99nc1aVRR5jYFCUmhqlpsa0iM6rM4HYlJDEXYi5ksaUoCEp2J8SHEyrn6a04GBaJXAlPUlSqFUZZ5hny4aupmAlhkZtUGdmVGdeqcGiMpOFpQaTwnpBQkZtjuS27Ulu256iK4fgj1QrRgufb3enoG7Y0URDGYLaAr6zABU4fDDH+w65B1Y2LLI/6QWQJj/Ppmcpta9/Ox8Vv8lGM/BR4IE+3/s3Ksg6Kct3FqKCn1uyvCcz/U7m2WYdCJJ90DuZn3zQADufDxZkODQYb2rMEJn//L0xzVsmBYrqdQxESNcIBaAqoDEjcqTFcgTYUmILiLuSFlvSYgtabEGbncnhyEgLdjoqt6PLzUgMCnCkxJXZtUsNDayMzGDE0KiwlCcxIaQzMaQf+ndSSOWZRA3lbQyG9Z0e/7c5wd8bbZyeYrkcpDwqyi1toZRy/SjHOcpRU49sj5Fu1I3d90aJoJZb/0n2oNwfgLV5nl+ilkffkuW9PcD/AW15HiuV+U5vJpM7mPtQ5qevsfkvagn201m+U0luw9GCqoTOtxipFvgy2Q3Ub1CeUD5owM58PliQ4Qga2vSpEX0KLeoUzWnJzVuTzC81DtVSjCaWDhYaUQMqLY36MKip6WGEVMlhQspMfgekPUlKQNKTpAXILEY+oGvKaBlKwNjSD8sNDiZAnI1OV4n+fHdbko35pOsDZaYWmBU1lgC/Z3RjBUtRAc++eMAvUUHTRVnePxeVOJXtht2U+cmXE3O83okyTgeG0L8w2f8iHvAI2Z/qAvgPyhvpK1UfILdhSFBY3Koe+DjZDccG4O9D6HdW8jYcmTTzBadVmtF796bp8TqeaHb45pYkN8+P5FwVGEvoGqh4bq+2jnK7XQkr2xxu25HioQOFCf5MDutMi+jzUDdhfJS6oKO8jWxL9C3Ar1BP8WyGYwZqaTOvJ90Q2jdU7Zl0jtcFcLCf7+WaJLvkOS3Is3+5GBZ5/ELdhPkX1lra3FLj0LPNA362O8XXtyTpco+F4PjYQUhY3eHy0RfjXPV8N3/ZZ5MU+RsNTYMl5QZlpjYDKBvFrtShchSysQp4CfXEzxbAtVDTlWJsHpPrBtQZerAxRvaBbgCz+vnePDhaThM1fWsuQp9BGa/++l50CjloGJg5I2rw3inBI8rfU0JllH755YSqHvXpF1eqKtcbNyZ403Nd3LEzxYF0fjIEvSm3tJ74Uh2FBSWLzRmoFZW+COBfKG9jTeYnG2cCs4vQjly6lMWQVNpDdsOno+IqdVneOxGV+Zrt3Ps4Oo4yWCRj2HBUAHUa8O4pIS6sDRzRVFvAj3akuO6F7lekKHE+JDzJ8laHD63r5rKVXdy6LcneROEGAwAJZ42zWFJugjLqkwZxlGLQ4zFkq1tqRAUIQQ26B8nuuo9H5TYMlVyGoxgex2ZUvCAbZwEf43CluI6K3fyM7HEfULGPjiL0GTJlWf30vegUctByMkU3VQGNr84Ls7DMOMJ4OBL+uN/mHau7efCAjfPK0CUekIak4J69ad62ups3PdfFXbvS7OsRbR7k7Rw2Nd45OUipqZEWMrSy3c0nW3M4mIYKfGbjOQ6vGkhUEHF/ls8ZqBjJUKdbw+lxdAJ/JHsQ1AQ+hMrbqEMVqN0DLMtxrPWoZdpiPWFHfKpSSOCkDLWEBMDScpPvLYpy3bo427uPXAF4vt3l3Wu6efvkIB+eHjouhYkHIuZIVnW4/KvJ4ZEmh03dxREuBkDC62stLqpTq5vb48K4ZWuyLiEkkWIt8eTPa1CrIn3xgIdR05QetgJPonRc+nIKKni6YghtGU6PQ6LU7q4mu6GsAG5GTUFOJffY2g18FlUxWyxGfKpSiOGooM86/GtrLH6wKMr16+Ns6208NGh1JD/YkeLRZof3TA1x9aQAk8bAku1wEvckW7o9Hm12+GeTw+oOl5jdqwK4GGNawpSIzqdmhQ8llD3V6vBsmzsupDaoG0k/LwxcSvb7qAFY3ue1NCpJ6kqODoZWoryOpxn8snJ/+cPFuPoHgFuAE8ge05hK/3U661FG4+EitKVvv8es4ajM1oiL6ywiRpRPvpRgTcfRCucbOj0+syHO7xrSvL0+yOUTLKZHjh8PpMuVbO72+G+Ly2MtNms6PA6mhUoiK9bt2ouoqfG52WFOy2xCnfQkDx100DRqV7d7AY58wg83C8jozWZhJbA9y+tPoeIFi/u83pN5+gMGv9ownB5HD0+jvIW6Ar7johLEvgS8WKR29O33mDUc0VyNeE21xT0nl/ClTQkeOGAfWYylqSSrVe1Kt/Onuw3eNCHApXUBFpUZx0TuR2+UiI5gQ5fHilaHFW0uL3Z6NPc2FjAslQaWBh+eEeLdU4KHks7WxjxWtLlEDMpXxdyR3tL+tWRfzXFRy6/Zli8bUSstJ2a5SvNRbv4/Btme4Yxx9PAqVLp4vhwEfgz8P6C1SG3oy9j1OJrSIloTzK01taDU4K4lJdyxK8WPd6Ro7Ktyrqm8hU2dHpu6kvx0V4qlFSavrw1w5jiTuaXGiG1KXQieVBmd2+IeL8Y8VrSpKciOhCqyY5iNRQ+WBh+YFuLG2eFDIs4pIbl7T4qWtGBaVA82pcVIzgUrUZWw2Xq9m9yxCoFaXXk/vWJmGUqA16MMy2D0KIbT4wijYjM3ouQC82U5SrCov+S8bHUmWqY/NgNP3cau4bi3IV37jvqgXttPRVtVQLnRZ44zuX1HikeanKOFijO/t9iSRw6qwGFtUOeEEoNXjTM5rdJkYZnBhKB+lI7ocONJNRjbbMmOuMembo+1MY91MZedCXHYq+jVj2GvYZQQNuBDM0J8cU6Eil4iP/886PCX/XZPM4wRaE1vlpI7xXsFynjkYh3wPGpq0pfzUEvL/X2/n6uVlaF6HJUog/EhlOddCK8D3gXcSXbDthRVZ1KSpc0vomIiafpnIMOhUeRyhLwNx0MHHX121OCyAXacNzQ1dVlaYfLgAZuf7U7zTJtLKlsadeb/TWlBU0rwZItDyNAYH9KYHjFYVGYwt8RgWkRnWsSgKqDqRYIGBLTBGZWeQri0p4KZB9OCPQnBrqRge9xjc7fHnoQqjGvPthXCSA5NCXUhnU/NCnHd9BDRXkVz2+IeX9+SpMOWPdNBGfdGLPlOR+VuZFs+TaOCf/1VZHaigqQXcPQTsScFfTCGo2eu3/evNBSPoxK1WvJeBpe+XYaKbexGxTl6EwA+ALwhx3e3kp/nJRjhPI68L8TBtLAfOODw+rpAXqUdZabG2+qDXFgb4OEmJVT8dJt7SPoulxFJCcmuuGRXXPB4s1K8KsmU15ebGnUhnbqgRpWlUxXQKLNUKXuJqR3RLg9whTpetyuJe9DhqCrZNlsZjGZbEHeh25Mk+6bLj4ah6CGjrPaqKpMvzInwulqL3oW2bbbkpk1J1vYKRnsS1xUjVuQ2ETg/x3s7UQHEgfgPKnNyWp/Xgyij9CcGftL2JZfhGKzHEUZ5Gv0ZjRZUwPfUzHXJxgTUakwjR1b7LiC30WhGCRznk+sxdqcqpkb838223NAV1BaX5W94qwIab68Pctn4AM+0udzXaPNYi8OuuHc4QSyHEemh25V0O5JG4OWuo6+jnlE813p9USJ79CoQ/V3W0TQQfcm0cWpU592Tg7xvWoj6PkvYcU/yrW1J/rw/fUSXBHRPCGkjpVOZK8Uc4AnyS6XeDDxGdjHiM1H1HxvyOE5vih3jeBNwHbnHyUvAF1BG8ApULCNX/GMR8K1Mfxsyr12Eyprti4fSNc3HAMNYNhwBXduzJ+m59+61rYXzTQqVmigzNS6stTi/xmJvUvB4i8M/Dtisjrk0JMVhWcABNm7KhpBgD6R4PhYMQy4yzR4f0nnDhAD/Oy3I4jLzqKlYypN8d1uKH25P0bckKOnJfcsqzZFYig2gcjeyFW45KKOxkPz28NuMcsX73oeTULGOQg1HrgE0GI9jMvAJjo499LAWZVSezfz/d6j4x80cHfTt4Xzgq6gS+HJUPku2dq1AbR+Rb/Xs2F2OnR4x9u+IC/c3DWnryokBTq8c3MqfqcH0iM70KUHeXh9kR1ztxfpYi8MLMY/dCXGkFOBYHvBDJeNUT4noXFwX4JopQU4uN7Pun9vlSm7ZmuT27SlVQdsLS4fqgN68LuaORPLXdFQMIhsmKt36E3key6SvYIqiJ4byC1QVab7kGkCD8Tgu5+hckx52ATdw2GiA8hLuRhmPr5Ld4OjAO1Bp92Vk1y9NAneQPTU/F2M3OPrxmaFYY0p0PdnihL+7LcnPTyoZ8vJpUOeQxui1U0M0JAWbulye7/BY1eGyucujISWUPsXxYkgyxqLM1FhcbnJxncWldQHmlRo5vbiDacHXNif52e4U6SymIaRr4txqs/VjM8JcP/w9OI/c+31oqAzjYnAyyr1/poDvFCuPowS11JxtfLiovIzlWd5zUPkapcDnyC4VEOCwIlg2o7kJeLzAazV2pyqnVZqxyycEmp9td2ofPODw891pPjYjVPCUJRdWjycSCXBxnRLqbUh6bI0L1sVcNnR57Ih77E4q6b+UJ4+W+BuLRiXTRkOHSktnQanB2VUm59VYLC4zGTeASvyGLo8vbkrwQKOdPUomoT6kpy4dH9g1AtKB/Q2oYlMNXEjhhiOXx1EItSgdjWw0oVZHcg3UFPAdlOdxPX32Vs4QzPHdNCq2Uah489idqgAdb54YaL6/0ea/zQ63bk0yp0TnkrpAAYfIn6AOM6MGM6MGF9VaCAntjtIM3ZUQbOry2JXwaEwJ9qWUYHGrrfRD7VyXcTjHVZ/zBQyosHRmZ0SLT64wWVZhMiOqNtAeCEfAPw7afOXlBOtiuWUEdQ1eV2slLqix9g540KEzn9wp5sPBhcCPyH//kWLlcZSTO07RRP+KX6CSvb6BUmX7IPmPs3+gYiWFTjlHvKy+EMPRNSWs7/7YzBBrYy4HUoLPbEgwztJ51bjhfwDpmlqhqQqo3esvqlX1drZQmZ2drlI835sUHEgppfOmzJJrU1qJFic9JUjsCCWm4wglTlzw7C+zV62pKy3SoK4EjCeGdKZFdGZGDeaXGiwoNZkc1hkX0Aq6a3cmPH68M8Uvdqdps/tRBJMwOapz9aRgU8TQBrqZh4qGGsgjuZ/pIlTVbL5FYcWKcVj0e9XzIsbhxK53MvAAPgB8F2gf5LUaiTqdQxQy4iWw+ZI6i/dPC/H9jKDuR9fHuWNxlFMqRrpMQhHQoTqgUR0wmNGneM6VaiUiJSQpT+VrxDLq5j0q5zFHbZ9gS4ntKU0RL4vMuaFphA2lsh42lGhxmalRFdAZZ2lUB3XKTY0SE4KDTHeNOUqs+Ec7k6yLeeoO7edQmgZXTwxySoW5A5VUNZz0bKCUrUVp8pfgz9oV1NO577GjqCDpI+T3FO7P1yzkj5Ikd/5EBdlFi7LRisr8DKFWUPobJLsYeBPugfqejdH1ODRNQ0r5UlDX7E/NDAU2dXk8dMBmdbvL/66Lc9vCKGdVjY7xyNm5TPJYyZgMfhwm7kmebHH4ya40/25ysmfZ9kXCnFKDa5WM4yYK239kMJxC9uIuG7Ut4vMM/skWROVDnJzlvXNRwdh8ckP6C44WMoC6Uepc2aYrFaiktYY8j3UQ+CkqqNxfjcti4COo5dzBLKuPTcORYSvQOD6kT/32gggxR7Ci1WV1u8t71nbztXkRrpyYX2apj0pse7zF4Zd70jza4ijtjjyfjRFT45OzQswtNWzgBYZ3awQDVXyWLcV8F0rFfDAp4r05EVW30bf3s1HSfL/N4xjFyuNoz/Rnepb3ylGJYc+RX57FKcBXgKoBPhdGLWN3A7dRuAc3ZqUDQVnZ7QDzSw1uXxTl5Ew+x9Zujw+t6+abW5JqXu6Tk/0pwa8zUoLvXN3NX/fbxJw8vIwMGvCW+gBvqw8CtKcFw70Z00Rya4I+g1K9GipPkn26FUBNV4J5HKNYqwud5N4ISkeloL+H/h+8Zqbdd5P/zvYlwOdRe9QWIlozpjVHQVnDQ8tjJ1eY3LWkhFdXW6CpGoqvb05wzdpunm5zEb79OETCkzzX7vLVlxNc9mwX73uhmwcabWJu/gYDAKmKCL80J0JY13iyxdl/w/p4sWT2c3EW2Xdod1Dp1sVIdV8PvFzg+fvSXxykkHtdoAKyXTneL0dNzz6BynLtPciDqCnXt1EJbIsojArg68BVFHZnjNngaA9PoebTEYCTyg3uOinKjRszWxYKeLDR5oWYy3unBHn3lBDTIsNi9MY8CU+yMyF4qtXhHwcdnm13aVJbxQ0uCVrCSRUm310YYVpEZ1WHy81bk+v+tTmV73LlYOh54mdLZtrDkdmTQ6EN5XVkW+7tSUEfSKezv+BooTfhSlQtzeU53q8EvobKBH0eZfQqUbKCp5G74I1MG7ei0tqzBVprgVtRD+oHyY+xG+PIBEjXoZSrl/S8PjtqcOfiEuaVJPnRzhQdtqQhobId/9po8+4pQa6aGGRy+Pg3IDFHif482ery72aHlzpd9qcytThDKaiTsLDc4EcnRjmp3KQ5Lbh5S9Le0OU9EqwLuIWWkRbATNQTPxvPoWIcxUCgMiav4+h07Z4Yy6/I7QX0HCMXhd58ncD3UTGKXFtPBFAeRaFexUvA+1Cxkk+QPUlscub8CZQBy+f6FaPfeTEYj+Mgaq+MJb1frApo3DQ3wsIyg1u3plgTU1OV9TGPz25IcO9emysnBrhsfIB5JUbWeoxjkbgn2Z8UrImpNPnn2l1e7vaOFv0ZirMo4eRKk9sWRjljnIkj4Ac7UjzR6uycV2o83XB2xXB2MVeKuYfa33Qoy7B9WQtsI3sNx6moMvSV/V+pomZQLkd5FbdQvFT6nagVpOdQRX4VKDW0bDGNWcDtqJjKcwP0e8wbjp7dud5LnyeDpcPVk4KcXGFy2/YUv21I026rJKu1HS5rYy4/3ZXi3BqLi2pVoVx9WD+mVmE6XaXlsbHTY3XMZW2Hx0tdLo0pSbq3kE6RVC414Nwai+8sjHBSuYmQ8Mu9aX60M0W5pT16UXVw71D2ExiAKKoSNttNvZfC0sHzoRk1FV6S5b1xKDWtZ8ltHIo5Vek53t2ZY97E0Da9kqjB/3kO16LEUCI/JcDbcrRxIapS9n2oOFB/bc3G2DAcmenKs6inQ9YqyVlRg+8ujHJxXYAf7kjyeItDOpNOsych+NXuNL9vsJkW0TljnKrbOKXCZEpYyQWOFWwBLbbKSN3QpSQEN3UrlbCmdB/xn2IrmksIGWrTpS/ODTMlrKuNPRptbtqUICXoPiGk/21n0hvOitglwOk53lsN7Cjy+TyUW/4Bjnbfeypmf0JuFXRJdiNnUNgqRW8c4C7U9PwzqH1k8k0A62E/aoOmn3L05totqIK4EuCNOb5/Kqqw7v0oL6UQ+suCHTSDzdhq73bl/WFDO9PQslu0oK62Tji90uS+Rpu796RY1XF4U6K0kGzu8tjc5XFvQ5rxQZ0Ty0xOrTQ5vdJkdonB+KB2SJh3OJFApyNpslW6+ta4qoXZFvfYmRDsSXh0uZIjitaHYeuD3g2aEVV7p7xzcpASU0MCf2+0+eRLcQ6kBOND+qolZdbzdywpVAKzIKaSe6XjTxRvt/XePIcKCGYLLnZlXs9lONpQXlCkz+tphpZZK1ECRS+i0u6vQsU+xtNnr6FeJFCKX4+jCteeJ3c26j7gk6iM1Z7ckd5ygE6mDZeg8kv6JohJVFVttmncywxDjs+gbn0pJbdsSS4+s8p86Kwqa2I+BzmYFjx00OHXe9M81+4S73la9/5yZrUhYmhMDuvMiOrMLzWYX2oyI6JTG9SpDmiUWxpmRnN0oHMLUEpgUq1yxBxJW0ZCsCEl2BH32BEX7EkKGlKCgymlB+L1NRIjgVSJXZeNt/jkrDDLMmn8noQ/7U/z6ZcSNCQFloE3t8T4yEuNyTt4+8QhnrRfguQeGP2lZQ8FDbWCk8tDSJF7+dfIfLfvX0xmvles9oZQ8Yc5KI3U8ahSeoHyIPagPIvdqOBxvnGg3tfbI/v0I5fqeYjcMgBFF3ga9JCI3t8SvGJS8Ccfnxm69qTy/B2XNlvydJvDn/crCcF9SaHyPbL9qXsaqamNiKosjXEBncqARnVAoyagU2YqvdHenokjJEkhibtk6lFU5WwsU6PS4ajfU57kKOGwUdIYNXU4rdLkuukhLh8fOLTfTMKT3Lkrzc1bEjSnVc5HpaWtP63SvOT2RaV755YeJ1HmY5+eO+cVkb00+GFy135OnxM5a0bU+MvXTgjXzogWNoV0BGzu9ni0xeGxZofnO1TF7VHbD/RmIN3QfD47tF4XF6nK70+uMHlHfZArJwao67X9xL6U4Ftbk/xsd1rFUzSwdLy5UeNzvz+57DsLK46fHfF8ji2GNITu3Jm07tmb/t7EkP6R7y6MDjpPI+FJNnV5PN7i8Eyby+qYy/6kyC1mfCyTMWhllsaZ40yumhTk4jrrCIMhJDze4vDVzUlWtDpH+KuTQvraC2oCb6gL6g23LowUdm4fnyIxpCF5yTMxrpgYXHTXrtR99WF95m0Lo0waYpJX0pPsTgqebXd5ts1lVYfL9oSn6l+OVfnATLutjDjR+TUWl45XO9iV9lmLbkwJ7t6T5ic7U+xLHrkbXoWlpS+osT72p2WlPx0BtS8fn5wM+e6TUmq/3pv+1Pe2p745Oayb318YYWaB05ZcCAltjlp9WRVzWdXusr7TY19K0GqLI6UDx9I46tWusKkCvadVmpxfbXF2tcnU8NH6oklP8kizw/e2pVjR5hyZaYrSAXldrfXgh6eH3vly3O24fobvbfiMHkMebq6QGBoT/rjP/sPnNyXOnhTSuW2RSlYqNraAmCPYFld5FS9ktEj3JQVNtlAVpiNtTPqcL2JoTMgogZ1WqeQCl5SbTAzpBLI4Y46AZ9odfrorzT8O2od2ZuuNDlwxMdD8iZnht57x345HuaKQrUt9fIpPUYbWj3cm+dC00KV/3Gff8/GX4pXVAY1b5ke4sDYwrHu/isxer01pya6E2utV5V8I9ic9mjK7ttkiy+rJEK+anjES1QGNuqCSC1xYarC43GRuic6EUP/JbLaAtTGXe/am+ct+m4N9N+nOoANvmhjwbpwdvvXkCvPLgONPU3xGm6LcgVLNGQKe5Na/N9ofveGluJ7y4OMzQ7xvapCa4MgtGUrUU7zNOaw9ui8l2J3w2JPRI+12JUkBtpBZS/91DSxdI9Dzb0ZTtNzUqA4qQzElrDMprFMbUEai1NTyUnzvdiXPdbjcuzfNPw86HMhhMHr+OFdODPCNeZGn55QYb5GwV/eNhs8YoGh3YcZ4TJbwm4ebnLM/+VKcLV0e59ZYfGJmmPNrrKyu+kjSY1SSGR1SR2TPsOkRIrY0DUtXWzcE9PwSzrIhJOxNCh5tcfjrfptn2pz+RYhRm3e/tT7IN+ZFmqaE9WuE5GFjON03H58CKOqdmDEe5wG/Xt3hTvzcxgT/aXKoDGhcOTHA+6eGWFphHlNFbUOh2Zas7nB5+KDNv5sdtnZn9svtr/+Z7NEPTAvyhTlhpzqgfwP4hqaN2L6wPj4DMhyGQ0cVKX27ISlKbt2W5O7daeKOZGJE500TAry1PsjJFQah4+wJKiQ02YJ1MY8nWx0ebXbY2OXR5WRJr896AWFCSOezc8J8YGqQsKH9Fvgo0ObHNXzGEkW/GzPGI4ySP7s+5Unjj/ttvrMtyfqYKhWoCemcX23x5okBzqoyj0h+OtbodlUMZU2Hy1NtLk+3uWyPF2AsenFqpcn/nRDhtTUWmsYzmtqPY7tvNHzGGsNyR2aMRxVKhORtgLa52+OHO1L8fl+a1rQaVGFTY1GpwWtrLc6ttlhUZlA7xo1IzJEcSAu2dHs835HJLelSwj090gGFaoiWWRrvmBzkU7PCTIvo7E6IXZ2ueNeJZeZy32j4jEWG7a7MGI+pqJ23LwQ0W8CTrQ4/3ZXikSZH5V1kWlFqapxQYnBKhcmrxqnch0lhnUqrsF3QikmXq3aD259SZfYvdqrl3q1xj+bM/rWDzmaVavVmWaXJJ2aGuXyChY7GYy1O2+Mtzg3fumnXvfLP86VvOHzGIsNtOECVH98BnN/zQtyTPNXq8puGNI80OSqHoRemDjVBnRkRnRNKDRaXmcwtMRgf0qkNaoyzdEx96NJGErXbW7crabMFzbakISnYHle5IDsSHnsSgsa0IOX1KrUf6lWTMDWic+3UEO+ZorRYW23Jr/amuh466Hzu0fWpO9+9IOj9cnglAX18Bs2wPs56GY95KPmz83u/nxbwQszlj/tUTsO2hIfT293vcUgyy6FVmWSr2qDap7U6oFNhqbL6qKERMVS+RTCHupArJUlP5Xg0ppSR2J8StNhKn6PZFnS5Eq+vcmWxrpKE2pDOFRMCfGBa8FB27eoOl9t3pGKrO9ybtnaJn9RHDGfn6yqG80/j4zMkht0P7uN53A5cfNRngN0JwdNtDvc12qxoU9sIZH3C903Y0o78VdNU/kXfBRuJ2hPW65270c+xincBVJsmhnQuHR/gXZODLKswsXQVL/ndvjS/2JNubk6LL0wKa7+IpTV3/QUVw/K38PEpFiM2gc4YkCmo1Za3kkO2MOlJtsUFK1od/tXs8Hy7y8G0OCzbdyxM+TMGKWhozCs1eNOEAG8Yb7GgVBkMV8LTbQ7f357iuXZ32+SwfuMPFkf/+vEXu8XT51QO7dw+PiPAiA7DjPEYB3xWwHW6klvLSc+GRk+3uSxvdVjV4bI3oVLGR6cH/XVO/WPoMCmkc8Y4i8vGW7y62mJS6PDEaVOXx527Uvxxv40j5PMLy8xPPn5m2fIbXopz+6KSQZ7cx2dkGfFhJ6Uk4cnQupj3fk9y04Iyo7rSGrgZjlC6pes6XVa2uazucNkSFzSnBZ3u6FbFllqqIvbkCpNXV5mcXWUxI6ofSnCTqL11/7DP5t69afYkPbcupP9lbtS46ZGNiS3fObeCT80qVDjbx2f0GJXntSMk1p2N5gUnRi+dXWJ86dVV5tLzqq2CiuHinqTVlmzp9lgbUzodW7o9DqQELY5UYsi5dtjojwEqaDWl+UlNUGdOZvn41EqThaUGNUGd3l1IC8mLnR5/2mfzt0ab7XGPkKG1zIzqt79hQuD/PdbktN04O8QbJobw8TmWGDVH/9KVncyMaDzc5M60dD5bH9LfcnFdoPSiOouZEaPgcnxHqKlNY1qwOyHYm1QVsbuT6vd2R9Ltqp90piq2x0bomlraNTRVCRvQVVVsMFMVW2oqj2JmRJXPT4voTIsY1AS1o9LmJdCQFDzT5nL/ASXI3JgU6BqyOqivnB7Rv/G3ZSX//MLmpLj7pNLCOunjM0YY1QjBOU910pj0uKDGDD3a4l7W5crPVFraKa+psrh4vMXJFSodfSiN9KQqn+92JR0ZlfOUUEuzPQs+hga6pmFqaj+YoK6WdMO6UlcP6sqo5CrO8yQcSAtejHk83KSMxdZuoXZ206DE1JprgvrP5kb1Hz+8Pbnvo4tL+OGJfjzD59hl1EOLUkres6abX+xIcuXU0ORn2933tdry3YbGlDlRg7OqTM6qsjixzGBKWB+RDZoGQkg1VdqVEKyNufy3Ram0b48LEr32iwkbWrzS0v45Oaz/6OdLS5766Lq4d2qFxbd8kWGfY5zRH4UZ3vp8FwlP8rfTSrXTnoydtDsh3t9qiytcSa2lQ31IZ26JwbJKkxPLTKZHdCaHlYBOQM9PRGcwOEKpjLU5kt0Jj5e7PdbFPF6MuezOJJD1zjfRgJChpSstbfnUiH7XKZXmQw802t03zApz/fQQfgq5z/HAmLuLr9/QzQP7Hc6uMq2Vbe7p7Y54R6fDJSkhJ/UEJQIGjLN0qgIaUyMG0yNK43NCSCly1QQ1yjIGxeonNV2gJPxSQpL2VIxEbeCkpjX7kmqnt+0Jj8aUSkvvcGRWkWQdCBlavNzSnpoS1n89r9T4x1/22x1XTArwKz+W4XOcMeYMRw9nLu9gS7fHOyYHzYcOOItabXlFSshL00LOcwTBbKsflg5hQ+3qFtBV7MLsJzbhSBXr8DJbRLpCrYTYmbiI6CsPluU4GVnBhgpLe3xqxPjz7Kj+xIMHnM4zq0z+cmrZaF9GH59hYcwajh5e/VQH2+OChguf4pQnzpnQ5ohXdzjy9SmPM1wpp9oiy96mgxUlzvNqBFQA9WCJqa2psLR/zY7qj15dH9zy9c1Je3ZU5++nlflTEp/jmmPm7j5neSfNtkeXC5fWBaw1Mbu+xZanJ1zOTgq51BZM9aSsdYSamRRR0BxDBTq7TJ09tQF9o6nxxLSI8Vx9SN9457Z44uzxQWZGDX651J+S+LwyOGYMRw/jH9jH1LIoaaG2PvjdyaXGDRsSEUtjzr6kNytsaEsTnlzQbMvagMYENCpTHkFbSKOnv7n2t5YgLA0R0LUEcCBssH9CSN8LPDcxpG8aH9I3XjUx2HrpEx326yar2dIZ5QG+utDP+vR5ZXHMGY7enL68i1Jd0JiWVFoaqztc4peO47MbEta6Lq+kxNDqW21RtS3uhbtdWV1uaVODulZqaRi9Ku/TmqZ1t9ui5UBatpQYxKdFjXh9SG8I6TT+YVmpo922z3v96aWMD+lIqXFulck1U/1sT59XLse04ejLHTuSbOwSrIo5TI4YmEBTWvByt8fedhfWxeHmBmAb8CJQAcZ58I4aOKMcakyqQio7dGZER5OSoKlzTrXFtVN8Q+Hj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PzSuP/AzE1e5ONHe7vAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEyLTIzVDIwOjA0OjMxKzAwOjAwHarZDQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMi0yM1QyMDowNDozMSswMDowMGz3YbEAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOS4yLTcgUTE2IHg4Nl82NCAyMDE1LTEyLTAyIGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnbo4WPwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vdG1wL3ZpZ25ldHRlL2MxZDQ0ZGY2LWM1ZDYtNDkwMC04ZDBhLWQ0OWVmMzBiZGE3MS5zdmd90CehAAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAGHRFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 89px;'/></span>\").width(\"120px\").css(\"float\",\"left\").css(\"padding-left\",\"0\");$('.report-name').css(\"font-weight\",\"bold\");"+"\n"+
+//                    "$('.logo-content' ).remove();"+"\n"+
+//                    "$('#slide-out li:first-child').on('click', function(){ $('#charts-row').hide() }) ; $('#slide-out li:last-child').on('click', function(){ $('#charts-row').show() });"+"\n"+
+//                    "$('.charts div:nth-child(2)').remove();"+"\n"+
+					"})";
+
+	public enum suiteNameXml {
+		
+		TESTNG_FAILED_XML_NAME("testng-failed.xml");
+		
+		suiteNameXml(String value) {
+		        this.value = value;
+		    }
+		
+		private String value;
+		
+	    public String getValue() {
+	        return value;
+	    }
+		
+	}
+    
+    public synchronized static ExtentReports setReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception {
+    	String dbIp = DriverFactory.getConfig().getReportDBhost();
+    	int dbPort = DriverFactory.getConfig().getReportDBport();
+
+    	if (extent == null) {
+        	extentxReporter = new ExtentXReporter(dbIp, dbPort);
+    		extent = new ExtentReports();
+    		initAndSetExtentHtmlReporter(filePath, htmlFile, isAppend);
+			
+    		if(extentxReporter.config().getReportObjectId() != null){
+				setExtentXReporter(isAppend);
+			}else{
+				extentxReporter.stop();
+			}
+        }
+        return extent;
+    }
+    
+    public synchronized static void setExtentXReporter(Boolean isAppend){
+    	extentxReporter.setAppendExisting(isAppend);
+		extent.attachReporter(extentxReporter);
+    }
+    
+    public synchronized static void initAndSetExtentHtmlReporter(String filePath, String htmlFile, Boolean isAppend) throws Exception{
+    	htmlReporter = new ExtentHtmlReporter(filePath + htmlFile);
+    	setConfiguration(htmlReporter);
+		htmlReporter.setAppendExisting(isAppend);
+		extent.attachReporter(htmlReporter);
+    }
+
+    public synchronized static ExtentReports getReporter() {
+        return extent;
+    }
+
+	public static void initReporter(String filepath, String htmlFile, ITestContext context) throws Exception {
+		
+		String onboardVersion = AutomationUtils.getOnboardVersion();
+		String osVersion = AutomationUtils.getOSVersion();
+		Config config = Utils.getConfig();
+		String envData = config.getUrl();
+		String suiteName = getSuiteName(context);
+		
+		if(suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())){
+			if (config.getUseBrowserMobProxy())
+			    setTrafficCaptue(config);
+			
+			setReporter(filepath, htmlFile, true);
+			String suiteNameFromVersionInfoFile = FileHandling.getKeyByValueFromPropertyFormatFile(filepath + VERSIONS_INFO_FILE_NAME, "suiteName");
+			reporterDataDefinition(onboardVersion, osVersion, envData, suiteNameFromVersionInfoFile);
+		}else{
+			FileHandling.deleteDirectory(SetupCDTest.getReportFolder());
+			FileHandling.createDirectory(filepath);
+			setReporter(filepath, htmlFile, false);
+			reporterDataDefinition(onboardVersion, osVersion, envData, suiteName);
+			AutomationUtils.createVersionsInfoFile(filepath + VERSIONS_INFO_FILE_NAME, onboardVersion, osVersion, envData, suiteName);
+		}
+		
+	}
+
+	public static void reporterDataDefinition(String onboardVersion, String osVersion, String envData, String suiteNameFromVersionInfoFile) throws Exception {
+		extent.setSystemInfo("Onboard Version", onboardVersion);
+		extent.setSystemInfo("OS Version", osVersion);
+		extent.setSystemInfo("Host Name Address", RestCDUtils.getExecutionHostAddress());
+		extent.setSystemInfo("ExecutedOn", envData);
+		extent.setSystemInfo("SuiteName", suiteNameFromVersionInfoFile);
+	}
+
+	public static  String getSuiteName(ITestContext context) {
+		String suitePath = context.getSuite().getXmlSuite().getFileName();
+		if(suitePath != null){
+			File file = new File(suitePath);
+			String suiteName = file.getName();
+			return suiteName;
+		}
+		return null;
+	}
+	
+	public synchronized static ExtentHtmlReporter setConfiguration(ExtentHtmlReporter htmlReporter) throws Exception {
+		
+    	htmlReporter.config().setTheme(Theme.STANDARD);
+    	htmlReporter.config().setEncoding("UTF-8");
+    	htmlReporter.config().setProtocol(Protocol.HTTPS);
+    	htmlReporter.config().setDocumentTitle("SDC Automation Report");
+    	htmlReporter.config().setChartVisibilityOnOpen(true);
+//    	htmlReporter.config().setReportName(AutomationUtils.getATTVersion());
+    	htmlReporter.config().setReportName("SDC Automation Report");
+    	htmlReporter.config().setChartVisibilityOnOpen(false);
+    	htmlReporter.config().setJS(icon);
+    	return htmlReporter;
+    }
+	
+	public static void closeReporter(){
+		extent.flush();
+	}
+	
+	public static void setTrafficCaptue(Config config) {
+		boolean mobProxyStatus = config.getUseBrowserMobProxy();
+		if (mobProxyStatus){
+			config.setCaptureTraffic(true);;
+		}
+	}	
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
new file mode 100644
index 0000000..0523647
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestActions.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.aventstack.extentreports.MediaEntityBuilder;
+import com.aventstack.extentreports.Status;
+import com.aventstack.extentreports.markuputils.ExtentColor;
+import com.aventstack.extentreports.markuputils.Markup;
+import com.aventstack.extentreports.markuputils.MarkupHelper;
+
+public class ExtentTestActions {
+	
+	public static void log(Status logStatus, Markup mark){
+		ExtentTest test = ExtentTestManager.getTest();
+		test.log(logStatus, mark);
+	}
+
+	public static void log(Status logStatus, String message){
+		ExtentTest test = ExtentTestManager.getTest();
+		test.log(logStatus, message);
+	}
+	
+	public static void log(Status logStatus, String message, String duration){
+		log(logStatus, message + addDurationTag(duration));
+	}
+	
+	public static void log(Status logStatus, Throwable throwabel){
+		ExtentTest test = ExtentTestManager.getTest();
+		test.log(logStatus, throwabel);
+	}
+	
+	public static void addTag(Status logStatus, String message){
+		Markup m = null;
+		switch(logStatus){
+		case PASS:
+			m = MarkupHelper.createLabel(message, ExtentColor.GREEN);
+			break;
+		case FAIL:
+			m = MarkupHelper.createLabel(message, ExtentColor.RED);
+			break;
+		case SKIP:
+			m = MarkupHelper.createLabel(message, ExtentColor.BLUE);
+			break;
+		case FATAL:
+			m = MarkupHelper.createLabel(message, ExtentColor.BROWN);
+			break;
+		default:
+			break;
+		}
+		
+		if (m != null){
+			log(logStatus, m);
+		}
+	}
+	
+	public static String addScreenshot(Status logStatus, String screenshotName, String message) throws IOException{
+		String imageFilePath = null;
+		String uuid = UUID.randomUUID().toString();
+		String[] stringArray = uuid.split("-");
+		screenshotName = screenshotName + "-" + stringArray[stringArray.length - 1];
+		try {
+			File imageFile = GeneralUIUtils.takeScreenshot(screenshotName, SetupCDTest.getScreenshotFolder());
+			imageFilePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFile.toURI()).getPath();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+		ExtentTest test = ExtentTestManager.getTest();
+		test.log(logStatus, message, MediaEntityBuilder.createScreenCaptureFromPath(imageFilePath).build());
+		return imageFilePath;
+	}
+	
+	private static String addDurationTag(String duration){
+		return "<td width=\"80px\">" + duration + "</td>";
+	}
+	
+	public static String addLinkTag(String fileName, String pathToFile){
+		return String.format("<a download=\"%s\" href=\"%s\">HAR file</a>", fileName, pathToFile);
+	}
+
+	public static void addFileToReportAsLink(File harFile, String pathToFileFromReportDirectory, String message) {
+		log(Status.INFO, message, addLinkTag(harFile.getName(), pathToFileFromReportDirectory));
+	}
+	
+	
+	
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
new file mode 100644
index 0000000..b5ed1ea
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ExtentTestManager.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.util.HashMap;
+
+import com.aventstack.extentreports.ExtentReports;
+import com.aventstack.extentreports.ExtentTest;
+
+public class ExtentTestManager {
+
+		private static HashMap<Long, ExtentTest> extentTestMap = new HashMap<Long, ExtentTest>();
+		private static ExtentReports extent = ExtentManager.getReporter();
+
+	    public static synchronized ExtentTest getTest() {
+	        return extentTestMap.get(Thread.currentThread().getId());
+	    }
+
+	    public static synchronized void endTest() {
+//	        extent.endTest(extentTestMap.get(Thread.currentThread().getId()));
+	    	extent.flush();
+	    }
+
+	    public static synchronized ExtentTest startTest(String testName) {
+	        return startTest(testName, "");
+	    }
+
+	    public static synchronized ExtentTest startTest(String testName, String desc) {
+	        ExtentTest test = extent.createTest(testName, desc);
+	        extentTestMap.put(Thread.currentThread().getId(), test);
+
+	        return test;
+	    }
+	    
+	    public static synchronized <T> void assignCategory(Class<T> clazz){
+			String[] parts = clazz.getName().split("\\.");
+			String lastOne1 = parts[parts.length-1];
+			String lastOne2 = parts[parts.length-2];
+			getTest().assignCategory(lastOne2 + "-" + lastOne1);
+	    }
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
new file mode 100644
index 0000000..78cf270
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/MobProxy.java
@@ -0,0 +1,103 @@
+package org.openecomp.sdc.ci.tests.execute.setup;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.slf4j.LoggerFactory;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.github.markusbernhardt.proxy.ProxySearch;
+import com.github.markusbernhardt.proxy.ProxySearch.Strategy;
+import com.github.markusbernhardt.proxy.util.PlatformUtil;
+import com.github.markusbernhardt.proxy.util.PlatformUtil.Platform;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import net.lightbody.bmp.BrowserMobProxyServer;
+
+public class MobProxy {
+	
+	private static HashMap<Long, BrowserMobProxyServer> mobProxyServerMap = new HashMap<Long, BrowserMobProxyServer>();
+	public static InetSocketAddress localProxyAddress = getProxy();	
+	
+	public static InetSocketAddress getProxy(){		
+		setLogger();
+	    
+		ProxySearch proxySearch = new ProxySearch(); 
+//		proxySearch.addStrategy(Strategy.JAVA); 
+//		proxySearch.addStrategy(Strategy.BROWSER);
+//		proxySearch.addStrategy(Strategy.OS_DEFAULT);
+//		proxySearch.addStrategy(Strategy.ENV_VAR);
+		if (PlatformUtil.getCurrentPlattform() == Platform.WIN) {
+		    proxySearch.addStrategy(Strategy.IE);
+		    proxySearch.addStrategy(Strategy.FIREFOX);
+		    proxySearch.addStrategy(Strategy.JAVA);
+		} else if (PlatformUtil.getCurrentPlattform() == Platform.LINUX) {
+		    proxySearch.addStrategy(Strategy.GNOME);
+		    proxySearch.addStrategy(Strategy.KDE);
+		    proxySearch.addStrategy(Strategy.FIREFOX);
+		    proxySearch.addStrategy(Strategy.ENV_VAR);
+		    return null;
+		} else {
+		    proxySearch.addStrategy(Strategy.OS_DEFAULT);
+		}
+		ProxySelector proxySelector = proxySearch.getProxySelector(); 
+
+		ProxySelector.setDefault(proxySelector); 
+		URI home = URI.create("http://www.google.com"); 
+		System.out.println("ProxySelector: " + proxySelector); 
+		System.out.println("URI: " + home); 
+		List<Proxy> proxyList = proxySelector.select(home); 
+		String host = null;
+		String port = null;
+		if (proxyList != null && !proxyList.isEmpty()) { 
+		 for (Proxy proxy : proxyList) { 
+		   System.out.println(proxy); 
+		   SocketAddress address = proxy.address(); 
+		   if (address instanceof InetSocketAddress) { 
+		     host = ((InetSocketAddress) address).getHostName(); 
+		     port = Integer.toString(((InetSocketAddress) address).getPort()); 
+		     System.setProperty("http.proxyHost", host); 
+		     System.setProperty("http.proxyPort", port); 
+		   } 
+		 } 
+		}
+		InetSocketAddress address = new InetSocketAddress(host, Integer.parseInt(port));
+		return address;
+	}
+    
+	// set logger for all classes connected to MobProxy
+	public static void setLogger() {
+		LoggerContext lc = (LoggerContext) LoggerFactory. getILoggerFactory();
+//	    lc.getLogger("ROOT").setLevel(Level.DEBUG);
+		for(Logger logger:lc.getLoggerList()){
+			logger.setLevel(Level.INFO);
+		}
+	}
+	
+	public static synchronized void setProxyServer() {
+		BrowserMobProxyServer server = new BrowserMobProxyServer();
+		server.setTrustAllServers(true);
+		if (localProxyAddress != null){
+			server.setChainedProxy(localProxyAddress);
+			server.start();
+		} else {
+			server.start();
+			// filter firefox requests to mozilla when system proxy is absent
+			server.blacklistRequests(".*mozilla.*", 200);
+		}		
+		mobProxyServerMap.put(Thread.currentThread().getId(), server);       
+	}
+	
+	public static synchronized BrowserMobProxyServer getPoxyServer() {
+        return mobProxyServerMap.get(Thread.currentThread().getId());
+    }	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java
new file mode 100644
index 0000000..03c9b02
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/OnboardCSVReport.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+
+public class OnboardCSVReport {
+
+	private StringBuilder sb;
+	private PrintWriter pw;
+
+	public OnboardCSVReport(String filepath, String filename) {
+		sb = new StringBuilder();
+		try {
+			File csvFile = new File(filepath + filename);
+			pw = new PrintWriter(csvFile);
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}
+
+	}
+
+	public StringBuilder appendStringToFile(String content) {
+		return sb.append(content + ",");
+	}
+
+	public void openNewRow() {
+		sb.append("\n");
+	}
+
+	public void writeRow(String... content) {
+		for (String str : content) {
+			appendStringToFile(str);
+		}
+		openNewRow();
+	}
+
+	public void closeFile() {
+		pw.write(sb.toString());
+		pw.close();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java
new file mode 100644
index 0000000..ad923d5
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/ReportAfterTestManager.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.IOException;
+
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml;
+import org.testng.ITestContext;
+import org.testng.ITestResult;
+
+import com.aventstack.extentreports.Status;
+
+public class ReportAfterTestManager extends ExtentTestActions  {
+	
+	private static String testName;
+	private static Throwable throwable;
+	private static int status;
+	
+	private static void logSuccessAfterTest(){
+		final Status logStatus = Status.PASS;
+		addTag(logStatus, "Success");
+		try{
+			String message = "Finished the test with the following screenshot : ";
+			addScreenshotToReport(logStatus, testName, message);
+		}catch(Exception e){
+			log(logStatus, "SUCCESS - The following exepction occured : " + e.getMessage());
+		}
+	}
+	
+	private static void logFailAfterTest(){
+		addTag(Status.FAIL, "Failure");
+		try{
+			log(Status.ERROR, "ERROR - The following exepction occured : ");
+			log(Status.ERROR, throwable);
+			String message = "Failure is described in the following screenshot : ";
+			addScreenshotToReport(Status.FAIL, testName, message);
+		}catch(Exception e){
+			log(Status.ERROR, "ERROR - The following exepction occured : " + e.getMessage());
+		}
+	}
+	
+	private static void logSkipAfterTest(){
+		final Status logStatus = Status.SKIP;
+		addTag(logStatus, "Skipped");
+		try{
+			log(logStatus, "SKIP - The following exepction occured : ");
+			log(logStatus, throwable);
+			String message = "Skip is described in the following screenshot : ";
+			addScreenshotToReport(logStatus, testName, message);
+		}catch(Exception e){
+			log(logStatus, "SKIP - The following exepction occured : " + e.getMessage());
+		}
+	}
+	private static void logFatalAfterTest(){
+		final Status logStatus = Status.FATAL;
+		addTag(logStatus, "Fatal");
+		try{
+			log(logStatus, "FATAL - The following exepction occured : ");
+			log(logStatus, throwable);
+			String message = "Fatal is described in the following screenshot : ";
+			addScreenshotToReport(logStatus, testName, message);
+		}catch(Exception e){
+			log(logStatus, "FATAL - The following exepction occured : " + e.getMessage());
+		}
+	}
+	
+	private static String addScreenshotToReport(Status logStatus, String testName, String message) throws IOException{
+		
+		String addedValueFromDataProvider = WindowTestManager.getWindowMap().getAddedValueFromDataProvider();
+		if (addedValueFromDataProvider != null){
+			addedValueFromDataProvider = addedValueFromDataProvider.replace(":", "-");
+			testName = testName + "...." + addedValueFromDataProvider;
+		}
+		
+		return addScreenshot(logStatus, testName, message);
+	}
+	
+	public static void report(ITestResult result, ITestContext context){
+		
+		testName = result.getName();
+		throwable = result.getThrowable();
+		status = result.getStatus();
+		
+		String suiteName = ExtentManager.getSuiteName(context);
+
+		switch(status){
+		case ITestResult.SUCCESS:				
+			logSuccessAfterTest();
+			break;
+				
+		case ITestResult.FAILURE:
+			
+			if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
+				logFatalAfterTest();
+			}else{
+				logFailAfterTest();
+			}
+			break;
+			
+		case ITestResult.SKIP:
+			logSkipAfterTest();
+			break;
+				
+		default:
+			break;
+		}
+				
+	}
+		
+}
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
new file mode 100644
index 0000000..0a01da0
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/Retry.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import org.testng.Assert;
+import org.testng.IRetryAnalyzer;
+import org.testng.ITestResult;
+import org.testng.annotations.Test;
+
+public class Retry implements IRetryAnalyzer {
+    private int retryCount = 0;
+    private int maxRetryCount = 1;
+
+    public boolean retry(ITestResult result) {
+
+        if (retryCount < maxRetryCount) {
+            retryCount++;
+            return true;
+        }
+        return false;
+    }
+
+
+
+    
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
new file mode 100644
index 0000000..1838d39
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/SetupCDTest.java
@@ -0,0 +1,573 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import org.littleshoot.proxy.impl.ClientToProxyConnection;
+import org.littleshoot.proxy.impl.ProxyToServerConnection;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.sanity.Onboard;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentManager.suiteNameXml;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.run.StartTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.ITestContext;
+import org.testng.ITestResult;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.ExtentTest;
+import com.aventstack.extentreports.Status;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.LoggerContext;
+import groovyjarjarantlr.Utils;
+import net.lightbody.bmp.BrowserMobProxyServer;
+import net.lightbody.bmp.core.har.Har;
+
+public abstract class SetupCDTest extends DriverFactory {
+	
+//	private static final String RE_RUN = "ReRun - ";
+	private static final String RE_RUN = "<html><font color=\"red\">ReRun - </font></html>";
+	private static final String WEB_SEAL_PASSWORD = "123123a";
+
+	public SetupCDTest() {
+		LoggerContext lc = (LoggerContext) LoggerFactory. getILoggerFactory();
+		lc.getLogger("org.apache").setLevel(Level.INFO);	    
+	}
+
+	/**************** CONSTANTS ****************/
+	private static final String CREDENTIALS_FILE = "credentials.yaml";
+	private static final String REPORT_FILE_NAME = "SDC_UI_Extent_Report.html";
+	protected static final String REPORT_FOLDER = "." + File.separator + "ExtentReport" + File.separator;
+	protected static final String SCREENSHOT_FOLDER = REPORT_FOLDER + "screenshots" + File.separator;
+	protected static final String HAR_FILES_FOLDER_NAME = "har_files";
+	protected static final String HAR_FILES_FOLDER = REPORT_FOLDER + HAR_FILES_FOLDER_NAME + File.separator;
+	
+
+	private static final String SHORT_CSV_REPORT_FILE_NAME = "ShortReport.csv";
+	private static final int NUM_OF_ATTEMPTS_TO_REFTRESH = 2;
+	
+
+	/**************** PRIVATES ****************/
+	private static String url;
+	private static boolean localEnv = true;
+	private static OnboardCSVReport csvReport;
+	private static Map<?, ?> credentials;
+	
+    protected static ITestContext myContext;
+	
+	
+	/**************** METHODS ****************/
+	public static ExtentTest getExtendTest() {
+		return ExtentTestManager.getTest();
+	}
+	public static WindowTest getWindowTest(){
+		return WindowTestManager.getWindowMap();
+	}
+	
+	public OnboardCSVReport getCsvReport() {
+		return csvReport;
+	}
+	
+	public static String getReportFolder() {
+		return REPORT_FOLDER;
+	}
+	
+	public static String getScreenshotFolder() {
+		return SCREENSHOT_FOLDER;
+	}
+	
+	public static String getHarFilesFolder() {
+		return HAR_FILES_FOLDER;
+	}
+	
+	
+	protected abstract UserRoleEnum getRole();
+	
+	/**************** BEFORE ****************/
+
+	@BeforeSuite(alwaysRun = true)
+	public void setupBeforeSuite(ITestContext context) throws Exception {
+		RestCDUtils.deleteOnDemand();
+		myContext=context;
+		setErrorConfigurationFile();
+		setUrl();
+		ExtentManager.initReporter(getReportFolder(), REPORT_FILE_NAME, context);		
+		csvReport = new OnboardCSVReport(getReportFolder(), SHORT_CSV_REPORT_FILE_NAME);
+	}
+	
+	private static void setErrorConfigurationFile() {
+		if (!System.getProperty("os.name").contains("Windows")){
+			String errorConfigurationFilename = getConfig().getErrorConfigurationFile();
+			errorConfigurationFilename = errorConfigurationFilename.substring(errorConfigurationFilename.lastIndexOf("/") + 1, errorConfigurationFilename.length());
+			getConfig().setErrorConfigurationFile(FileHandling.getBasePath() + File.separator + "conf" + File.separator + errorConfigurationFilename);
+			if (new File(getConfig().getErrorConfigurationFile()).exists()){
+				System.out.println("Found error-configuration.yaml in : " + getConfig().getErrorConfigurationFile());
+			}
+		}
+	}
+	
+	@BeforeMethod(alwaysRun = true )
+	public void setBrowserBeforeTest(java.lang.reflect.Method method, ITestContext context) throws Exception {
+		
+		boolean emptyDataProvider = method.getAnnotation(Test.class).dataProvider().isEmpty();
+		if (emptyDataProvider) {
+			System.out.println("ExtentReport instance started from BeforeMethod...");
+			String suiteName = ExtentManager.getSuiteName(context);
+			if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
+				ExtentTestManager.startTest(RE_RUN + method.getName());
+			}else{
+				ExtentTestManager.startTest(method.getName());
+			}
+		
+			ExtentTestManager.assignCategory(this.getClass());
+			setBrowserBeforeTest(getRole());
+		} else {
+			System.out.println("ExtentReport instance started from Test...");
+		}
+		
+		getConfig().setWindowsDownloadDirectory(getWindowTest().getDownloadDirectory());
+		
+		if (getConfig().getCaptureTraffic()){
+			try{
+			    MobProxy.getPoxyServer().newHar(method.getName() + ".har");
+			} catch (Throwable e) {
+				e.printStackTrace();
+			}
+		}		
+	}
+	
+	/**************** AFTER ****************/
+	@AfterMethod(alwaysRun = true)
+	public void quitAfterTest(ITestResult result, ITestContext context) throws Exception {
+		
+		try{
+			ReportAfterTestManager.report(result, context);
+			GeneralUIUtils.closeErrorMessage();
+		}
+		finally{
+			try {
+				if (getConfig().getCaptureTraffic()){
+					addTrafficFileToReport(result);				
+				}
+				
+				if (result.getInstanceName().equals(Onboard.class.getName())  && result.getStatus() == ITestResult.FAILURE){
+					System.out.println("Onboarding test failed, closign browser....");
+					getExtendTest().log(Status.INFO, "Onboarding test failed, closign browser....");
+					quitDriver();
+				}
+				else if (!getUser().getRole().toLowerCase().equals(UserRoleEnum.ADMIN.name().toLowerCase())){
+					boolean navigateToHomePageSuccess = HomePage.navigateToHomePage();
+					if (!navigateToHomePageSuccess){
+						System.out.println("Navigating to homepage failed, reopening driver....");
+						getExtendTest().log(Status.INFO, "Navigating to homepage failed, reopening driver....");
+						quitDriver();
+					}
+				}
+				
+			} catch (Exception e) {
+				e.printStackTrace();
+						getExtendTest().log(Status.ERROR, "Exception:"+ e.toString());
+			} 
+			
+			
+			
+	    	ExtentTestManager.endTest();
+	    	addResultToCSV(result, context);
+//	    	ExtentManager.closeReporter();
+	    	FileHandling.cleanCurrentDownloadDir();
+    	}
+
+	}
+	public void addResultToCSV(ITestResult result, ITestContext context) {
+		String suiteName = ExtentManager.getSuiteName(context);	    	
+		ExtentTest test = ExtentTestManager.getTest();
+		com.aventstack.extentreports.model.Test model = test.getModel();
+		String name = model.getName();
+		String status = model.getStatus().toString();
+		if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue()) && !(result.getStatus() == ITestResult.SUCCESS)) {
+			getCsvReport().writeRow(result.getInstanceName(), name.replace(RE_RUN,""), status);
+		}
+	}
+		
+	@AfterSuite(alwaysRun = true)
+	public void afterSuite() throws Exception  {
+		
+		if (getConfig().getUseBrowserMobProxy()){
+			MobProxy.getPoxyServer().stop();
+		}
+		
+		csvReport.closeFile();
+		RestCDUtils.deleteOnDemand();
+	}
+	
+	protected static String setUrl() {
+		url = getConfig().getUrl();
+		if (url == null) {
+			String message = "no URL found";
+			System.out.println(message);
+			Assert.fail(message);
+		} else if (!url.contains("localhost") && !url.contains("127.0.0.1")) {
+			localEnv = false;
+		}
+		return url;
+	}
+
+	public static void loadCredentialsFile() throws Exception {
+		if (credentials != null){
+			return;
+		}
+		File credentialsFileRemote = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + CREDENTIALS_FILE);
+		File credentialsFileLocal = new File(FileHandling.getConfFilesPath() + CREDENTIALS_FILE);
+		File[] credentialFiles = {credentialsFileRemote, credentialsFileLocal};
+		for (File credentialsFile : credentialFiles){
+			if (credentialsFile.exists()){
+				credentials = FileHandling.parseYamlFile(credentialsFile.getAbsolutePath());
+				break;
+			}
+		}
+	}
+
+	private UserCredentials getUserCredentialsFromFile(String userRole) throws Exception {
+		@SuppressWarnings("unchecked")
+		Map<String, String> credentialsMap = (Map<String, String>) credentials.get(userRole);
+		String user = (String) credentialsMap.get("username");
+		String password = (String) credentialsMap.get("password");
+		String firstname = (String) credentialsMap.get("firstname");
+		String lastname = (String) credentialsMap.get("lastname");
+
+		return new UserCredentials(user, password, firstname, lastname, userRole);
+	}
+
+
+	public static void navigateToUrl(String url) throws Exception {
+		try {
+			System.out.println("Deleting cookies...");
+			deleteCookies();
+
+			System.out.println("Navigating to URL : " + url);
+			getDriver().navigate().to(url);
+			GeneralUIUtils.waitForLoader();
+			
+			System.out.println("Zooming out...");
+			GeneralUIUtils.windowZoomOutUltimate();
+			
+		} 
+		catch (Exception e) {
+			String msg = "Browser is unreachable";
+			System.out.println(msg);
+			getExtendTest().log(Status.ERROR, msg);
+			Assert.fail(msg);
+		}
+	}
+	private static void deleteCookies() throws Exception {
+		getDriver().manage().deleteAllCookies();
+		Thread.sleep(1000);
+		
+		int attempts = 0;
+		final int max_attempts = 3;
+		
+		while (!getDriver().manage().getCookies().isEmpty() && attempts < max_attempts){
+			getExtendTest().log(Status.INFO, "Trying to delete cookies one more time - " + (attempts + 1) + "/" + max_attempts + "attempts");
+			String deleteCookiesJS = "document.cookie.split(';').forEach(function(c) { document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/'); });";
+			((JavascriptExecutor) getDriver()).executeScript(deleteCookiesJS);
+			attempts++;
+			
+			if (attempts == max_attempts){
+				String msg = "Did not delete cookies, can't login as user " + WindowTestManager.getWindowMap().getUser().getRole();
+				System.out.println(msg);
+				getExtendTest().log(Status.ERROR, msg);
+				Assert.fail(msg);
+			}
+		}
+	}
+	
+	protected void loginToSystem(UserRoleEnum role) throws Exception {
+		UserCredentials credentials;
+		if (localEnv){
+			loginToSimulator(role);
+			credentials = new UserCredentials(role.getUserId(), WEB_SEAL_PASSWORD, role.getFirstName(), role.getLastName(), role.name());
+		}
+		else{
+			credentials = getUserFromFileByRole(role);
+			sendUserAndPasswordKeys(credentials);
+			WebElement submitButton = GeneralUIUtils.getWebElementBy(By.name("btnSubmit"), 30);
+			submitButton.click();
+			WebElement buttonOK = GeneralUIUtils.getWebElementBy(By.name("successOK"), 30);
+			Assert.assertTrue(buttonOK.isDisplayed(), "OK button is not displayed.");
+			buttonOK.click();
+		}
+		GeneralUIUtils.ultimateWait();                   
+		getWindowTest().setUser(credentials);
+	}
+	protected UserCredentials getUserFromFileByRole(UserRoleEnum role) throws Exception {
+		loadCredentialsFile();
+		return getUserCredentialsFromFile(role.name().toLowerCase());
+	}
+	private void goToHomePage(UserRoleEnum role) throws Exception {
+		try {
+			getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() == 0 ? NUM_OF_ATTEMPTS_TO_REFTRESH : getWindowTest().getRefreshAttempts());
+			if (!role.equals(UserRoleEnum.ADMIN)) {
+				
+				WebElement closeButton = GeneralUIUtils.getClickableButtonBy(By.className("sdc-welcome-close"), 10);
+				if (closeButton != null){
+					closeButton.click();
+				}
+				
+				if (!GeneralUIUtils.isElementVisibleByTestId(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue()))
+				{
+					restartBrowser(role);
+				}
+			}
+		}
+		catch (Exception e) {
+			restartBrowser(role);
+		}
+	}
+	private void restartBrowser(UserRoleEnum role) throws Exception {
+		getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() - 1);
+		if (getWindowTest().getRefreshAttempts() <= 0) {
+			System.out.println("ERR : Something is wrong with browser!");
+			Assert.fail("ERR : Something is wrong with browser!");
+		}
+		System.out.println("Trying again...");
+		getExtendTest().log(Status.INFO, "Trying again...");
+		getExtendTest().log(Status.INFO, String.format("%s attempt(s) left", getWindowTest().getRefreshAttempts() ));
+		System.out.println(String.format("%s attempt(s) left", getWindowTest().getRefreshAttempts() ));
+
+		reloginWithNewRole(role);
+	}
+	
+	public void loginToSimulator(UserRoleEnum role){
+		WebDriver driver = GeneralUIUtils.getDriver();
+		WebDriverWait wait = new WebDriverWait(driver, 30);
+		
+		wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("//*[@method='" + "post" + "']"))));
+		
+		WebElement userIdTextbox = GeneralUIUtils.getWebElementBy(By.name("userId"));
+		userIdTextbox.sendKeys(role.getUserId());
+		WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
+		passwordTextbox.sendKeys(WEB_SEAL_PASSWORD);
+		
+		wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("//*[@value='" + "Login" + "']")))).click();
+	}
+
+	private void sendUserAndPasswordKeys(UserCredentials userId) {
+		System.out.println("Login as user : " + userId.getUserId());
+		WebElement userNameTextbox = GeneralUIUtils.getWebElementBy(By.name("userid"));
+		userNameTextbox.sendKeys(userId.getUserId());
+		WebElement passwordTextbox = GeneralUIUtils.getWebElementBy(By.name("password"));
+		passwordTextbox.sendKeys(userId.getPassword());
+	}
+
+	public void loginWithUser(UserRoleEnum role) {
+		try {
+			getExtendTest().log(Status.INFO, String.format("Login as user %s", role.name().toUpperCase()));
+			loginToSystem(role);
+			goToHomePage(role);
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+		finally{
+			getWindowTest().setPreviousRole(getWindowTest().getUser().getRole());
+		}
+	}
+
+	private void setUser(UserRoleEnum role) {
+		User user = new User();
+		user.setUserId(role.getUserId());
+		user.setFirstName(role.getFirstName());
+		user.setRole(role.name());
+		user.setLastName(role.getLastName());
+		
+		getWindowTest().setUser(user);
+	}
+
+	public User getUser() {
+		return getWindowTest().getUser();
+	}
+
+	private void setBrowserBeforeTest(UserRoleEnum role) {
+		System.out.println(String.format("Setup before test as %s.", role.toString().toUpperCase() ));
+		try {
+			System.out.println("Previous role is : " + getWindowTest().getPreviousRole() + " ; Current role is : " + role.name());
+			if (!getWindowTest().getPreviousRole().toLowerCase().equals(role.name().toLowerCase())){
+				System.out.println("Roles are different, navigate and login");
+				navigateAndLogin(role);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void navigateAndLogin(UserRoleEnum role) throws Exception {
+		getWindowTest().setRefreshAttempts(getWindowTest().getRefreshAttempts() != 0 ? getWindowTest().getRefreshAttempts() : 0);
+		setUser(role);
+		navigateToUrl(url);
+		loginWithUser(role);
+		GeneralUIUtils.ultimateWait();
+	}
+
+	public User getUser(UserRoleEnum role) {
+		User user = new User();
+		user.setUserId(role.getUserId());
+		user.setFirstName(role.getFirstName());
+		user.setLastName(role.getLastName());
+		user.setRole(role.name());
+		return user;
+	}
+
+	protected void reloginWithNewRole(UserRoleEnum role) throws Exception {
+		System.out.println(String.format("Setup before relogin as %s", role.toString().toUpperCase()));
+		navigateAndLogin(role);
+	}
+
+	public static void setLocalUrl(UserRoleEnum role) {
+		switch (role) {
+			case ADMIN: {
+				url = "http://localhost:8181/sdc1/proxy-admin1#/dashboard";
+				break;
+			}
+			case DESIGNER: {
+				url = "http://localhost:8181/sdc1/proxy-designer1#/dashboard";
+				break;
+			}
+			case GOVERNOR: {
+				url = "http://localhost:8181/sdc1/proxy-governor1#/dashboard";
+				break;
+			}
+			case OPS: {
+				url = "http://localhost:8181/sdc1/proxy-ops1#/dashboard";
+				break;
+			}
+			case TESTER: {
+				url = "http://localhost:8181/sdc1/proxy-tester1#/dashboard";
+				break;
+			}
+			case PRODUCT_MANAGER1: {
+				url = "http://localhost:8181/sdc1/proxy-pm1#/dashboard";
+				break;
+			}
+			case PRODUCT_MANAGER2: {
+				url = "http://localhost:8181/sdc1/proxy-pm2#/dashboard";
+				break;
+			}
+			case PRODUCT_STRATEGIST1: {
+				url = "http://localhost:8181/sdc1/proxy-ps1#/dashboard";
+				break;
+			}
+			case PRODUCT_STRATEGIST2: {
+				url = "http://localhost:8181/sdc1/proxy-ps2#/dashboard";
+				break;
+			}
+			default: {
+				break;
+			}
+		}
+	}
+	
+	public void addTrafficFileToReport(ITestResult result) {
+		try {				
+			// Get the HAR data
+			Har har = MobProxy.getPoxyServer().getHar();
+			String shortUUID = UUID.randomUUID().toString().split("-")[0];
+			File harFile = new File(getHarFilesFolder() + result.getName() + shortUUID + ".har");
+			new File(getHarFilesFolder()).mkdirs();
+
+			har.writeTo(harFile);
+			
+			String pathToFileFromReportDirectory = HAR_FILES_FOLDER_NAME + File.separator + harFile.getName();
+			ExtentTestActions.addFileToReportAsLink(harFile, pathToFileFromReportDirectory, "File with captured traffic");
+		} catch (IOException ioe) {
+			ioe.printStackTrace();
+		}
+	}
+	
+	/*
+	 * * Start section of test in ExtentReport with DataProvider parameters,
+	 * should be started from test method, see example in onboardVNFTest
+	 */
+	public void setLog(String fromDataProvider) {
+		
+		String suiteName = ExtentManager.getSuiteName(myContext);
+		if (suiteName.equals(suiteNameXml.TESTNG_FAILED_XML_NAME.getValue())) {
+			ExtentTestManager.startTest(RE_RUN +Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
+		}else{
+			ExtentTestManager.startTest(Thread.currentThread().getStackTrace()[2].getMethodName() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + fromDataProvider);
+		}
+		
+		
+		
+		getWindowTest().setAddedValueFromDataProvider(fromDataProvider);
+		ExtentTestManager.assignCategory(this.getClass());
+		setBrowserBeforeTest(getRole());
+	}
+	
+	
+	
+	/**************** MAIN ****************/
+	public static void main(String[] args) {
+		System.out.println("---------------------");
+		System.out.println("running test from CLI");
+		System.out.println("---------------------");
+
+		String attsdcFilePath = FileHandling.getBasePath() + File.separator + "conf" + File.separator + "attsdc.yaml";
+		System.setProperty("config.resource", attsdcFilePath);
+		System.out.println("attsdc.yaml file path is : " + attsdcFilePath);
+		
+		String filepath = FileHandling.getBasePath() + File.separator + "Files" + File.separator;
+		System.setProperty("filepath", filepath);
+		System.out.println("filepath is : " + System.getProperty("filepath"));
+		
+		Object[] testSuitsList = FileHandling.filterFileNamesFromFolder(FileHandling.getBasePath() + File.separator + "testSuites", ".xml");
+		if (testSuitsList != null) {
+			System.out.println(String.format("Found %s testSuite(s)", testSuitsList.length));
+			args = Arrays.copyOf(testSuitsList, testSuitsList.length, String[].class);
+			StartTest.main(args);
+		}
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java
new file mode 100644
index 0000000..0268c69
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/TestFtp.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.openqa.selenium.remote.internal.ApacheHttpClient;
+
+public class TestFtp {
+
+	public static void main(String[] args) throws IOException {
+		// TODO Auto-generated method stub
+		AttFtpClient instance = AttFtpClient.getInstance();
+		
+		 String server = "135.177.130.113";
+	      int port = 2121;
+	      String user = "admin";
+	      String pass = "admin";
+	      AttFtpClient.getInstance().init(server, port, user, pass);
+	      
+	      try {
+	    	  AttFtpClient.getInstance().retrieveListOfFile();
+	    	  
+	    	  File retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP();
+	    	  String content = new String(Files.readAllBytes(Paths.get(retrieveLastModifiedFileFromFTP.getPath())), StandardCharsets.UTF_8);
+//	    	  instance.deleteFilesFromFTPserver();
+	    	  System.out.println(content);
+	    	  readFile(retrieveLastModifiedFileFromFTP);
+			
+		} finally {
+			instance.terminateClient();
+		}
+	      
+	     
+
+	      
+	      
+	      
+		
+	}
+	 public static void readFile(File retrieveLastModifiedFileFromFTP) {
+
+	        StringBuilder sb = new StringBuilder();
+	        BufferedReader br = null;
+	        try {
+	            br = new BufferedReader(new FileReader(retrieveLastModifiedFileFromFTP.getPath()));
+	            String line;
+	            while ((line = br.readLine()) != null) {
+	                if (sb.length() > 0) {
+	                    sb.append("\n");
+	                }
+	                sb.append(line);
+	            }
+	        } catch (IOException e) {
+	            e.printStackTrace();
+	        } finally {
+	            try {
+	                if (br != null) {
+	                    br.close();
+	                }
+	            } catch (IOException ex) {
+	                ex.printStackTrace();
+	            }
+	        }
+	        String contents = sb.toString();
+	        System.out.println(contents);		
+		 
+	 }
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
new file mode 100644
index 0000000..5a95df3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WebDriverThread.java
@@ -0,0 +1,164 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.UUID;
+
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openqa.selenium.Platform;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.firefox.FirefoxProfile;
+import org.openqa.selenium.remote.CapabilityType;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.remote.LocalFileDetector;
+import org.openqa.selenium.remote.RemoteWebDriver;
+
+import net.lightbody.bmp.BrowserMobProxyServer;
+import net.lightbody.bmp.client.ClientUtil;
+import net.lightbody.bmp.proxy.CaptureType;
+
+public class WebDriverThread {
+
+	public static final String AUTOMATION_DOWNLOAD_DIR = "automationDownloadDir";
+	private WebDriver webdriver;
+	private FirefoxProfile firefoxProfile;
+	public static final String SELENIUM_NODE_URL = "http://%s:%s/wd/hub";
+	
+	public WebDriverThread(Config config) {
+		initDriver(config);
+		webdriver.manage().window().maximize();
+	}
+	
+	public WebDriver getDriver() throws Exception {
+		return webdriver;
+	}
+	
+	public void quitDriver() {
+		if (webdriver != null) {
+			webdriver.quit();
+			webdriver = null;
+		}
+	}
+	
+	
+	public void initDriver(Config config){
+		try {
+			boolean remoteTesting = config.isRemoteTesting();
+			if (!remoteTesting) {
+				boolean mobProxyStatus = config.getUseBrowserMobProxy();
+				if (mobProxyStatus){
+					setWebDriverWithMobProxy();
+				} else {
+					System.out.println("Opening LOCAL browser");
+					DesiredCapabilities cap = new DesiredCapabilities();
+									
+					cap = DesiredCapabilities.firefox();
+					cap.setBrowserName("firefox");
+					cap.setCapability(FirefoxDriver.PROFILE, initFirefoxProfile());
+					
+			        firefoxProfile.setPreference("network.proxy.type", 2);
+					firefoxProfile.setPreference("network.proxy.autoconfig_url", "http://emea-auto.proxy.att.com:8001/");
+					firefoxProfile.setPreference("network.proxy.no_proxies_on", "localhost");
+					
+					webdriver = new FirefoxDriver(cap);
+				}								
+			} else {
+				System.out.println("Opening REMOTE browser");
+				String remoteEnvIP = config.getRemoteTestingMachineIP();
+				String remoteEnvPort = config.getRemoteTestingMachinePort();
+				
+				DesiredCapabilities cap = new DesiredCapabilities();
+				cap = DesiredCapabilities.firefox();
+				cap.setPlatform(Platform.ANY);
+				cap.setBrowserName("firefox");
+				
+				String remoteNodeUrl = String.format(SELENIUM_NODE_URL, remoteEnvIP, remoteEnvPort);
+				RemoteWebDriver remoteWebDriver = new RemoteWebDriver(new URL(remoteNodeUrl), cap);
+				remoteWebDriver.setFileDetector(new LocalFileDetector());
+				webdriver = remoteWebDriver;
+			}
+			
+
+		} catch (MalformedURLException e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+	private FirefoxProfile initFirefoxProfile() {
+		firefoxProfile = new FirefoxProfile();
+		firefoxProfile.setPreference("browser.download.folderList",2);
+		firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
+		firefoxProfile.setPreference("browser.download.dir", getDownloadDirectory());
+		firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream, application/xml, text/plain, text/xml, image/jpeg");
+		return firefoxProfile;
+	}
+
+	private String getDownloadDirectory() {
+		String downloadDirectory = FileHandling.getBasePath() + File.separator + AUTOMATION_DOWNLOAD_DIR + UUID.randomUUID().toString().split("-")[0] + File.separator;
+		File dir = new File(downloadDirectory);
+		if(!dir.exists()) {
+			dir.mkdirs();
+		}
+		return dir.getAbsolutePath();
+	}
+
+	public FirefoxProfile getFirefoxProfile() {
+		return firefoxProfile;
+	}
+	
+	private void setWebDriverWithMobProxy(){
+		WebDriver driver = null;
+		MobProxy.setProxyServer();
+		BrowserMobProxyServer proxyServer = MobProxy.getPoxyServer();
+		
+		firefoxProfile = new FirefoxProfile();
+		firefoxProfile.setPreference("browser.download.folderList",2);
+		firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
+		firefoxProfile.setPreference("browser.download.dir", getDownloadDirectory());
+		firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/octet-stream, application/xml, text/plain, text/xml, image/jpeg");
+		firefoxProfile.setAcceptUntrustedCertificates(true);
+		firefoxProfile.setAssumeUntrustedCertificateIssuer(true);
+//		firefoxProfile.setPreference("network.proxy.http", "localhost");
+//		firefoxProfile.setPreference("network.proxy.http_port", proxyServer.getPort());
+//		firefoxProfile.setPreference("network.proxy.ssl", "localhost");
+//		firefoxProfile.setPreference("network.proxy.ssl_port", proxyServer.getPort());
+//		firefoxProfile.setPreference("network.proxy.type", 1);
+//		firefoxProfile.setPreference("network.proxy.no_proxies_on", "");
+
+        DesiredCapabilities capabilities = new DesiredCapabilities();
+        
+        capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
+        capabilities.setCapability(CapabilityType.PROXY, ClientUtil.createSeleniumProxy(proxyServer));
+        capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
+
+        webdriver = new FirefoxDriver(capabilities);
+		proxyServer.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT, CaptureType.REQUEST_COOKIES, CaptureType.REQUEST_BINARY_CONTENT,
+				                          CaptureType.REQUEST_HEADERS, CaptureType.RESPONSE_COOKIES, CaptureType.RESPONSE_HEADERS, CaptureType.RESPONSE_BINARY_CONTENT);
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java
new file mode 100644
index 0000000..8df3c59
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.io.File;
+
+import org.openecomp.sdc.be.model.User;
+
+public class WindowTest {
+	
+	public WindowTest(){
+		refreshAttempts = 0;
+		previousRole = "";
+		addedValueFromDataProvider = null;
+		try {
+			downloadDirectory = DriverFactory.getDriverFirefoxProfile().getStringPreference("browser.download.dir", null) + File.separator;
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	private int refreshAttempts;
+	private String previousRole;
+	private User user;
+	private String addedValueFromDataProvider;
+	private String downloadDirectory;
+	
+	public int getRefreshAttempts() {
+		return refreshAttempts;
+	}
+	public void setRefreshAttempts(int refreshAttempts) {
+		this.refreshAttempts = refreshAttempts;
+	}
+	public String getPreviousRole() {
+		return previousRole;
+	}
+	public void setPreviousRole(String previousRole) {
+		this.previousRole = previousRole;
+	}
+	public User getUser() {
+		return user;
+	}
+	public void setUser(User user) {
+		this.user = user;
+	}
+	public synchronized String getAddedValueFromDataProvider() {
+		return addedValueFromDataProvider;
+	}
+	public synchronized void setAddedValueFromDataProvider(String addedValueFromDataProvider) {
+		this.addedValueFromDataProvider = addedValueFromDataProvider;
+	}
+	public String getDownloadDirectory() {
+		return downloadDirectory;
+	}
+	public void setDownloadDirectory(String downloadDirectory) {
+		this.downloadDirectory = downloadDirectory;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
new file mode 100644
index 0000000..5e5ddc4
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/setup/WindowTestManager.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.execute.setup;
+
+import java.util.HashMap;
+
+import com.aventstack.extentreports.ExtentTest;
+
+public class WindowTestManager {
+	
+	private static HashMap<Long, WindowTest> windowMap = new HashMap<Long, WindowTest>();
+
+	public static synchronized WindowTest getWindowMap() {
+		Long currentThreadId = Thread.currentThread().getId();
+		boolean containsKey = windowMap.containsKey(currentThreadId);
+		if (!containsKey){
+			setWindowMap(currentThreadId);
+		}
+		return windowMap.get(currentThreadId);
+	}
+
+	private static synchronized void setWindowMap(Long currentThreadId) {
+		WindowTestManager.windowMap.put(currentThreadId, new WindowTest());
+	}
+	
+	public static synchronized void removeWindowTest(){
+		windowMap.remove(Thread.currentThread().getId());
+	}
+	
+	public static synchronized HashMap<Long, WindowTest> getWholeMap(){
+		return windowMap;
+	}
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java
new file mode 100644
index 0000000..98ef431
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/AdminGeneralPage.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.UserManagementTab;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class AdminGeneralPage extends GeneralPageElements {
+
+	public AdminGeneralPage() {
+		super();
+	}
+	
+	private static UserManagementTab userManagementTab = new UserManagementTab();
+	
+	public static UserManagementTab getUserManagementTab() {
+		return userManagementTab;
+	}
+
+	public static void selectCategoryManagmetTab() throws Exception {
+	
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.AdminPageTabs.CATEGORY_MANAGEMENT.getValue());
+	}
+	
+	public static void selectUserManagmetTab() throws Exception {
+		
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.AdminPageTabs.USER_MANAGEMENT.getValue());
+	}
+	
+	public static List<WebElement> getServiceCategoriesList() throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_HEADER.getValue());
+		GeneralUIUtils.waitForLoader();
+		return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_LIST.getValue());
+	}
+	
+	public static List<WebElement> getResourceCategoriesList() throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue());
+		GeneralUIUtils.waitForLoader();
+		return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_LIST.getValue());
+	}
+	
+	public static void createNewServiceCategory(String name) throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.SERVICE_CATEGORY_HEADER.getValue());
+		SetupCDTest.getExtendTest().log(Status.INFO, "Creating service...");
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_BUTTON.getValue());
+		GeneralUIUtils.waitForLoader();
+		defineNewResourceCategoryName(name);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+		GeneralUIUtils.waitForLoader();
+	}
+	
+	public static void selectElementFromList(List<WebElement> list, String elementToSelect) throws Exception {
+				
+		for (WebElement webElement : list) {
+			if (webElement.getText().toLowerCase().equals(elementToSelect.toLowerCase())){
+				webElement.click();
+			}
+		}
+
+	}
+	
+	
+	
+	public static void addSubCategoryToResource(List<WebElement> resourceList, String parentResource, String subCategoryName) throws Exception{
+		
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue());
+		selectElementFromList(resourceList, parentResource);
+		SetupCDTest.getExtendTest().log(Status.INFO, "Creating...");
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_SUB_CATEGORY_BUTTON.getValue());
+		GeneralUIUtils.waitForLoader();
+		defineNewResourceCategoryName(subCategoryName);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+		GeneralUIUtils.waitForLoader();
+		
+		
+	}
+	
+	public static void createNewResourceCategory(String name) throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.RESOURCE_CATEGORY_HEADER.getValue());
+		SetupCDTest.getExtendTest().log(Status.INFO, "Creating...");
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_BUTTON.getValue());
+		GeneralUIUtils.waitForLoader();
+		defineNewResourceCategoryName(name);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+		GeneralUIUtils.waitForLoader();
+		
+	}	
+	
+	public void insertPropertyDefaultValue(String value) {
+		WebElement propertyValue = GeneralUIUtils
+				.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue());
+		propertyValue.clear();
+		propertyValue.sendKeys(value);
+	}
+	
+	private static void defineNewResourceCategoryName(String name) {
+		WebElement categoryNameTextbox = getCategoryName();
+		categoryNameTextbox.clear();
+		categoryNameTextbox.sendKeys(name);
+	}
+	
+	private static WebElement getCategoryName() {
+		return GeneralUIUtils.getWebElementByClassName(DataTestIdEnum.CategoryManagement.NEW_CATEGORY_NAME.getValue());
+	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java
new file mode 100644
index 0000000..d795599
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ComponentLeftMenu.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+public interface ComponentLeftMenu {
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java
new file mode 100644
index 0000000..496c537
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/CompositionPage.java
@@ -0,0 +1,197 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.CanvasElement;
+import org.openecomp.sdc.ci.tests.datatypes.CanvasManager;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.Select;
+
+import com.aventstack.extentreports.Status;
+
+public class CompositionPage extends GeneralPageElements {
+
+	public CompositionPage() {
+		super();
+	}
+	
+	public static UploadArtifactPopup artifactPopup() {
+		return new UploadArtifactPopup(true);
+	}
+
+	public static void searchForElement(String elementName) {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + elementName + " in the left panel");
+		WebElement searchField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.SEARCH_ASSET.getValue());
+		searchField.clear();
+		searchField.sendKeys(elementName);
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public static void showDeploymentArtifactTab() throws Exception {
+		clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.DEPLOYMENT_ARTIFACT_TAB);
+	}
+
+	public static void showInformationsTab() throws Exception {
+		clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.INFORMATION_TAB);
+	}
+	
+	public static void showPropertiesAndAttributesTab() throws Exception {
+		clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.PROPERTIES_AND_ATTRIBUTES_TAB);
+	}
+
+	public static List<WebElement> getProperties() {
+		return PropertiesPage.getElemenetsFromTable();
+	}
+	
+	public static List<WebElement> getDeploymentArtifacts() {
+		return getAllAddedArtifacts();
+	}
+	
+	public static List<WebElement> getAllAddedArtifacts() {
+		String dataTestsId = DataTestIdEnum.CompositionScreenEnum.ARTIFACTS_LIST.getValue();
+		return GeneralUIUtils.getWebElementsListBy(By.xpath("//*[contains(@data-tests-id,'" + dataTestsId + "')]"));
+	}
+
+	public static void moveToInputsScreen() throws Exception {
+		OpenPagesMenu();
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.MENU_INPUTS.getValue());
+		GeneralUIUtils.ultimateWait();
+	}
+
+	private static void OpenPagesMenu() {
+		Actions actions = new Actions(GeneralUIUtils.getDriver());
+		List<WebElement> triangleList = GeneralUIUtils.getWebElementsListByClassName(DataTestIdEnum.CompositionScreenEnum.MENU_TRIANGLE_DROPDOWN.getValue());
+		WebElement pagesMenu = triangleList.get(2);
+		actions.moveToElement(pagesMenu).perform();
+	}
+
+	public static void changeComponentVersion(CanvasManager canvasManager, CanvasElement element, String version) {
+		try{
+			SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing component version to  %s", version));
+			canvasManager.clickOnCanvaElement(element);
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue());
+			GeneralUIUtils.ultimateWait();
+			Select selectlist = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue()));
+			while (selectlist.getOptions().size() == 0) {
+				selectlist = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CHANGE_VERSION.getValue()));
+			}
+			GeneralUIUtils.ultimateWait();;
+			selectlist.selectByValue(version);
+			GeneralUIUtils.ultimateWait();
+			GeneralUIUtils.clickSomewhereOnPage();
+		}
+		catch(Exception e){
+			throw e;
+		}
+	}
+	
+	public static void clickAddArtifactButton() throws Exception{
+		clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum.ADD_ARTIFACT);
+		GeneralUIUtils.getWebElementByClassName("sdc-add-artifact");
+	}
+	
+	public static String getSelectedInstanceName(){
+		return GeneralUIUtils.getWebElementByTestID("selectedCompTitle").getText();
+	}
+	
+	public static void showInformationArtifactTab() throws Exception {
+		clickOnTab(DataTestIdEnum.CompositionScreenEnum.INFORMATION_ARTIFACTS);
+	}
+	
+	public static void showAPIArtifactTab() throws Exception {
+		clickOnTab(DataTestIdEnum.CompositionScreenEnum.API);
+	}
+	
+	public static void showInformationTab() throws Exception {
+		clickOnTab(DataTestIdEnum.CompositionScreenEnum.INFORMATION);
+	}
+	
+	public static void showCompositionTab() throws Exception {
+		clickOnTab(DataTestIdEnum.CompositionScreenEnum.COMPOSITION);
+	}
+	
+	public static void showInputsTab() throws Exception {
+		clickOnTab(DataTestIdEnum.CompositionScreenEnum.INPUTS);
+	}
+	
+	public static void showRequirementsAndCapabilitiesTab() throws Exception {
+		clickOnTab(DataTestIdEnum.CompositionScreenEnum.REQUIREMENTS_AND_CAPABILITIES);		
+	}
+	
+	public static List<WebElement> getOpenTabTitle() throws Exception{
+//		return GeneralUIUtils.getElementsByCSS("expand-collapse span");
+		return GeneralUIUtils.getElementsByCSS("expand-collapse");
+	}
+	
+	public static void clickOnTab(DataTestIdEnum.CompositionScreenEnum tabSelector) throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", tabSelector.name()));
+		GeneralUIUtils.getElementsByCSS(tabSelector.getValue()).get(0).click();
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public static void clickOnTabTestID(DataTestIdEnum.CompositionScreenEnum tabSelector) throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", tabSelector.name()));
+		GeneralUIUtils.getWebElementByTestID(tabSelector.getValue()).click();
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public static CanvasElement addElementToCanvasScreen(LeftPanelCanvasItems elementName, CanvasManager vfCanvasManager) throws Exception{
+		CompositionPage.searchForElement(elementName.name());
+		return vfCanvasManager.createElementOnCanvas(elementName);
+	}
+	
+	public static CanvasElement addElementToCanvasScreen(String elementName, CanvasManager vfCanvasManager) throws Exception{
+		CompositionPage.searchForElement(elementName);
+		return vfCanvasManager.createElementOnCanvas(elementName);
+	}
+	
+	public static List<WebElement> getCompositionDeplymentArtifacts() {
+		return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue());
+		}
+	public static WebElement getCustomizationUUID() throws Exception {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.CompositionScreenEnum.CUSTOMIZATION_UUID.getValue());
+	}
+	
+	
+	public static List<WebElement> getCompositionEnvArtifacts(){
+		return GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue());
+	}
+	
+	public static WebElement clickDownloadEnvArtifactComposition(String fileName) {
+		 GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_ENV.getValue() + fileName);
+		 return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() +fileName);
+	}
+
+	
+	
+	
+	
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
new file mode 100644
index 0000000..810a1f9
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentArtifactPage.java
@@ -0,0 +1,277 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.WordUtils;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.collections.Lists;
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentArtifactPage extends GeneralPageElements {
+
+	public DeploymentArtifactPage() {
+		super();
+	}
+
+	public static ResourceLeftMenu getLeftPanel() {
+		return new ResourceLeftMenu();
+	}
+
+	public static UploadArtifactPopup artifactPopup() {
+		return new UploadArtifactPopup();
+	}
+
+	protected static void addNewArtifact(ArtifactGroupTypeEnum artifactGroupType) {
+		switch (artifactGroupType) {
+			case DEPLOYMENT:
+			GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.ADD_DEPLOYMENT_ARTIFACT.getValue()).click();
+				break;
+			case INFORMATIONAL:
+			GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.ADD_INFORMATIONAL_ARTIFACT.getValue()).click();
+				break;
+			default:
+				break;
+			}
+	}
+
+	public static void clickAddNewArtifact() {
+		addNewArtifact(ArtifactGroupTypeEnum.DEPLOYMENT);
+	}
+
+	public static void clickAddAnotherArtifact() {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue()).click();
+	}
+
+	public static void clickEditArtifact(String artifactLabel) {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + artifactLabel).click();
+	}
+	
+	public static void clickEditEnvArtifact(String artifactLabel) {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactLabel).click();
+	}
+
+	public static void clickDeleteArtifact(String artifactLabel) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting %s Artefact ",artifactLabel));
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click();
+	}
+
+	public static WebElement clickDownloadArtifact(String artifactLabel) {
+		WebElement downloadButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + artifactLabel);
+
+		return downloadButton;
+	}
+	
+	public static void clickDownloadEnvArtifact(String envFileNameToDownload) {
+		ExtentTestActions.log(Status.INFO, String.format("Downloading the updated  %s artifact for validate parameters with the response after the update...", envFileNameToDownload));
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue() + envFileNameToDownload);
+		ExtentTestActions.log(Status.INFO, String.format("%s Envartifact was downloaded successfully!", envFileNameToDownload));
+	}
+	
+	public static  void clickSaveEnvParameters() {
+		 GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.SAVE.getValue()).click();
+		 GeneralUIUtils.ultimateWait();
+	}
+	
+	public static WebElement getAddOtherArtifactButton(){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ADD_ANOTHER_ARTIFACT.getValue());
+	}
+	
+	public static void clickOK(){
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.OK.getValue()).click();
+		GeneralUIUtils.getWebElementBy(By.className("flex-container"));
+		GeneralUIUtils.waitForAngular();
+	}
+
+	public static String getArtifactDescription(String artifactLabel) throws Exception {
+		clickOnArtifactDescription(artifactLabel); // open artifact
+		WebElement artifactDescriptionElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.GET_DEPLOYMENT_ARTIFACT_DESCRIPTION.getValue());
+		String artifactDesc = artifactDescriptionElement.getAttribute("value");
+		closeArtifactDescription(artifactLabel); // close artifact
+		return artifactDesc;
+	}
+
+	public static void closeArtifactDescription(String artifactLabel) {
+		GeneralUIUtils.clickOnElementByTestId("popover-x-button");
+	}
+
+	public static WebElement clickOnArtifactDescription(String artifactLabel) throws Exception {
+		try{
+			WebElement artifact = GeneralUIUtils.getWebElementByTestID("descriptionIcon_" + artifactLabel);
+			artifact.click();
+			GeneralUIUtils.waitForLoader();
+			return artifact;
+		}
+		catch(Exception e){
+			throw new Exception("Artifact " + artifactLabel + "is not found");
+		}
+	}
+	
+	public static boolean checkElementsCountInTable(int expectedElementsCount) {
+		return GeneralPageElements.checkElementsCountInTable(expectedElementsCount + 1);
+	}
+	
+	public static String[] verifyArtifactsExistInTable(String filepath, String vnfFile) throws Exception{
+		String[] artifactNamesFromZipFile = FileHandling.getArtifactsFromZip(filepath, vnfFile);
+		return verifyArtifactsExistInTable(artifactNamesFromZipFile);
+	}
+	
+	public static String[] verifyArtifactsExistInTable(String[] artifactNamesFromZipFile) throws Exception{
+		if (artifactNamesFromZipFile != null){
+			checkArtifactsDisplayed(artifactNamesFromZipFile);
+			checkEnvArtifactsDisplayed();
+		}
+		
+		return artifactNamesFromZipFile;
+	}
+
+	public static void checkArtifactsDisplayed(String[] artifactsFromZipFile) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the artifacts in the table");
+		List<String> artifactList = Lists.newArrayList(artifactsFromZipFile).stream().filter(p -> !p.contains(".env")).map(p -> getVisualArtifactName(p)).collect(Collectors.toList());
+		try{
+//			List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span.ng-binding:nth-of-type(2)");
+			List<WebElement> rows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id^='artifact-item'] span[data-tests-id^='artifactDisplayName']");
+			for (WebElement r : rows){
+				String artifactDisplayed = r.getAttribute("textContent").trim();
+				if (artifactList.contains(artifactDisplayed)){
+					artifactList.remove(artifactDisplayed);
+				}
+				else if (artifactDisplayed.toLowerCase().contains("license")){
+					artifactList.add(artifactDisplayed);
+				}
+			}
+			checkLicenseArtifactsDisplayed(artifactList);
+		}
+		catch(Exception e){
+			throw new Exception("Table problem");
+		}
+		
+		
+		if (!artifactList.isEmpty()){
+			throw new Exception(String.format("missing the following artifact(s) : %s", artifactList.toString()));
+		}
+	}
+
+	public static void checkEnvArtifactsDisplayed() throws Exception {
+		List<WebElement> envRows;
+		List<WebElement> heatRows;
+		List<WebElement> heatNetRows;
+		List<WebElement> heatVolRows;
+		int envArtifactsSize = 0;
+		
+		SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the HEAT_ENV artifacts in the table");
+		
+		try{
+			envRows = GeneralUIUtils.getElementsByCSS("div div[data-tests-id='HEAT_ENV']");
+			
+			heatRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT']");
+			heatNetRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT_NET']");
+			heatVolRows = GeneralUIUtils.getElementsByCSS("div div[tooltip-content='HEAT_VOL']");
+			
+			envArtifactsSize = heatRows.size() + heatNetRows.size() + heatVolRows.size();
+		}
+		catch(Exception e){
+			throw new Exception("Table problem");
+		}
+		
+		if (envArtifactsSize !=envRows.size()){
+			throw new Exception(String.format("some env artifacts are missing... there is %s instead of %s", envRows.size(), envArtifactsSize));	
+		}
+		
+	}
+
+	public static void checkLicenseArtifactsDisplayed(List<String> rowsFromTable) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Verifying the license artifacts in the table");
+		String vfLicense =   getPreparedLicense(ArtifactTypeEnum.VF_LICENSE.getType());
+		String[] split = vfLicense.split(" ");
+		vfLicense = vfLicense.replaceAll(split[0], split[0].toUpperCase());
+		if (rowsFromTable.contains(vfLicense)){
+			rowsFromTable.remove(vfLicense);
+		}
+		
+		String vendorLicense = getPreparedLicense(ArtifactTypeEnum.VENDOR_LICENSE.getType());
+		if (rowsFromTable.contains(vendorLicense)){ 
+			rowsFromTable.remove(vendorLicense);
+		}
+
+	}
+
+	public static String getPreparedLicense(String license) {
+		return WordUtils.capitalizeFully(license.replaceAll("_", " "));
+	}
+	
+
+	private static String getVisualArtifactName(String artifactName) {
+		if (artifactName.contains(".")){
+			return artifactName.substring(0, artifactName.lastIndexOf("."));
+		}
+		return artifactName;
+	}
+	
+	public static void updateDescription(String newDescription, ArtifactInfo artefact) throws Exception{
+		UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+		DeploymentArtifactPage.clickEditArtifact(artefact.getArtifactLabel());
+		artifactPopup.insertDescription(newDescription);
+		artifactPopup.clickDoneButton();
+	}
+	
+	public static List<String> getDeploymentArtifactsNamesWorkSpace() {
+		return GeneralUIUtils.getWebElementListText(GeneralUIUtils.getWebElementsListByContainTestID(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue()));
+	}
+	
+	//Get Artifact Type by Artifact Name.
+	public static String getArtifactType(String artifactName){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.TYPE.getValue()+artifactName).getText();
+	}
+	
+	public static List<String> getHeatParametersInUI(String dataTestId){
+		List<WebElement>elements;
+		List<String>Names=new ArrayList<>();
+		elements=GeneralUIUtils.getWebElementsListByContainTestID(dataTestId);
+				for (WebElement webElement : elements) {
+					String attributevalue=webElement.getAttribute("data-tests-id");
+					Names.add(attributevalue.replace("heatParameterName_", ""));
+				}
+		return Names;
+	}
+	
+	public static void searchBoxEnv(String parameterName) {
+		GeneralUIUtils.getWebElementByContainsClassName("w-sdc-env-search-input").sendKeys(parameterName);
+	}
+	
+	public static void clearSearchBoxEnv() {
+		GeneralUIUtils.getWebElementByContainsClassName("w-sdc-env-search-input").clear();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
new file mode 100644
index 0000000..5ee85e0
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/DeploymentPage.java
@@ -0,0 +1,239 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DeploymentScreen;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import static org.testng.Assert.assertTrue;
+
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentPage  {
+	
+	public DeploymentPage() {
+		super();		
+	}
+	
+	public static List<WebElement> getGroupMembersList(String instanceName) {
+		List<WebElement> propertyRows = null;
+		clickOnModuleName(instanceName);
+		propertyRows = getVisibleMembers();
+		return propertyRows;
+	}
+
+	public static void clickOnModuleName(String instanceName) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", instanceName));
+		GeneralUIUtils.clickOnElementByText(instanceName);		
+		GeneralUIUtils.ultimateWait();
+	}
+
+	public static List<WebElement> getVisibleMembers() {
+		List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='hierarchy-module-member-list']"));
+		for (WebElement instance : instancesFromTable){
+			Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+			if (!parentAttributes.toString().contains("hidden")){
+				return instance.findElements(By.cssSelector("div[class^='expand-collapse-sub-title']"));
+			}
+		}
+		return null;
+	}
+	
+	public static void clickOnProperties() throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Properties button"));
+		GeneralUIUtils.clickOnElementByCSS(DataTestIdEnum.DeploymentScreen.BUTTON_PROPERTIES.getValue());
+		GeneralUIUtils.ultimateWait();	
+	}
+	
+	public static void clickOnArtifacts() throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Artifacts button"));
+		GeneralUIUtils.clickOnElementByCSS(DataTestIdEnum.DeploymentScreen.BUTTON_ARTIFACTS.getValue());
+		GeneralUIUtils.ultimateWait();	
+	}
+	
+	public static void clickOnSaveButton(){
+		clickInDeployment(DataTestIdEnum.DeploymentScreen.SAVE);
+		GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner"));
+	}
+	
+    public static void clickOnCancelButton(){
+    	clickInDeployment(DataTestIdEnum.DeploymentScreen.CANCEL);
+    	GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner"));
+	}
+    
+    public static void clickOnXIcon(){
+    	clickInDeployment(DataTestIdEnum.DeploymentScreen.X_BUTTON);
+    	GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("popover-inner"));
+    }
+    
+    public static void clickOnEditIcon(){
+    	clickInDeployment(DataTestIdEnum.DeploymentScreen.PENCIL_ICON);
+    }
+    
+    public static void clickOnProperty(WebElement property) {
+    	SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s propertie ...", property.getText()));
+    	property.click();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
+	}
+    
+    private static void clickInDeployment(DataTestIdEnum.DeploymentScreen element){
+    	SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s ...", element.getValue()));
+    	GeneralUIUtils.clickOnElementByTestId(element.getValue());
+    	GeneralUIUtils.ultimateWait();
+    }
+    
+    public static List<WebElement> getPropertyNames() throws Exception{
+    	clickOnProperties();
+    	return GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.PROPERTY_NAMES.getValue());
+    }
+    
+    public static List<WebElement> getArtifactNames() throws Exception{
+    	clickOnArtifacts();
+    	return GeneralUIUtils.getInputElements(DataTestIdEnum.DeploymentScreen.ARTIFACT_NAME.getValue());
+    }
+    
+    public static String updateModuleName(String currentModuleName, String newModuleName) throws Exception {
+		GeneralUIUtils.ultimateWait();
+		ResourceUIUtils.clickOnElementByText(currentModuleName, null);
+		GeneralUIUtils.ultimateWait();
+		clickOnEditIcon();
+		WebElement moduleNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue());
+		String oldModuleName = moduleNameField.getAttribute("value");
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating %s module name ...", currentModuleName));
+		moduleNameField.clear();
+		GeneralUIUtils.ultimateWait();
+		moduleNameField.sendKeys(newModuleName);
+		GeneralUIUtils.ultimateWait();
+		clickOnSaveButton();	
+		String newReconstructedModuleName = reconstructModuleName(currentModuleName.split("\\.\\."), newModuleName);
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Name of element instance changed from %s to %s", currentModuleName, newReconstructedModuleName));
+		return oldModuleName;
+	}
+    
+    public static String reconstructModuleName(String[] splittedName, String middleName){
+    	int i = 0;
+    	StringBuilder builder = new StringBuilder();
+    	for(String s : splittedName) {
+    	    if (i == 1){
+    	    	builder.append(middleName);
+    	    } else {
+    	    	builder.append(s);
+    	    }
+    	    if (i < 2 ){
+    	    	builder.append("..");
+    	    }
+    	    i++;
+    	}
+    	return builder.toString();
+    }
+    
+    public static List<WebElement> getVisibleModulesService() {
+		List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='hierarchy-modules-list']"));
+		for (WebElement instance : instancesFromTable){
+			Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+			if (!parentAttributes.toString().contains("hidden")){
+				return instance.findElements(By.cssSelector("span[class^='expand-collapse-title-text']"));
+			}
+		}
+		return null;
+	}
+    
+    public static List<WebElement> getInstanceModulesList(String instanceName) {
+		List<WebElement> propertyRows = null;
+		ResourceUIUtils.clickOnElementByText(instanceName, null);
+		GeneralUIUtils.ultimateWait();
+		propertyRows = getVisibleModulesService();
+		return propertyRows;
+	}
+    
+    public static String getGroupVersion() throws Exception{
+    	return GeneralUIUtils.getElementsByCSS("div[data-tests-id='selected-module-version']").get(0).getText();
+    }
+    
+    public static String getModuleID() throws Exception{
+    	return GeneralUIUtils.getElementsByCSS("div[data-tests-id='selected-module-group-uuid'] span[class^='small-font']").get(0).getText();
+    }   
+    
+    public static Map<String, HashMap<String, String>> collectMetaDataFromUI() throws Exception{
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen();
+		Map<String, HashMap<String, String>> deploymentViewMetaData = new HashMap<String, HashMap<String, String>>();
+		List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS("span[class^='expand-collapse-title-text']");
+		for(WebElement moduleRow :moduleRowsFromTable){
+			HashMap<String, String> tempGroupMap = new HashMap<String, String>();
+			String moduleRowText = moduleRow.getText();
+			GeneralUIUtils.clickOnElementByText(moduleRowText);
+			tempGroupMap.put("moduleID", getModuleID());
+			tempGroupMap.put("version", DeploymentPage.getGroupVersion().split(":")[1].trim());
+			deploymentViewMetaData.put(moduleRowText.split("\\.\\.")[1], tempGroupMap);
+			GeneralUIUtils.clickOnElementByText(moduleRowText);
+		}
+		return deploymentViewMetaData;
+	}
+    
+    public static void updateAndCancel(String newModuleName, DataTestIdEnum.DeploymentScreen buttonToClick){
+    	WebElement moduleNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue());
+		String oldModuleName = moduleNameField.getAttribute("value");
+		moduleNameField.clear();
+		GeneralUIUtils.ultimateWait();
+		moduleNameField.sendKeys(newModuleName);
+		GeneralUIUtils.ultimateWait();
+		if (buttonToClick.equals(DataTestIdEnum.DeploymentScreen.X_BUTTON))
+		    clickOnXIcon();
+		else
+			clickOnCancelButton();
+    }
+    
+    public static String getPropertyValueFromPropertiesList(String property) throws InterruptedException{
+    	List<WebElement> propertyDataElements = GeneralUIUtils.getElementsByCSS("div[class^='list-item property-data']");
+    	for(WebElement propertyDataElement: propertyDataElements){
+    		WebElement propertyNameElement = GeneralUIUtils.getElementfromElementByCSS(propertyDataElement, DeploymentScreen.PROPERTY_NAMES.getValue());
+    		if (propertyNameElement.getText().equals(property)){
+    			WebElement propertyValueElement = GeneralUIUtils.getElementfromElementByCSS(propertyDataElement, String.format("div[data-tests-id='%s']", DeploymentScreen.PROPERTY_SCHEMA_TYPE.getValue()));
+    			return propertyValueElement.getText().trim().split(":")[1].trim();
+    		}
+    	}
+    	return null;
+    }
+    
+    public static List<WebElement> getPropertyErrorValidationMessdge() throws Exception{
+    	List<WebElement> propertyErrorElements = GeneralUIUtils.getElementsByCSS("div[class='input-error'] span[class='ng-scope']");
+    	return propertyErrorElements;
+    }
+    
+    public static boolean isPropertySaveButtonDisabled(){
+    	WebElement saveButtonElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue());
+    	return GeneralUIUtils.isElementDisabled(saveButtonElement);
+    }
+    
+    
+    
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
new file mode 100644
index 0000000..04e3a8b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GeneralPageElements.java
@@ -0,0 +1,160 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+import java.util.function.Supplier;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class GeneralPageElements {
+
+    public GeneralPageElements() {
+                    super();
+    }
+
+    public static ResourceLeftMenu getLeftMenu() {
+                    return new ResourceLeftMenu();
+    }
+                
+    public static void clickOKButton() {
+        SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the OK button");
+        GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+        GeneralUIUtils.waitForLoader();
+	}
+
+    public static void clickCreateButton() {
+        SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button.");
+        GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+        GeneralUIUtils.ultimateWait();
+        GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue()); 
+        ExtentTestActions.log(Status.INFO, "Succeeded.");
+    }
+    
+    public static void clickCreateButton(int timeout) {
+        SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CREATE/UPDATE button");
+        GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue(), timeout);
+        GeneralUIUtils.ultimateWait();
+        GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+    }
+    
+	public static void clickUpdateButton(){
+		clickCreateButton();
+	}
+
+    public static void clickCheckinButton(String componentName) throws Exception {
+        SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the CHECKIN button");
+        GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+        GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys("Checkin " + componentName);
+        GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+        GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60);
+        GeneralUIUtils.ultimateWait();
+    }
+
+    public static void clickSubmitForTestingButton(String componentName) throws Exception {
+        SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on the submiting for testing button");
+        GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.SUBMIT_FOR_TESTING_BUTTON.getValue());
+        GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.SUMBIT_FOR_TESTING_MESSAGE.getValue()).sendKeys("Submit for testing " + componentName);
+        GeneralUIUtils.ultimateWait();
+        GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+        GeneralUIUtils.ultimateWait();
+        GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue(), 60);
+        GeneralUIUtils.ultimateWait();;
+    }
+    
+    public static void clickCheckoutButton() throws Exception{
+    	SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on CHECKOUT button ...");
+    	GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.CHECKOUT_BUTTON.getValue());
+    	GeneralUIUtils.ultimateWait();
+    }
+
+	public static void clickDeleteVersionButton() throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on DELETE VERSION button ...");
+		GeneralUIUtils.ultimateWait();
+		GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue());
+		GeneralUIUtils.ultimateWait();
+    }
+
+	public static void clickRevertButton() throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on REVERT button ...");
+		GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.REVERT_BUTTON.getValue());
+    }
+
+    public static String getLifeCycleState() {
+        return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue()).getText();
+    }
+
+    public static void selectVersion(String version) {
+        GeneralUIUtils.getSelectList(version, DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue());
+        GeneralUIUtils.ultimateWait();
+    }
+
+    public static List<WebElement> getElemenetsFromTable() {
+	    GeneralUIUtils.ultimateWait();;
+	    return GeneralUIUtils.getElemenetsFromTable(By.className("flex-container"));
+    }
+
+    public static boolean checkElementsCountInTable(int expectedElementsCount) {
+        return checkElementsCountInTable(expectedElementsCount, () -> getElemenetsFromTable());
+    }
+                
+                
+    public static void clickTrashButtonAndConfirm() throws InterruptedException{
+    	SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on TRASH button ...");
+		GeneralUIUtils.clickOnAreaJS(DataTestIdEnum.GeneralElementsEnum.DELETE_VERSION_BUTTON.getValue());
+		clickOKButton();
+	}                
+    
+    public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
+    	SetupCDTest.getExtendTest().log(Status.INFO, "Checking the number of elements in the table; should be " + (expectedElementsCount - 1));
+//        int maxWaitingPeriodMS = 10*1000;
+//        int napPeriodMS = 200;
+//        int sumOfWaiting = 0;
+//        List<WebElement> elements = null;
+//        boolean isKeepWaiting = false;
+//        while (!isKeepWaiting) {
+//	        GeneralUIUtils.sleep(napPeriodMS);
+//	        sumOfWaiting += napPeriodMS;
+//	        elements = func.get();
+//	        isKeepWaiting = (expectedElementsCount == elements.size());
+//	        if (sumOfWaiting > maxWaitingPeriodMS)
+//                return false;
+//        }
+    	GeneralUIUtils.ultimateWait();
+        return true;
+    }
+    
+    public static void clickDeleteFile() throws Exception{
+    	SetupCDTest.getExtendTest().log(Status.INFO, "Clicking on delete file X-button ...");
+    	GeneralUIUtils.clickOnAreaJS(GeneralUIUtils.getWebElementBy
+    			(By.cssSelector("div[class='i-sdc-form-file-upload-x-btn']")));
+    	GeneralUIUtils.ultimateWait();;
+    }    
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java
new file mode 100644
index 0000000..ff964e3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/GovernorOperationPage.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class GovernorOperationPage {
+
+	public GovernorOperationPage() {
+		super();
+	}
+
+	public static void approveSerivce(String serviceName) {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Approving the distrbution of the service " + serviceName);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE.getValue()).click();
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.APPROVE_MESSAGE.getValue())
+				.sendKeys("service " + serviceName + " tested successfuly");
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
new file mode 100644
index 0000000..84451dc
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/HomePage.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.io.File;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.MainMenuButtonsFromInsideFrame;
+import org.openecomp.sdc.ci.tests.utilities.DownloadManager;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+public class HomePage extends GeneralPageElements {
+
+	public HomePage() {
+		super();
+	}
+	
+	public static void showVspRepository(){
+		GeneralUIUtils.waitForElementInVisibilityBy(By.className("ui-notification"), 30);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.MainMenuButtons.REPOSITORY_ICON.getValue());
+	}
+	
+	public static boolean searchForVSP(String vspName){
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ImportVfRepository.SEARCH.getValue()).sendKeys(vspName);
+		return checkElementsCountInTable(2);
+	}
+	
+	public static void importVSP(String vspName){
+		HomePage.showVspRepository();
+		boolean vspFound = HomePage.searchForVSP(vspName);
+		if (vspFound){
+			List<WebElement> elemenetsFromTable = getElemenetsFromTable();
+//			GeneralUIUtils.waitForLoader();
+			WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+			WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+			findElement.click();
+			GeneralUIUtils.waitForLoader();
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue());
+        	GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+        	GeneralUIUtils.waitForLoader(60*10);
+        	GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+		}
+	}
+				
+			
+	public static boolean navigateToHomePage() {
+		try{
+			System.out.println("Searching for reporsitory icon.");
+			WebElement repositoryIcon = GeneralUIUtils.getInputElement("repository-icon");
+			if (repositoryIcon != null){
+				return true;
+			}
+			else{
+				GeneralUIUtils.ultimateWait();
+				List<WebElement> homeButtons = GeneralUIUtils.getElemenetsFromTable(By.xpath("//a[contains(.,'HOME')]"));
+				if (homeButtons.size() != 0){
+					for (WebElement home : homeButtons){
+						if (home.isDisplayed()){
+							home.click();
+							System.out.println("Clicked on home button");
+							break;
+						}
+					}
+					GeneralUIUtils.closeErrorMessage();
+					WebElement homeButton = GeneralUIUtils.getInputElement(DataTestIdEnum.MainMenuButtons.HOME_BUTTON.getValue());
+					return homeButton.isDisplayed();
+				}
+	
+			}
+		}
+		catch(Exception innerException){
+			System.out.println("Can't click on home button.");
+			return false;
+		}
+		return false;
+	}
+
+	public static File downloadVspCsarToDefaultDirectory(String vspName) throws Exception {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtonsFromInsideFrame.HOME_BUTTON.getValue()).click();
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, "");
+		File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		return latestFilefromDir;
+	}
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java
new file mode 100644
index 0000000..fd9befa
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/IconPage.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ResourceCategoryEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class IconPage extends GeneralPageElements {
+
+	public IconPage() {
+		super();
+	}
+
+	public static void clickOnIcon(ResourceCategoryEnum iconName) {
+		GeneralUIUtils.getWebElementByTestID(iconStringBuilder(iconName) + DataTestIdEnum.ServiceMetadataEnum.ICON.getValue())
+				.click();
+	}
+
+	private static String iconStringBuilder(ResourceCategoryEnum icon) {
+		String iconName = icon.getSubCategory();
+		String[] splitedIconName = iconName.split(" ");
+		splitedIconName[0] = splitedIconName[0].toLowerCase();
+
+		StringBuilder sb = new StringBuilder();
+		for (String word : splitedIconName) {
+			sb.append(word);
+		}
+
+		return sb.toString();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java
new file mode 100644
index 0000000..9916292
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InformationalArtifactPage.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class InformationalArtifactPage extends DeploymentArtifactPage {
+
+	public InformationalArtifactPage() {
+		super();
+	}
+
+	public static void clickAddNewArtifact() {
+		addNewArtifact(ArtifactGroupTypeEnum.INFORMATIONAL);
+	}
+
+	public static String getArtifactDescription(String artifactLabel) throws Exception {
+		InformationalArtifactPage.clickOnArtifact(artifactLabel);
+		String artifactDesc = GeneralUIUtils.getWebElementByTestID(
+				artifactLabel + DataTestIdEnum.ArtifactPageEnum.GET_INFORMATIONAL_ARTIFACT_DESCRIPTION.getValue())
+				.getText();
+		InformationalArtifactPage.clickOnArtifact(artifactLabel); // close artifact
+		return artifactDesc;
+	}
+
+	public static List<WebElement> getElemenetsFromTable() {
+		return GeneralUIUtils.getWebElementsListByTestID("InformationalArtifactRow");
+	}
+	
+	public static WebElement clickOnArtifact(String artifactLabel) throws Exception {
+		try{
+			WebElement artifact = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel);
+			artifact.click();
+			GeneralUIUtils.waitForLoader();
+			return artifact;
+		}
+		catch(Exception e){
+			throw new Exception("Artifact " + artifactLabel + "is not found");
+		}
+	}
+	
+	
+	public static void clickDeleteArtifact(String artifactLabel) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting %s Artefact ",artifactLabel));
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + artifactLabel).click();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java
new file mode 100644
index 0000000..b977b26
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/InputsPage.java
@@ -0,0 +1,158 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InputsScreenService;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.TestException;
+
+import com.aventstack.extentreports.Status;
+
+public class InputsPage extends GeneralPageElements {
+
+	public InputsPage() {
+		super();
+		
+	}
+
+	public static List<WebElement> getInstancePropertiesList(String instanceName) {
+		List<WebElement> propertyRows = null;
+		GeneralUIUtils.clickOnElementByText(instanceName);
+		GeneralUIUtils.ultimateWait();
+		propertyRows = getVisibleProperites();
+		return propertyRows;
+	}
+
+	public static List<WebElement> getVisibleProperites() {
+		List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='vf-instance-list']"));
+		for (WebElement instance : instancesFromTable){
+			Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+			if (!parentAttributes.toString().contains("hidden")){
+				return instance.findElements(By.className("property-row"));
+			}
+		}
+		return null;
+	}
+	
+	public static void addInputToService(String VFInstanceName, String propertyName) throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding property %s from VF instance %s to Service", propertyName, VFInstanceName));
+		List<WebElement> instaceInputs = getInstanceInputsList(VFInstanceName);
+		for(WebElement instancInput: instaceInputs){
+			String actualPropertyName = instancInput.findElement(By.className("title-text")).getText();
+			if (actualPropertyName.equals(propertyName) && clickOnVFInputCheckbox(instancInput)){
+				clickOnAddInputButton();
+			}
+		}
+	}
+
+    public static List<WebElement> getInstanceInputsList(String instanceName) {
+		List<WebElement> inputRows = null;
+		GeneralUIUtils.clickOnElementByText(instanceName);
+		GeneralUIUtils.ultimateWait();
+		inputRows = getVisibleInputs(inputRows);
+		return inputRows;
+    }
+    
+	public static List<WebElement> getVisibleInputs(List<WebElement> inputRows) {
+		List<WebElement> instancesFromTable = GeneralUIUtils.getDriver().findElements(By.cssSelector("div[class^='vf-instance-list']"));
+		for (WebElement instance : instancesFromTable){
+			Object parentAttributes = GeneralUIUtils.getAllElementAttributes(instance);
+			if (!parentAttributes.toString().contains("hidden")){
+				inputRows = instance.findElements(By.className("input-row"));
+				break;
+			}
+		}
+		return inputRows;
+	}
+	
+	public static void clickOnAddInputButton(){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Add Input aka Greater than symbol button"));
+		GeneralUIUtils.clickOnElementByTestId(InputsScreenService.ADD_SELECTED_INPUTS_BTN.getValue());
+		GeneralUIUtils.ultimateWait();		
+	}
+	
+	public static boolean clickOnVFInputCheckbox(WebElement instancInput){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on VF instance input checkbox"));
+		instancInput.findElement(By.className("tlv-checkbox-label")).click();
+		GeneralUIUtils.ultimateWait();
+		return instancInput.findElement(By.className("tlv-checkbox-i")).getAttribute("class").contains("ng-not-empty");
+	}
+	
+	public static WebElement getServiceInput(String VFInstanceName, String propertyName) throws Exception{
+		String expectedInputName = String.format("%s_%s", VFInstanceName.replace(" ", "").toLowerCase(), propertyName);
+		List<WebElement> inputsFromTable = GeneralUIUtils.getElementsByCSS(InputsScreenService.SERVICE_INPUT_ROW.getValue());
+	    for(WebElement inputFromTable: inputsFromTable){
+	    	String actualInputName = inputFromTable.findElement(By.className("title-text")).getText();
+	    	if(actualInputName.equals(expectedInputName)){
+	    		return inputFromTable;
+	    	}
+	    }
+	    throw new TestException(String.format("%s input don't exist", expectedInputName));
+	}
+	    
+	public static void deleteServiceInput(String VFInstanceName, String propertyName) throws Exception{
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Deleting property %s in VF instance %s ", propertyName, VFInstanceName));
+		WebElement serviceInput = getServiceInput(VFInstanceName, propertyName);
+		serviceInput.findElement(By.cssSelector(InputsScreenService.DELETE_INPUT_BTN.getValue())).click();
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on OK button "));
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.GeneralElementsEnum.OK.getValue());
+		GeneralUIUtils.ultimateWait();		
+	}
+	
+	public static List<String> getVFCInstancesNamesFromTable() throws Exception{
+		WebElement inputsTable = getInputsTable("VFC ");
+	    return	 inputsTable.findElements(By.cssSelector("span[class^='title-text']")).stream().
+	    		     map(e -> e.getText()).
+	    		     collect(Collectors.toList());
+	}
+	
+	public static WebElement getInputsTable(String tableName) throws Exception{
+		 List<WebElement> tableElements = GeneralUIUtils.getElementsByCSS("div.table");
+		 for(WebElement tableElement: tableElements){
+			 String tableTitle = GeneralUIUtils.getElementfromElementByCSS(tableElement, "div.table-header").getText();
+			 if (tableTitle.contains(tableName)){
+				 return tableElement;
+			 }
+		 }
+		 throw new TestException(String.format("Can't find %s table", tableName));
+	}
+	
+	public static void clickOnProperty(String propertyName) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on property %s ", propertyName));
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.InputsScreenService.RESOURCE_INSTANCE_PROPERTY_NAME.getValue() + propertyName);
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	
+	
+	
+	
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java
new file mode 100644
index 0000000..82171b8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/OpsOperationPage.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+public class OpsOperationPage {
+
+	public OpsOperationPage() {
+		super();
+	}
+
+	public static void distributeService() {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Distributing");
+		clickOnButton(DataTestIdEnum.DistributionChangeButtons.DISTRIBUTE);
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue());
+	}
+
+	public static void displayMonitor() {
+		GeneralUIUtils.moveToStep(StepsEnum.MONITOR);
+	}
+
+	public static void re_distributeService() {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Redistributing...");
+		clickOnButton(DataTestIdEnum.DistributionChangeButtons.RE_DISTRIBUTE);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DistributionChangeButtons.MONITOR.getValue());
+	}
+
+	private static void clickOnButton(DataTestIdEnum.DistributionChangeButtons button) {
+		GeneralUIUtils.getWebElementByTestID(button.getValue()).click();
+		GeneralUIUtils.waitForLoader();
+	}
+
+	public static List<WebElement> getRowsFromMonitorTable() {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Counting the rows from the distribution table");
+		GeneralPageElements.checkElementsCountInTable(1, () -> GeneralUIUtils.getWebElementsListByTestID("ditributionTable"));
+		List<WebElement> distributionRecords = GeneralUIUtils.getWebElementsListByTestID("ditributionTable");
+		List<WebElement> findElements = distributionRecords.get(0).findElements(By.className("w-sdc-distribute-parent-block"));
+		return findElements;
+	}
+
+	public static void showDistributionStatus(int rowIndex) {
+		GeneralUIUtils.getWebElementByTestID("ShowRecordButton_" + String.valueOf(rowIndex)).click();
+		GeneralUIUtils.waitForLoader();
+	}
+
+	public static String getTotalArtifactsSum(int rowIndex) {
+		return GeneralUIUtils.getWebElementByTestID("totalArtifacts_" + String.valueOf(rowIndex)).getText();
+	}
+
+	public static String getNotifiedArtifactsSum(int rowIndex) {
+		return GeneralUIUtils.getWebElementByTestID("notified_" + String.valueOf(rowIndex)).getText();
+	}
+
+	public static String getDownloadedArtifactsSum(int rowIndex) {
+		return GeneralUIUtils.getWebElementByTestID("downloaded_" + String.valueOf(rowIndex)).getText();
+	}
+
+	public static String getDeployedArtifactsSum(int rowIndex) {
+		return GeneralUIUtils.getWebElementByTestID("deployed_" + String.valueOf(rowIndex)).getText();
+	}
+
+	public static String getNotNotifiedArtifactsSum(int rowIndex) {
+		return GeneralUIUtils.getWebElementByTestID("NotNotified_" + String.valueOf(rowIndex)).getText();
+	}
+
+	public static String getErrorsSum(int rowIndex) {
+		return GeneralUIUtils.getWebElementByTestID("errors_" + String.valueOf(rowIndex)).getText();
+	}
+
+	public static void clickRefreshTableButton(int rowIndex) {
+		GeneralUIUtils.getWebElementByTestID("refreshButton").click();
+		// wait until total artifacts field disappear
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 90);
+		wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + "totalArtifacts_" + String.valueOf(rowIndex) + "']")));
+	}
+
+	public static void waitUntilArtifactsDistributed(int rowIndex) throws Exception {
+		waitUntilArtifactsDistributed("0", 0);
+	}
+
+	public static void waitUntilArtifactsDistributed(String expectedArtifactsSum, int rowIndex) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Waiting until all artifacts are distributed");
+		boolean isKeepWaiting = true;
+		int maxWaitingPeriodMS = 5 * 60 * 1000;
+		int sumWaitingTime = 0;
+		int napPeriod = 10000;
+		while (isKeepWaiting) {
+			showDistributionStatus(rowIndex);
+			String actualTotalArtifactsSize = getTotalArtifactsSum(rowIndex);
+			String actualNotifiedArtifactsSize = getNotifiedArtifactsSum(rowIndex);
+			String actualDownloadedArtifactsSize = getDownloadedArtifactsSum(rowIndex);
+			String actualDeployedArtifactsSize = getDeployedArtifactsSum(rowIndex);
+			String actualNotNotifedArtifactsSize = getNotNotifiedArtifactsSum(rowIndex);
+			isKeepWaiting = !actualTotalArtifactsSize.equals(actualDownloadedArtifactsSize)
+					|| !actualTotalArtifactsSize.equals(actualNotifiedArtifactsSize)
+					|| !actualTotalArtifactsSize.equals(actualDeployedArtifactsSize)
+					|| actualTotalArtifactsSize.equals("0") || actualDownloadedArtifactsSize.equals("0")
+					|| actualNotifiedArtifactsSize.equals("0") || actualDeployedArtifactsSize.equals("0");
+			
+			if (isKeepWaiting) {
+
+				if (Integer.parseInt(actualNotNotifedArtifactsSize) > 1) {
+					SetupCDTest.getExtendTest().log(Status.INFO, "Some artifacts are not notified");
+					isKeepWaiting = false;
+					throw new Exception("Some artifacts are not notified...");
+				}
+
+				GeneralUIUtils.sleep(napPeriod);
+				sumWaitingTime += napPeriod;
+
+				if (sumWaitingTime > maxWaitingPeriodMS) {
+					SetupCDTest.getExtendTest().log(Status.INFO, "Not all artifacts are displayed");
+					isKeepWaiting = false;
+					throw new Exception(String.format("Not all artifacts are displayed withing %s seconds",
+							String.valueOf(maxWaitingPeriodMS / 1000)));
+				}
+
+				clickRefreshTableButton(rowIndex);
+			}
+		}
+
+		SetupCDTest.getExtendTest().log(Status.INFO, "All artifacts were successfully distributed");
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java
new file mode 100644
index 0000000..3bec4f6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductGeneralPage.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.ArrayList;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class ProductGeneralPage extends ResourceGeneralPage {
+
+	public ProductGeneralPage() {
+		super();
+	}
+	
+	public static ProductLeftMenu getProductLeftMenu() {
+        return new ProductLeftMenu();
+    }
+
+	public static void defineName(String productName) {
+		WebElement productNameTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PRODUCT_NAME.getValue());
+		productNameTextbox.clear();
+		productNameTextbox.sendKeys(productName);
+	}
+
+	public static void defineFullName(String productFullName) {
+		WebElement productFullNameTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.FULL_NAME.getValue());
+		productFullNameTextbox.clear();
+		productFullNameTextbox.sendKeys(productFullName);
+	}
+	
+	public static void defineProjectCode(String pmat) {
+		WebElement pmattTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PROJECT_CODE.getValue());
+		pmattTextbox.clear();
+		pmattTextbox.sendKeys(pmat);
+	}
+	
+	public static String getPmattText(){
+		return getPmattField().getAttribute("value");
+	}
+	
+	public static String[] getTags(){
+		return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new);
+	}
+	
+	private static WebElement getPmattField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.PROJECT_CODE.getValue());
+	}
+	
+	public static void deleteOldTags(ProductReqDetails product){
+		// Delete tag elements
+		int i = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-delete").size();
+		while (i > 0){			
+			GeneralUIUtils.getWebElementByTestID("i-sdc-tag-delete").click();
+			i--;
+		}
+		
+		product.setTags(new ArrayList<String>());
+	}
+	
+	public static void clickAddWorkflow (){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding workflow..."));
+		GeneralUIUtils.clickOnElementByText("Add Workflow");
+	}
+	
+	public static void fillAndAddNewWorkflow(String name, String description ) throws InterruptedException{
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling name field with %s", name));
+		insertText(name, "label + input");
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling description filed with %s", name));
+		insertText(description,"label + textarea");
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking save button "));
+		clickSave();
+	}
+	
+	public static void insertText(String artifactDescriptoin, String element) throws InterruptedException {
+		GeneralUIUtils.getElementsByCSS("div[class='modal-content']");
+		WebElement artifactDescriptionTextbox = GeneralUIUtils.getWebElementBy(By.cssSelector(element));
+		artifactDescriptionTextbox.clear();
+		artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+		GeneralUIUtils.ultimateWait();		
+	}
+	
+	public static void clickSave() {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save button"));
+		GeneralUIUtils.clickOnElementByText("Save");
+		GeneralUIUtils.ultimateWait();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java
new file mode 100644
index 0000000..2972e59
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ProductLeftMenu.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class ProductLeftMenu implements ComponentLeftMenu {
+
+	public void moveToGeneralScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.GENERAL);
+	}
+
+	public void moveToIconScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.ICON);
+	}
+
+	public void moveToCompositionScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+	}
+	
+	public void moveToHierarchyScreen() {
+		GeneralUIUtils.moveToStep(StepsEnum.HIERARCHY);
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java
new file mode 100644
index 0000000..4899ab1
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertiesPage.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertiesPage extends GeneralPageElements {
+
+	public PropertiesPage() {
+		super();
+	}
+
+	public static List<WebElement> getElemenetsFromTable() {
+		return GeneralUIUtils.getInputElements(DataTestIdEnum.PropertiesPageEnum.PROPERTY_ROW.getValue());
+	}
+
+	public static void clickAddPropertyArtifact() {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ADD_NEW_PROPERTY.getValue()).click();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue());
+	}
+
+	public static void clickEditPropertyArtifact(String propertyName) {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.EDIT_PROPERTY.getValue() + propertyName).click();
+	}
+
+	public static void clickDeletePropertyArtifact(String propertyName) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Delete property %s", propertyName));
+		GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPageEnum.DELETE_PROPERTY.getValue() + propertyName);
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+		GeneralUIUtils.waitForElementInVisibilityBy(By.className("w-sdc-modal-confirmation"), 10);
+	}
+
+	public static void clickOnProperty(String propertyName) {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propertyName).click();
+	}
+
+	public static PropertyPopup getPropertyPopup() {
+		return new PropertyPopup();
+	}
+	
+	public static boolean verifyTotalProperitesField(int count){
+		String totalPropertiesCount = GeneralUIUtils.getWebElementBy(By.id("properties-count")).getText();
+		return ("Total Properties: " + count).equals(totalPropertiesCount);
+	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java
new file mode 100644
index 0000000..5052406
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/PropertyPopup.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertyPopup {
+	
+
+	public PropertyPopup() {
+	}
+
+	public boolean getPopupForm(){
+		return GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.PropertiesPageEnum.POPUP_FORM.getValue(), 60);
+	}
+	
+	public void insertPropertyName(String name) {
+		WebElement propertyNameField = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_NAME.getValue());
+		propertyNameField.clear();
+		propertyNameField.sendKeys(name);
+	}
+
+	public void insertPropertyDefaultValue(String value) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Inserting to property default value: %s ", value));
+		WebElement selectedType = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue())).getFirstSelectedOption();
+		if(selectedType.getText().equals("boolean")) {
+			GeneralUIUtils.getSelectList(value, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue());
+		} else {
+			WebElement propertyValue = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_VALUE.getValue());
+			propertyValue.clear();
+			propertyValue.sendKeys(value);
+		}	
+		
+		GeneralUIUtils.ultimateWait();
+	}
+
+	public void insertPropertyDescription(String description) {
+		WebElement propertyDescription = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_DESCRIPTION.getValue());
+		propertyDescription.clear();
+		propertyDescription.sendKeys(description);
+	}
+
+	public void selectPropertyType(String propertyType) {
+		boolean isEntrySchemaDisplayed;
+		try{
+			GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue());
+			isEntrySchemaDisplayed = GeneralUIUtils.getDriver().findElement(By.xpath(DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue())).isDisplayed();
+			if (isEntrySchemaDisplayed){
+				PropertiesPage.getPropertyPopup().selectEntrySchema(propertyType);
+			}
+		}
+		catch(NoSuchElementException e){
+			
+		}
+	}
+	
+	public void selectEntrySchema(String propertyType){
+		GeneralUIUtils.getSelectList(propertyType, DataTestIdEnum.PropertiesPopupEnum.ENTRY_SCHEMA.getValue());
+	}
+
+	public void clickAdd() {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.ADD.getValue());
+		GeneralUIUtils.ultimateWait();
+	}
+
+	public void clickSave() {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.SAVE.getValue());
+		getPopupForm();
+	}
+
+	public void clickCancel() {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.CANCEL.getValue());
+		GeneralUIUtils.ultimateWait();
+	}
+
+	public void clickDone() {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.PropertiesPopupEnum.DONE.getValue());
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public void selectPropertyRadioButton(String propertyName) {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_RADIO_BUTTON_CONTAINER.getValue() + propertyName).findElement(By.className(DataTestIdEnum.PropertiesPopupEnum.RADIO_BUTTON_CLASS.getValue())).click();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java
new file mode 100644
index 0000000..1412a4b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceGeneralPage.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+
+
+public class ResourceGeneralPage extends GeneralPageElements {
+
+	public ResourceGeneralPage() {
+		super();
+	}
+
+	public static WebElement getNameField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.RESOURCE_NAME.getValue());
+	}
+
+	public static WebElement getDescriptionField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.DESCRIPTION.getValue());
+	}
+
+	public static String getCategoryDataTestsIdAttribute() {
+		return DataTestIdEnum.ResourceMetadataEnum.CATEGORY.getValue();
+	}
+
+	public static WebElement getVendorNameField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.VENDOR_NAME.getValue());
+	}
+
+	public static WebElement getVendorReleaseField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.VENDOR_RELEASE.getValue());
+	}
+
+	public static WebElement getTagsField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.TAGS.getValue());
+	}
+
+	public static WebElement getContactIdField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ResourceMetadataEnum.CONTACT_ID.getValue());
+	}
+
+	/***************************************************************/
+
+	public static String getNameText() {
+		return getNameField().getAttribute("value");
+	}
+
+	public static void defineName(String resourceName) {
+		WebElement resourceNameTextbox = getNameField();
+		resourceNameTextbox.clear();
+		resourceNameTextbox.sendKeys(resourceName);
+	}
+	
+	public static void defineNameWithPaste() {
+		defineTextBoxWithPaste(getNameField());
+	}
+
+	public static String getDescriptionText() {
+		return getDescriptionField().getAttribute("value");
+	}
+
+	public static void defineDescription(String description) {
+		WebElement descriptionTextbox = getDescriptionField();
+		descriptionTextbox.clear();
+		descriptionTextbox.sendKeys(description);
+	}
+	
+	public static void defineDescriptionWithPaste() {
+		defineTextBoxWithPaste(getDescriptionField());
+	}
+
+	public static String getVendorNameText() {
+		return getVendorNameField().getAttribute("value");
+	}
+
+	public static void defineVendorName(String vendorName) {
+		WebElement vendorNameTextbox = getVendorNameField();
+		vendorNameTextbox.clear();
+		vendorNameTextbox.sendKeys(vendorName);
+	}
+	
+	public static void defineVendorNameWithPaste() {
+		defineTextBoxWithPaste(getVendorNameField());
+	}
+
+	public static String getVendorReleaseText() {
+		return getVendorReleaseField().getAttribute("value");
+	}
+
+	public static void defineVendorRelease(String vendorRelease) {
+		WebElement vendorReleaseTextbox = getVendorReleaseField();
+		vendorReleaseTextbox.clear();
+		vendorReleaseTextbox.sendKeys(vendorRelease);
+	}
+	
+	public static void defineVendorReleaseWithPaste() {
+		defineTextBoxWithPaste(getVendorReleaseField());
+	}
+
+	public static void defineTag(String resourceTags) {
+		WebElement tagTextbox = getTagsField();
+		tagTextbox.clear();
+		tagTextbox.sendKeys(resourceTags);
+		tagTextbox.sendKeys(Keys.ENTER);
+	}
+
+	public static void defineTagsList(ComponentReqDetails component, String[] tags) {
+		List<String> taglist = new ArrayList<String>();
+		WebElement resourceTagsTextbox = getTagsField();
+		for (String tag : tags) {
+			resourceTagsTextbox.clear();
+			resourceTagsTextbox.sendKeys(tag);
+			GeneralUIUtils.sleep(500);
+			resourceTagsTextbox.sendKeys(Keys.ENTER);
+			taglist.add(tag);
+		}
+		component.getTags().addAll(taglist);
+	}
+	
+	public static void defineTagsListWithPaste() {
+		List<String> taglist = new ArrayList<String>();
+		WebElement resourceTagsTextbox = getTagsField();
+		defineTextBoxWithPaste(resourceTagsTextbox);
+		resourceTagsTextbox.sendKeys(Keys.ENTER);
+	}
+
+	public static void defineCategory(String category) {
+		GeneralUIUtils.getSelectList(category, getCategoryDataTestsIdAttribute());
+	}
+
+	public static String getContactIdText() {
+		return getContactIdField().getAttribute("value");
+	}
+
+	public static void defineContactId(String userId) {
+		WebElement contactIdTextbox = getContactIdField();
+		contactIdTextbox.clear();
+		contactIdTextbox.sendKeys(userId);
+		GeneralUIUtils.waitForLoader();
+	}
+	
+	public static List<WebElement> getElementsFromTagsTable(){
+		return GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.ResourceMetadataEnum.TAGS_TABLE.getValue());
+	}
+	
+	public static void defineTextBoxWithPaste(WebElement textBox) {
+		textBox.clear();
+		textBox.sendKeys(Keys.CONTROL + "v");
+		GeneralUIUtils.ultimateWait();
+	}
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
new file mode 100644
index 0000000..a128aef
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ResourceLeftMenu.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class ResourceLeftMenu implements ComponentLeftMenu {
+
+	public void moveToGeneralScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.GENERAL);
+	}
+
+	public void moveToIconScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.ICON);
+	}
+
+	public void moveToDeploymentArtifactScreen() {
+		GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_ARTIFACT);
+	}
+
+	public void moveToInformationalArtifactScreen() {
+		GeneralUIUtils.moveToStep(StepsEnum.INFORMATION_ARTIFACT);
+	}
+
+	public void moveToPropertiesScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.PROPERTIES);
+	}
+
+	public void moveToCompositionScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.COMPOSITION);
+	}
+
+	public void moveToActivityLogScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.ACTIVITY_LOG);
+	}
+
+	public void moveToDeploymentViewScreen() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.DEPLOYMENT_VIEW);
+	}
+
+	public void moveToToscaArtifactsScreen() {
+		GeneralUIUtils.moveToStep(StepsEnum.TOSCA_ARTIFACTS);
+	}
+	
+	public void moveToInputsScreen() {
+		GeneralUIUtils.moveToStep(StepsEnum.INPUTS);
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java
new file mode 100644
index 0000000..0394978
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceGeneralPage.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.util.ArrayList;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class ServiceGeneralPage extends ResourceGeneralPage {
+
+	public ServiceGeneralPage() {
+		super();
+	}
+	
+	public static ServiceLeftMenu getServiceLeftMenu() {
+        return new ServiceLeftMenu();
+    }
+
+	public static void defineName(String serviceName) {
+		WebElement serviceNameTextbox = GeneralUIUtils
+				.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.SERVICE_NAME.getValue());
+		serviceNameTextbox.clear();
+		serviceNameTextbox.sendKeys(serviceName);
+	}
+
+	public static void defineProjectCode(String pmat) {
+		WebElement projectCodeTextbox = GeneralUIUtils
+				.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue());
+		projectCodeTextbox.clear();
+		projectCodeTextbox.sendKeys(pmat);
+	}
+	
+	public static String getProjectCodeText(){
+		return getProjectCodeField().getAttribute("value");
+	}
+	
+	public static String[] getTags(){
+		return ResourceGeneralPage.getElementsFromTagsTable().stream().map(WebElement::getText).toArray(String[]::new);
+	}
+	
+	private static WebElement getProjectCodeField() {
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ServiceMetadataEnum.PROJECT_CODE.getValue());
+	}
+	
+	public static void deleteOldTags(ServiceReqDetails service){
+		// Delete tag elements
+		int i = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-delete").size();
+		while (i > 0){			
+			GeneralUIUtils.getWebElementByTestID("i-sdc-tag-delete").click();
+			i--;
+		}
+		
+		service.setTags(new ArrayList<String>());
+	}
+	
+	public static String getCategoryText() {
+		return GeneralUIUtils.getSelectedElementFromDropDown(getCategoryDataTestsIdAttribute()).getText();
+	}
+	
+	public static void clickAddWorkflow (){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding workflow..."));
+		GeneralUIUtils.clickOnElementByText("Add Workflow");
+	}
+	
+	public static void fillAndAddNewWorkflow(String name, String description ) throws InterruptedException{
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling name field with %s", name));
+		insertText(name, "label + input");
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Filling description filed with %s", name));
+		insertText(description,"label + textarea");
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking save button "));
+		clickSave();
+	}
+	
+	public static void insertText(String artifactDescriptoin, String element) throws InterruptedException {
+		GeneralUIUtils.getElementsByCSS("div[class='modal-content']");
+		WebElement artifactDescriptionTextbox = GeneralUIUtils.getWebElementBy(By.cssSelector(element));
+		artifactDescriptionTextbox.clear();
+		artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+		GeneralUIUtils.ultimateWait();		
+	}
+	
+	public static void clickSave() {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on Save button"));
+		GeneralUIUtils.clickOnElementByText("Save");
+		GeneralUIUtils.ultimateWait();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java
new file mode 100644
index 0000000..127ada2
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ServiceLeftMenu.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+public class ServiceLeftMenu implements ComponentLeftMenu {
+	
+	public void moveToManagmentWorkflow() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.MANAGEMENT_WORKFLOW);
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java
new file mode 100644
index 0000000..d9ef375
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/TesterOperationPage.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class TesterOperationPage {
+
+	public TesterOperationPage() {
+		super();
+	}
+
+	public static void certifyComponent(String componentName) throws Exception{
+		clickStartTestingButton();
+		clickAccpetCertificationButton(componentName);
+	}
+
+	public static void clickAccpetCertificationButton(String componentName) throws Exception {
+		ExtentTestActions.log(Status.INFO, "Accepting certifiction of " + componentName);
+		String actionDuration = GeneralUIUtils.getActionDuration(() ->
+		{
+			try {
+				clickAccpetCertificationButtonWithoutDuration(componentName);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		});
+		ExtentTestActions.log(Status.INFO, componentName + " is certifed", actionDuration);
+
+	}
+	
+	public static void clickStartTestingButton() throws Exception{
+		ExtentTestActions.log(Status.INFO, "Starting to test");
+		String actionDuration = GeneralUIUtils.getActionDuration(() -> {
+			try {
+				clickStartTestingButtonWithoutDuration();
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		});
+		ExtentTestActions.log(Status.INFO, "Ready for certification", actionDuration);
+	}
+	
+	
+	private static void certifyComponentWithoutDuration(String componentName) throws Exception {
+		clickStartTestingButtonWithoutDuration();
+		clickAccpetCertificationButtonWithoutDuration(componentName);
+	}
+	
+	
+	private static void clickAccpetCertificationButtonWithoutDuration(String componentName) throws Exception {
+		try{
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
+			GeneralUIUtils.ultimateWait();
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ACCEP_TESTING_MESSAGE.getValue()).sendKeys(componentName + " tested successfuly");
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ModalItems.OK.getValue());
+			GeneralUIUtils.ultimateWait();
+			GeneralUIUtils.sleep(2000);
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+		}
+		catch (Exception e){
+			throw new Exception("Accepting certification of " + componentName + " falied");
+		}
+	}
+	
+	private static void clickStartTestingButtonWithoutDuration() throws Exception {
+		try{
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.LifeCyleChangeButtons.START_TESTING.getValue());
+//			GeneralUIUtils.ultimateWait();
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.ACCEPT.getValue());
+//			GeneralUIUtils.ultimateWait();
+//			GeneralUIUtils.sleep(1000);
+		}
+		catch (Exception e){
+			throw new Exception("Start testing falied");
+		}
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java
new file mode 100644
index 0000000..077ccac
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/ToscaArtifactsPage.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.WebElement;
+
+public class ToscaArtifactsPage extends DeploymentArtifactPage {
+
+	public ToscaArtifactsPage() {
+
+	}
+	
+	public static String getArtifactName(int row){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_NAME.getValue() + row).getText();
+	}
+	
+	public static String getArtifactType(int row){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_TYPE.getValue() + row).getText();
+	}
+	
+	public static String getArtifactVersion(int row){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_VERSION.getValue() + row).getText();
+	}
+	
+	public static WebElement getArtifactDetails(int row){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ToscaArtifactsScreenEnum.ARTIFACT_DETAILS.getValue() + row);
+	}
+
+	public static void downloadCsar() {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ToscaArtifactsScreenEnum.DOWNLOAD_CSAR.getValue());
+		GeneralUIUtils.ultimateWait();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
new file mode 100644
index 0000000..e97f3fe
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/pages/UploadArtifactPopup.java
@@ -0,0 +1,126 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.pages;
+
+import java.io.File;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+import org.testng.TestException;
+
+import com.aventstack.extentreports.Status;
+
+public class UploadArtifactPopup {
+
+	boolean isCompositionPage;
+	
+	public UploadArtifactPopup(boolean isCompositionPage) {
+		super();
+		this.isCompositionPage = isCompositionPage;
+	}
+	
+	public UploadArtifactPopup() {
+		super();
+	}
+	
+	public WebElement getArtifactDescriptionWebElement(){
+		return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_DESCRIPTION.getValue());
+	}
+
+	public void loadFile(String path, String filename) {
+		final WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPopup.BROWSE.getValue());
+//		browseWebElement.sendKeys(path + filename);
+		browseWebElement.sendKeys(path + File.separator + filename);
+		GeneralUIUtils.ultimateWait();
+		
+//		if (!browseWebElement.getAttribute("value").equals(filename))
+//		{
+//			throw new TestException("File named " + filename + " does not presented");
+//		}
+	}
+	
+
+
+	public void insertDescription(String artifactDescriptoin) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Changing artifact description to: %s", artifactDescriptoin));  
+		WebElement artifactDescriptionTextbox = getArtifactDescriptionWebElement();
+		artifactDescriptionTextbox.clear();
+		artifactDescriptionTextbox.sendKeys(artifactDescriptoin);
+        
+		GeneralUIUtils.ultimateWait();;
+	}
+
+	public Select defineArtifactLabel(String requiredArtifactLabel) {
+		Select selectList = null;
+		WebElement artifactLabelWebElement = null;
+		
+//		if (isCompositionPage){
+			artifactLabelWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
+//		}
+//		else{
+//			selectList = GeneralUIUtils.getSelectList("Create New Artifact", DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue());
+//			artifactLabelWebElement = GeneralUIUtils.getDriver().findElement(By.name(DataTestIdEnum.ArtifactPopup.ARTIFACT_LABEL.getValue()));	
+//		}
+		
+		artifactLabelWebElement.clear();
+		artifactLabelWebElement.sendKeys(requiredArtifactLabel);
+		return selectList;
+	}
+
+	public Select selectArtifactType(String artifactType) {
+		return GeneralUIUtils.getSelectList(artifactType, DataTestIdEnum.ArtifactPopup.ARTIFACT_TYPE.getValue());
+	}
+
+	public void clickDoneButton() throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.waitForElementInVisibilityBy(By.className("sdc-add-artifact"), 10);
+	}
+
+	public void clickCancelButton() throws Exception {
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.CANCEL_BUTTON.getValue()).click();
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.waitForElementInVisibilityByTestId("sdc-add-artifact");
+	}
+
+//	public void clickUpdateButton() throws Exception {
+//		clickAddButton();
+//		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ArtifactPopup.UPDATE_BUTTON.getValue()).click();
+//		GeneralUIUtils.waitForLoader();
+//		GeneralUIUtils.waitForElementInVisibilityByTestId(By.className("sdc-add-artifact"), 50);
+//	}
+	
+	public void insertURL(String artifactDescriptoin) throws Exception {
+		WebElement artifactDescriptionTextbox = getArtifactURLWebElement();
+		artifactDescriptionTextbox.clear();
+		artifactDescriptionTextbox. sendKeys(artifactDescriptoin);		
+	}
+	
+	public WebElement getArtifactURLWebElement(){
+		return GeneralUIUtils.getWebElementBy(By.cssSelector((DataTestIdEnum.ArtifactPopup.URL.getValue())));
+	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
new file mode 100644
index 0000000..aa260ec
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdditionalConditions.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.util.concurrent.TimeUnit;
+
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import com.paulhammant.ngwebdriver.NgWebDriver;
+
+public class AdditionalConditions {
+		
+	public static ExpectedCondition<Boolean> jQueryAJAXCallsHaveCompleted() {
+	    return new ExpectedCondition<Boolean>() {
+	        @Override
+			public Boolean apply(WebDriver driver) {
+	        	return (Boolean) ((JavascriptExecutor)driver).
+	        			executeScript("return (window.jQuery!= null) && (jQuery.active === 0);");
+			}
+		};
+	}
+	
+	public static ExpectedCondition <Boolean> angularHasFinishedProcessing() {
+	   return new ExpectedCondition<Boolean>() {
+		   	@Override
+		   	public Boolean apply(WebDriver driver) {
+//		   		String scriptJS = "return (window.angular !==undefined) &&"
+//		   				+ " (angular.element(document).injector() !==undefined) &&"
+//		   				+ " (angular.element(document).injector().get('$http').pendingRequests.length === 0)";
+//		   		return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString());
+		   		new NgWebDriver((JavascriptExecutor) driver).waitForAngularRequestsToFinish();
+		   		return true;
+		   	}
+	   };
+	}
+	
+    public static ExpectedCondition <Boolean> pageLoadWait() {
+        return new ExpectedCondition<Boolean>() {
+                   @Override
+                   public Boolean apply(WebDriver driver) {
+                          String scriptJS = 
+                                       "try {\r\n" + 
+                                       "  if (document.readyState !== 'complete') {\r\n" + 
+                                       "    return false; // Page not loaded yet\r\n" + 
+                                       "  }\r\n" + 
+                                       "  if (window.jQuery) {\r\n" + 
+                                       "    if (window.jQuery.active) {\r\n" + 
+                                       "      return false;\r\n" + 
+                                       "    } else if (window.jQuery.ajax && window.jQuery.ajax.active) {\r\n" + 
+                                       "      return false;\r\n" + 
+                                       "    }\r\n" + 
+                                       "  }\r\n" + 
+                                       "  if (window.angular) {\r\n" + 
+                                       "    if (!window.qa) {\r\n" + 
+                                       "      // Used to track the render cycle finish after loading is complete\r\n" + 
+                                       "      window.qa = {\r\n" + 
+                                       "        doneRendering: false\r\n" + 
+                                       "      };\r\n" + 
+                                       "    }\r\n" + 
+                                       "    // Get the angular injector for this app (change element if necessary)\r\n" + 
+                                       "    var injector = window.angular.element('body').injector();\r\n" + 
+                                       "    // Store providers to use for these checks\r\n" + 
+                                       "    var $rootScope = injector.get('$rootScope');\r\n" + 
+                                       "    var $http = injector.get('$http');\r\n" + 
+                                       "    var $timeout = injector.get('$timeout');\r\n" + 
+                                       "    // Check if digest\r\n" + 
+                                       "    if ($rootScope.$$phase === '$apply' || $rootScope.$$phase === '$digest' || $http.pendingRequests.length !== 0) {\r\n" + 
+                                       "      window.qa.doneRendering = false;\r\n" + 
+                                       "      return false; // Angular digesting or loading data\r\n" + 
+                                       "    }\r\n" + 
+                                       "    if (!window.qa.doneRendering) {\r\n" + 
+                                       "      // Set timeout to mark angular rendering as finished\r\n" + 
+                                       "      $timeout(function() {\r\n" + 
+                                       "        window.qa.doneRendering = true;\r\n" + 
+                                       "      }, 0);\r\n" + 
+                                       "      return false;\r\n" + 
+                                       "    }\r\n" + 
+                                       "  }\r\n" + 
+                                       "  return true;\r\n" + 
+                                       "} catch (ex) {\r\n" + 
+                                       "  return false;\r\n" + 
+                                       "}";
+                          return Boolean.valueOf(( (JavascriptExecutor) driver).executeScript(scriptJS).toString());
+                   }
+        };
+     }
+
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java
new file mode 100644
index 0000000..db621f3
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AdminWorkspaceUIUtilies.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+
+public class AdminWorkspaceUIUtilies {
+	
+	
+	public static void createNewUser(String userId, UserRoleEnum userRole){
+		AdminGeneralPage.getUserManagementTab().setNewUserBox(userId);
+		AdminGeneralPage.getUserManagementTab().selectUserRole(userRole);
+		AdminGeneralPage.getUserManagementTab().clickCreateButton();
+//		AdminWorkspaceUIUtilies.highlightNewRow();
+	}
+	
+	private static void highlightNewRow(){
+		GeneralUIUtils.HighlightMyElement(AdminGeneralPage.getUserManagementTab().getRow(0));
+	}
+	
+	public static void updateUserRole(int rowIndx, UserRoleEnum userRole) {
+		AdminGeneralPage.getUserManagementTab().updateUser(rowIndx);
+		AdminGeneralPage.getUserManagementTab().updateUserRole(userRole, rowIndx);
+		AdminGeneralPage.getUserManagementTab().saveAfterUpdateUser(rowIndx);
+	}
+	
+	public static void deleteFirstRow(){
+		AdminGeneralPage.getUserManagementTab().deleteUser(0);
+	}
+	
+	public static void searchForUser(String searchString){
+		AdminGeneralPage.getUserManagementTab().searchUser(searchString);
+	}
+	
+
+
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
new file mode 100644
index 0000000..d55ace4
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ArtifactUIUtils.java
@@ -0,0 +1,638 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.datatypes.elements.HeatParameterDataDefinition;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactInfo;
+import org.openecomp.sdc.ci.tests.datatypes.ArtifactReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.InformationalArtifactsPlaceholders;
+import org.openecomp.sdc.ci.tests.datatypes.HeatWithParametersDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ArtifactTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.InformationalArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.UploadArtifactPopup;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class ArtifactUIUtils {
+
+	private static final String PARAMETERS = "parameters";
+
+	private ArtifactUIUtils() {
+	}
+
+	public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo) throws Exception {
+		UploadArtifactPopup artifactPopup = new UploadArtifactPopup();
+		fillAndAddNewArtifactParameters(artifactInfo, artifactPopup);
+//		artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel());
+//		artifactPopup.selectArtifactType(artifactInfo.getArtifactType());
+//		artifactPopup.insertDescription(artifactInfo.getDescription());
+//		artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+//		artifactPopup.clickAddButton();
+	}
+	
+	public static void fillAndAddNewArtifactParameters(ArtifactInfo artifactInfo, UploadArtifactPopup artifactPopup) throws Exception {
+		artifactPopup.defineArtifactLabel(artifactInfo.getArtifactLabel());
+		artifactPopup.selectArtifactType(artifactInfo.getArtifactType());
+		artifactPopup.insertDescription(artifactInfo.getDescription());
+		artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+		artifactPopup.clickDoneButton();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("A new artifact of type %s was added", artifactInfo.getArtifactType()));  
+	}
+
+	public static void fillAndAddNewEnvArtifactParameters(ArtifactInfo artifactInfo, UploadArtifactPopup artifactPopup) throws Exception {
+		artifactPopup.insertDescription(artifactInfo.getDescription());
+		artifactPopup.loadFile(artifactInfo.getFilepath(), artifactInfo.getFilename());
+		artifactPopup.clickDoneButton();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("ENV parameters %s artifact updated ", artifactInfo.getArtifactType()));  
+	}
+	
+	public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifactsPlaceholders artifactLabel,String filepath, String filename, String description) throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue());
+		InformationalArtifactPage.artifactPopup().loadFile(filepath, filename);
+		InformationalArtifactPage.artifactPopup().insertDescription(description);
+		InformationalArtifactPage.artifactPopup().clickDoneButton();
+	}
+	
+	public static void fillPlaceHolderInformationalArtifact(DataTestIdEnum.InformationalArtifactsService artifactLabel,
+			String filepath, String filename, String description) throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue());
+		UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+		artifactPopup.loadFile(filepath, filename);
+		artifactPopup.insertDescription(description);
+		artifactPopup.clickDoneButton();
+	}
+	
+	public static void fillPlaceHolderAPIArtifact(DataTestIdEnum.APIArtifactsService artifactLabel,
+			String filepath, String filename, String description, String url) throws Exception {
+		GeneralUIUtils.clickOnElementByTestId(artifactLabel.getValue());
+		UploadArtifactPopup artifactPopup = new UploadArtifactPopup(true);
+		artifactPopup.loadFile(filepath, filename);
+		artifactPopup.insertURL(url);
+		artifactPopup.insertDescription(description);
+		artifactPopup.clickDoneButton();
+	}
+
+	public static RestResponse deploymentArtifactResourceInUI(ResourceReqDetails resource, User user,
+			ArtifactReqDetails artifact, String file) throws Exception {
+		Thread.sleep(1000);
+
+		List<WebElement> listFormInput = GeneralUIUtils.getDriver()
+				.findElements(By.className("i-sdc-designer-sidebar-tab"));
+		WebElement addArtifactElement = listFormInput.get(2);
+		addArtifactElement.click();
+
+		WebElement addArtifact = GeneralUIUtils.getDriver()
+				.findElement(By.className("i-sdc-designer-sidebar-section-content-item-artifact-details-name"));
+		addArtifact.click();
+
+		Thread.sleep(1000);
+		WebElement descriptionProperty = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-textarea"));
+		descriptionProperty.clear();
+		descriptionProperty.sendKeys(artifact.getDescription());
+
+		WebElement uploadFile = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-label-upload"));
+		uploadFile.click();
+
+		StringSelection sel = new StringSelection(file);
+		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+		// System.out.println("selection" + sel);
+		Thread.sleep(1000);
+
+		Robot robot = new Robot();
+		Thread.sleep(1000);
+
+		Thread.sleep(2000);
+
+		robot.keyPress(KeyEvent.VK_ENTER);
+
+		// Release Enter
+		robot.keyRelease(KeyEvent.VK_ENTER);
+
+		// Press CTRL+V
+		robot.keyPress(KeyEvent.VK_CONTROL);
+		robot.keyPress(KeyEvent.VK_V);
+
+		// Release CTRL+V
+		robot.keyRelease(KeyEvent.VK_CONTROL);
+		robot.keyRelease(KeyEvent.VK_V);
+		Thread.sleep(1000);
+
+		// Press Enter
+		robot.keyPress(KeyEvent.VK_ENTER);
+		robot.keyRelease(KeyEvent.VK_ENTER);
+		Thread.sleep(3000);
+
+		WebElement clickDone = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-form-action"));
+		clickDone.click();
+
+		Thread.sleep(3500);
+
+		GeneralUIUtils.getDriver().findElement(By.cssSelector("button[data-ng-click^=save]")).click();
+
+		RestResponse getResource = RestCDUtils.getResource(resource, user);
+		assertEquals("Did not succeed to get resource after create", 200, getResource.getErrorCode().intValue());
+		return getResource;
+	}
+
+	public static void addInformationArtifact(ArtifactReqDetails artifact, String filePath,
+			final InformationalArtifactsPlaceholders dataTestEnum) throws Exception {
+		GeneralUIUtils.waitForLoader();
+		GeneralUIUtils.sleep(2000);
+		GeneralUIUtils.getWebElementByTestID(dataTestEnum.getValue()).click();
+
+//		final WebElement browseWebElement = GeneralUIUtils.retryMethodOnException(
+//				() -> GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue()));
+		
+		WebElement browseWebElement = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.BROWSE_BUTTON.getValue());
+		browseWebElement.sendKeys(filePath);
+
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.DESCRIPTION.getValue())
+				.sendKeys(artifact.getDescription());
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.ADD.getValue()).click();
+
+	}
+
+	private static void addFileToWindowBrowse(String file) throws InterruptedException, AWTException {
+		StringSelection sel = new StringSelection(file);
+		Toolkit.getDefaultToolkit().getSystemClipboard().setContents(sel, null);
+		// System.out.println("selection" + sel);
+		Thread.sleep(1000);
+
+		Robot robot = new Robot();
+
+		robot.keyPress(KeyEvent.VK_ENTER);
+
+		// Release Enter
+		robot.keyRelease(KeyEvent.VK_ENTER);
+
+		// Press CTRL+V
+		robot.keyPress(KeyEvent.VK_CONTROL);
+		robot.keyPress(KeyEvent.VK_V);
+
+		// Release CTRL+V
+		robot.keyRelease(KeyEvent.VK_CONTROL);
+		robot.keyRelease(KeyEvent.VK_V);
+		Thread.sleep(1000);
+
+		// Press Enter
+		robot.keyPress(KeyEvent.VK_ENTER);
+		robot.keyRelease(KeyEvent.VK_ENTER);
+		Thread.sleep(3000);
+	}
+
+	static WebElement ArtifactLabel;
+
+	public static Map<String, String> addInformationalArtifact(String artifactLabel) throws Exception {
+		String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+		Map<String, String> artifactValues = new HashMap<String, String>();
+		String labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getFirstSelectedOption()
+				.getText();
+		ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+		if (ArtifactLabel.getAttribute("value").equals("")) {
+			labelName = "New-Test-Artifact";
+			ArtifactLabel.sendKeys(labelName);
+			type = GeneralUIUtils.getSelectList("HEAT", "artifacttype").getFirstSelectedOption().getText();
+		}
+		String description = "This is Description";
+		String fileName = "Heat-File.yaml";
+		GeneralUIUtils.setWebElementByTestId("description", "description");
+		ResourceUIUtils.importFileWithSendKeyBrowse(ImportAssetUIUtils.FILE_PATH, fileName);
+		GeneralUIUtils.getWebElementByTestID("Add").click();
+		GeneralUIUtils.getWebElementByTestID(labelName);
+
+		artifactValues.put("type", type);
+		artifactValues.put("description", description);
+		artifactValues.put("name", labelName);
+		artifactValues.put("fileName", fileName);
+		return artifactValues;
+	}
+
+	public static Map<String, String> addDeploymentArtifact(String artifactLabel, String artifactType, String fileName)
+			throws Exception {
+		String type = null;
+		String labelName;
+		Map<String, String> artifactValues = new HashMap<String, String>();
+		try {
+			labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getOptions().get(1).getText();
+			GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").selectByVisibleText(labelName);
+		} catch (Exception e) {
+			labelName = GeneralUIUtils.getWebElementByClassName(artifactLabel).getText();
+		}
+		ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+		if (ArtifactLabel.getText().equals("")) {
+			labelName = "New-Test-Artifact";
+			ArtifactLabel.sendKeys(labelName);
+			type = GeneralUIUtils.getSelectList(artifactType, "artifacttype").getFirstSelectedOption().getText();
+		}
+		String description = "This is Description";
+		GeneralUIUtils.setWebElementByTestId("description", "description" );
+		ResourceUIUtils.importFileWithSendKeyBrowse(ImportAssetUIUtils.FILE_PATH, fileName);
+		try {
+			GeneralUIUtils.getWebElementByTestID("Add").click();
+		} catch (Exception e) {
+			GeneralUIUtils.getWebElementByClassName("w-sdc-form-action add-property").click();
+		}
+
+		artifactValues.put("type", artifactType);
+		artifactValues.put("description", description);
+		artifactValues.put("name", labelName);
+		artifactValues.put("fileName", fileName);
+		return artifactValues;
+	}
+	
+
+	public static Map<String, String> addDeploymentArtifactFromCanvas(String artifactLabel) throws Exception {
+		String type = null;
+		Map<String, String> artifactValues = new HashMap<String, String>();
+		String labelName = GeneralUIUtils.getSelectList(artifactLabel, "selectArtifact").getFirstSelectedOption()
+				.getText();
+		ArtifactLabel = GeneralUIUtils.getDriver().findElement(By.name("artifactLabel"));
+		if (ArtifactLabel.getText().equals("")) {
+			labelName = "New-Test-Artifact";
+			ArtifactLabel.sendKeys(labelName);
+			type = GeneralUIUtils.getSelectList("OTHER", "artifacttype").getFirstSelectedOption().getText();
+		}
+		String description = "This is Description";
+		String filePath = "C:\\Git_work\\ASDC\\d2-sdnc\\ui-ci\\src\\main\\resources\\Files\\";
+		String fileName = "Heat-File.yaml";
+		GeneralUIUtils.setWebElementByTestId("description", "description");
+		ResourceUIUtils.importFileWithSendKeyBrowse(filePath, fileName);
+		GeneralUIUtils.getWebElementByTestID("Add").click();
+		artifactValues.put("type", type);
+		artifactValues.put("description", description);
+		artifactValues.put("name", labelName);
+		artifactValues.put("fileName", fileName);
+		return artifactValues;
+	}
+
+	public static Map<String, String> valideArtifact(Map<String, String> artifactValues, Boolean condition)
+			throws Exception {
+		if (condition) {
+			GeneralUIUtils.getWebElementByClassName("table-edit-btn").click();
+		} else {
+			System.out.println(artifactValues.get("name"));
+			GeneralUIUtils.getWebElementByTestID("edit_" + artifactValues.get("name")).click();
+		}
+		Thread.sleep(1000);
+		String labelname = GeneralUIUtils.getWebElementByClassName("artifactLabel").getAttribute("value");
+		String filename = GeneralUIUtils.getWebElementByTestID("filename").getText();
+		String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+		String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+		labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", ""));
+		assertEquals(filename, artifactValues.get("fileName").replaceAll(" ", "-"));
+		assertEquals(type, artifactValues.get("type"));
+		assertEquals(description, artifactValues.get("description"));
+		GeneralUIUtils.getWebElementByTestID("Update").click();
+		return artifactValues;
+	}
+
+	public static void valideArtifactFromCanvas(Map<String, String> artifactValues) throws Exception {
+		GeneralUIUtils.getWebElementByTestID("artifactDisplayName-" + artifactValues.get("name")).click();
+		Thread.sleep(1000);
+		String labelname = GeneralUIUtils.getWebElementByClassName("artifactLabel").getAttribute("value");
+		String filename = GeneralUIUtils.getWebElementByTestID("filename").getText();
+		String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+		String type = GeneralUIUtils.getSelectList(null, "artifacttype").getFirstSelectedOption().getText();
+		labelname.compareToIgnoreCase(artifactValues.get("name").replaceAll("-", ""));
+		assertEquals(filename, artifactValues.get("fileName"));
+		assertEquals(type, artifactValues.get("type"));
+		assertEquals(description, artifactValues.get("description"));
+	}
+
+	public static Map<String, Map<String, Object>> getArtifactsListFromResponse(String jsonResponse,
+			String fieldOfArtifactList) {
+		JSONObject object = (JSONObject) JSONValue.parse(jsonResponse);
+		Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object.get(fieldOfArtifactList);
+		return map;
+	}
+	
+	public static void validateArtifactNameVersionType(String artifactLabel, String artifactVersion, String artifactType) {
+//		Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactLabel);
+		if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactLabel)) {
+			SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact label not equal - this warnning represent defect.");	
+		}
+		if(artifactVersion != null) {
+//			Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactVersion, "Artifact version not equal.");
+			if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactVersion)) {
+				SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact version not equal - this warnning represent defect.");	
+			}
+		}
+		if(artifactType != null) {
+//			Assert.assertEquals(GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + artifactLabel + "']")).getAttribute("textContent").trim(), artifactType, "Artifact type not equal.");
+			if(!GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + artifactLabel + "']")).getAttribute("textContent").trim().equals(artifactType)) {
+				SetupCDTest.getExtendTest().log(Status.WARNING, "Artifact type not equal - this warnning represent defect.");	
+			}
+		}
+	}
+	
+	public static void validateArtifactVersionByTypeAndLabel(String artifactLabel, String expectedArtifactVersion, ArtifactTypeEnum artifactType) {
+		if(expectedArtifactVersion != null) {
+			String xPath;
+			SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to validate artifact version ..."));
+			if(artifactType.getType().equals(ArtifactTypeEnum.HEAT_ENV.getType())){
+				xPath = "//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION_ENV.getValue() + artifactLabel + "']"; 
+			}else{
+				xPath = "//*[@data-tests-id='" + DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + artifactLabel + "']";
+			}
+			String actualartifactVersion = GeneralUIUtils.getDriver().findElement(By.xpath(xPath)).getAttribute("textContent").trim();
+			Assert.assertEquals(actualartifactVersion, expectedArtifactVersion, "Artifact type " + artifactType.getType() + " expected version is " + expectedArtifactVersion + " not equal to " + actualartifactVersion);
+		}
+	}
+	
+	public static void validateExistArtifactOnDeploymentInformationPage(String expectedArtifactLabel, String artifactUUID, String artifactVersion, String artifactType, boolean isDownloadable, boolean isEditable, boolean isDeletable, boolean isArtifactParametersEditable) {
+		
+		String dataTestId = DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + expectedArtifactLabel;
+		
+		List<WebElement> artifactElements = GeneralUIUtils.getWebElementsListByContainTestID(dataTestId);
+		Assert.assertEquals(artifactElements.size(), 1, "There are more then one artifact named " + expectedArtifactLabel);
+		
+		WebElement artifact = artifactElements.get(0);
+		String actualArtifactLabel = GeneralUIUtils.getTextContentAttributeValue(artifact).trim();
+		Assert.assertEquals(actualArtifactLabel, expectedArtifactLabel);
+			
+		if(artifactUUID != null) {
+			WebElement uuid = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.UUID.getValue() + expectedArtifactLabel);
+			Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(uuid).trim(), artifactUUID, "Artifact uuid not equal.");
+		}
+		if(artifactVersion != null) {
+			WebElement version = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.VERSION.getValue() + expectedArtifactLabel);
+			Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(version).trim(), artifactVersion, "Artifact version not equal.");
+		}
+		if(artifactType != null) {
+			WebElement type = GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.TYPE.getValue() + expectedArtifactLabel);
+			Assert.assertEquals(GeneralUIUtils.getTextContentAttributeValue(type).trim(), artifactType, "Artifact type not equal.");
+		}
+		if(isArtifactParametersEditable) {
+			Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that parameters edit button enabled.");
+		} else if(isArtifactParametersEditable==false) {
+			Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that parameters edit button disabled.");
+		}
+		if(isDownloadable) {
+			Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that download button enabled.");
+		} else if(isDownloadable==false) {
+			Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that download button disabled.");
+		}
+		if(isEditable) {
+			Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that edit button enabled.");
+		} else if(isEditable==false) {
+			Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.EDIT_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that edit button disabled.");
+		}
+		if(isDeletable) {
+			Assert.assertNotNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that delete button enabled.");
+		} else if(isDeletable==false) {
+			Assert.assertNull(GeneralUIUtils.getInputElement(DataTestIdEnum.ArtifactPageEnum.DELETE_ARTIFACT.getValue() + expectedArtifactLabel), "Expect that delete button disabled.");
+		}
+	}
+	
+	public static void validateNotExistArtifactOnDeploymentInformationPage(String artifactLabel) {
+		Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPageEnum.ARTIFACT_NAME.getValue() + artifactLabel), false);
+	}
+	
+	public static void validateExistArtifactOnCompositionRightMenuDeploymentInformationPage(String fileName, String artifactDisplayedName, 
+			boolean isUpdateable, boolean isParametersEditable, boolean isDownloadable, boolean isDeleteable) {
+		Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_NAME.getValue() + artifactDisplayedName).getText(), fileName);
+		Assert.assertEquals(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName).getText(), artifactDisplayedName);
+		
+		GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName);
+		
+		if(isParametersEditable) {
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactDisplayedName), true, "Expect that parameters edit button enabled.");
+		} else {
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.EDIT_PARAMETERS_OF_ARTIFACT.getValue() + artifactDisplayedName), false, "Expect that parameters edit button disabled.");
+		}
+		if(isDownloadable) {
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + artifactDisplayedName), true, "Expect that download button enabled.");
+		} else {
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DOWNLOAD.getValue() + artifactDisplayedName), false, "Expect that download button disabled.");
+		}
+		if(isDeleteable) {
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + artifactDisplayedName), true, "Expect that delete button enabled.");
+		} else {
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.DELETE.getValue() + artifactDisplayedName), false, "Expect that delete button disabled.");
+		}
+		if(isUpdateable) {
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName);
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), true, "Expect that edit button enabled.");
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
+			GeneralUIUtils.waitForElementInVisibilityByTestId(DataTestIdEnum.ArtifactPopup.DONE_BUTTON.getValue());
+		} else {
+			GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_DISPLAY_NAME.getValue() + artifactDisplayedName);
+			Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.ArtifactPopup.MODAL_WINDOW.getValue()), false, "Expect that edit button disabled.");
+		}
+		
+	}
+	
+	public static void validateNotExistArtifactOnCompositionRightMenuDeploymentInformationPage(String artifactDisplayedName) {
+		Assert.assertEquals(GeneralUIUtils.isWebElementExistByTestId(DataTestIdEnum.DeploymentArtifactCompositionRightMenu.ARTIFACT_NAME.getValue() + artifactDisplayedName), false);
+	}
+	
+	public static File verifyUpdatedEnvParameters(HeatWithParametersDefinition pairToUpdate, File updateEnvFile, String dataTestId) throws Exception {
+		GeneralUIUtils.hoverOnAreaByTestId(dataTestId);
+		return verifyUpdatedEnvParameters(pairToUpdate, updateEnvFile);
+	}
+	
+	public static File verifyUpdatedEnvParameters(HeatWithParametersDefinition pairToUpdate, File updateEnvFile) throws Exception {
+
+		String heatDisplayName = pairToUpdate.getHeatArtifactDisplayName();
+		GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ArtifactPageEnum.DOWNLOAD_ARTIFACT_ENV.getValue()+heatDisplayName);
+		File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		
+		String pattern = PARAMETERS;
+		Map<String, Object> mapUpdetedEnvFile = FileHandling.parseYamlFileToMapByPattern(updateEnvFile, pattern);
+		Map<String, Object> mapDownloadedEnvFile = FileHandling.parseYamlFileToMapByPattern(latestFilefromDir, pattern);
+		
+		SetupCDTest.getExtendTest().log(Status.INFO, "Going to check, that ENV file was updated ...");
+		assertTrue("File" + latestFilefromDir.getName() + " contains different parameters number from expected file", mapDownloadedEnvFile.size() == mapUpdetedEnvFile.size());
+		assertTrue("Updated file contains not updated parameters value", mapDownloadedEnvFile.entrySet().containsAll(mapUpdetedEnvFile.entrySet()));
+		return latestFilefromDir;
+	}
+	
+	/**
+	 * compare heat env files by pattern ("parameters")
+	 * @param expectedFile
+	 * @param actualFile
+	 * @param pattern
+	 * @throws Exception
+	 */
+	public static void compareYamlFilesByPattern(File expectedFile, File actualFile, String pattern) throws Exception {
+
+		Map<String, Object> mapExpectedFile = FileHandling.parseYamlFileToMapByPattern(expectedFile, pattern);
+		Map<String, Object> mapActualFile = FileHandling.parseYamlFileToMapByPattern(actualFile, pattern);
+		SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ...");
+		assertTrue("File" + actualFile.getName() + " contains different parameters number from expected file", mapActualFile.size() == mapExpectedFile.size());
+		assertTrue("File " + actualFile.getName() + " does not contains all expected parametrs", mapActualFile.entrySet().containsAll(mapExpectedFile.entrySet()));
+	}
+	
+	public static void compareYamlParametersByPattern(Map<String, Object> mapExpectedproperties, File actualFileproperties, String pattern) throws Exception {
+
+		Map<String, Object> mapActualFileProerties = FileHandling.parseYamlFileToMapByPattern(actualFileproperties, pattern);
+		SetupCDTest.getExtendTest().log(Status.INFO, "Going to compare files ...");
+		assertTrue("Actual file contains different parameters number from expected file", mapActualFileProerties.size() == mapExpectedproperties.size());
+		Map<String, Object> newMap = new HashMap<>(mapActualFileProerties);		
+		assertTrue("Actual file does not contains all expected parametrs", newMap.entrySet().containsAll(mapExpectedproperties.entrySet()));
+	}
+	
+
+	public static File uploadCreatedUpdateParametersEnvFile(HeatWithParametersDefinition heatEnvDetails, String directoryPath) throws Exception {
+//		created env file to upload
+		File pathToEnvParametersFile = prepareEnvParametersFile(heatEnvDetails, directoryPath);
+		ArtifactInfo heatEnvArtifactInfo = new ArtifactInfo(directoryPath, heatEnvDetails.getHeatEnvLabel()+".env", "heatEnvDesc", heatEnvDetails.getHeatEnvLabel(),heatEnvDetails.getHeatEnvArtifactType());
+		ArtifactUIUtils.fillAndAddNewEnvArtifactParameters(heatEnvArtifactInfo, CompositionPage.artifactPopup());
+		return pathToEnvParametersFile;
+	}
+
+	public static File prepareEnvParametersFile(HeatWithParametersDefinition heatEnvDetails, String directoryPath) throws IOException {
+		File pathToEnvParametersFile = FileHandling.createEmptyFile(directoryPath+heatEnvDetails.getHeatEnvLabel()+".env");
+//		fill file
+		FileHandling.writeToFile(pathToEnvParametersFile, "parameters:", 0);
+		for(HeatParameterDataDefinition paramDefinition : heatEnvDetails.getHeatParameterDefinition()){
+			Object data = getDataToWrite(paramDefinition);
+			FileHandling.writeToFile(pathToEnvParametersFile, data, 2);
+		}
+		
+		return pathToEnvParametersFile;
+	}
+
+	public static Object getDataToWrite(HeatParameterDataDefinition paramDefinition) {
+		Object data = "";
+		switch (paramDefinition.getType()) {
+		case "string":
+			String text = "\"string\"";
+			data = getFormatedData(paramDefinition.getName(), text);
+			break;
+		case "number":
+			data = getFormatedData(paramDefinition.getName(), 666);	
+			break;
+		case "json":
+			String jsonText = "{\"param1\":\"param1\", \"param2\":2}";
+			data = getFormatedData(paramDefinition.getName(), jsonText);
+			break;
+		case "boolean":
+			if(paramDefinition.getCurrentValue().equals("true")){
+				data = getFormatedData(paramDefinition.getName(), false);
+			}else{
+				data = getFormatedData(paramDefinition.getName(), true);
+			}
+			break;
+		case "comma_delimited_list":
+			String commaDelimitedListText = "127.0.0.10, 127.0.0.15, 127.0.0.20";
+			data = getFormatedData(paramDefinition.getName(), commaDelimitedListText);
+			break;
+		default:
+			break;
+		}
+		return data;
+	}
+	
+	
+	public static Map<String, Object> getDataToWriteInUI(List<HeatParameterDataDefinition> paramDefinitionFromGetResourceResponse) {
+		Map<String, Object>newValuesToUpdateInUI=new HashMap<>();
+		for (HeatParameterDataDefinition param : paramDefinitionFromGetResourceResponse) {
+			System.out.println(param.getCurrentValue());
+			switch (param.getType()) {
+
+			case "string":
+				String text = "string";
+				newValuesToUpdateInUI.put(param.getName(),text);
+				break;
+			case "number":
+				newValuesToUpdateInUI.put(param.getName(),666);
+				break;
+			case "json":
+				String jsonText = "{\"param1\":\"param1\", \"param2\":2}";
+				newValuesToUpdateInUI.put(param.getName(),jsonText);
+				break;
+			case "boolean":
+				if (param.getCurrentValue().equals(true)) {
+					newValuesToUpdateInUI.put(param.getName(),false);
+				} else {
+					newValuesToUpdateInUI.put(param.getName(),true);
+				}
+				break;
+			case "comma_delimited_list":
+				String commaDelimitedListText = "127.0.0.10, 127.0.0.15, 127.0.0.20";
+				newValuesToUpdateInUI.put(param.getName(),commaDelimitedListText);
+				break;
+			default:
+				break;
+
+			}
+
+		}
+		return newValuesToUpdateInUI;
+	}
+	
+	public static Object getValue(HeatParameterDataDefinition param) {
+		String type = param.getType();
+		Object result = null;
+		switch(type){
+		case "string":
+			result = param.getCurrentValue();
+			break;
+		case "number":
+			result = new Integer(param.getCurrentValue());
+			break;
+		case "json":
+			result = param.getCurrentValue();
+			break;
+		case "boolean":
+			result = new Boolean(param.getCurrentValue());
+			break;
+		case "comma_delimited_list":
+			result = param.getCurrentValue();
+			break;
+		default:
+			break;
+		}
+		return result;
+	}
+
+	public static Object getFormatedData(String name, Object text) {
+		return name + ": " + text;  
+}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java
new file mode 100644
index 0000000..c53fef5
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/AuditCDUtils.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.expected.ExpectedResourceAuditJavaObject;
+import org.openecomp.sdc.ci.tests.utils.general.Convertor;
+import org.openecomp.sdc.ci.tests.utils.validation.AuditValidationUtils;
+
+public class AuditCDUtils {
+
+	public static void validateResourceSuccessAudit(ResourceReqDetails resource, User user, String action)
+			throws Exception {
+		JSONObject auditBody = AuditValidationUtils.filterAuditByUuid(action, resource.getUUID());
+		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = Convertor
+				.constructFieldsForAuditValidation(resource, resource.getVersion(), user);
+		String auditAction = "Create";
+		expectedResourceAuditJavaObject.setAction(auditAction);
+		expectedResourceAuditJavaObject.setPrevVersion("");
+		expectedResourceAuditJavaObject.setPrevState("");
+		expectedResourceAuditJavaObject.setStatus("201");
+		expectedResourceAuditJavaObject.setDesc("OK");
+		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, auditAction, auditBody.toString(), false);
+	}
+
+	public static void validateServiceSuccessAudit(ServiceReqDetails service, User user, String action)
+			throws Exception {
+		validateServiceSuccessAudit(service, user, action, LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT);
+	}
+
+	public static void validateServiceSuccessAudit(ServiceReqDetails service, User user, String action,
+			LifecycleStateEnum lifecycleStatus) throws Exception {
+		ExpectedResourceAuditJavaObject expectedResourceAuditJavaObject = AuditValidationUtils
+				.constructFieldsForAuditValidation(service, service.getVersion(), user);
+		String body = AuditValidationUtils.filterAuditByUuid(action, service.getUUID()).toString();
+		expectedResourceAuditJavaObject.setAction(action);
+		expectedResourceAuditJavaObject.setPrevState("");
+		expectedResourceAuditJavaObject.setPrevVersion("");
+		expectedResourceAuditJavaObject.setCurrState(lifecycleStatus.toString());
+		expectedResourceAuditJavaObject.setStatus("201");
+		expectedResourceAuditJavaObject.setDesc("OK");
+		AuditValidationUtils.validateAudit(expectedResourceAuditJavaObject, action, body, false);
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
new file mode 100644
index 0000000..fbe8c04
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasElement.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.LeftPanelCanvasItems;
+import org.openqa.selenium.WebElement;
+
+public final class CanvasElement {
+	private final String uniqueId;
+	private ImmutablePair<Integer, Integer> location;
+	private WebElement elementType;
+
+	CanvasElement(String name, ImmutablePair<Integer, Integer> location, WebElement canvasItem) {
+		super();
+		this.uniqueId = name;
+		this.location = location;
+		elementType = canvasItem;
+	}
+
+	public String getUniqueId() {
+		return uniqueId;
+	}
+
+	public ImmutablePair<Integer, Integer> getLocation() {
+		return location;
+	}
+
+	public void setLocation(ImmutablePair<Integer, Integer> location) {
+		this.location = location;
+	}
+
+	public WebElement getElementType() {
+		return elementType;
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
new file mode 100644
index 0000000..18cb338
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CanvasManager.java
@@ -0,0 +1,179 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+public final class CanvasManager {
+	private Map<String, CanvasElement> canvasElements;
+	private Actions actions;
+	private WebElement canvas;
+	private int reduceCanvasWidthFactor;
+	// Offsets Are used to find upper right corner of canvas element in order to
+	// connect links
+	private static final int CANVAS_ELEMENT_Y_OFFSET = 40;
+	private static final int CANVAS_ELEMENT_X_OFFSET = 21; // 14 - 27
+
+	private CanvasManager() {
+		canvasElements = new HashMap<>();
+		actions = new Actions(GeneralUIUtils.getDriver());
+		canvas = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS.getValue());
+		try {
+			WebElement webElement = GeneralUIUtils
+					.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.CANVAS_RIGHT_PANEL.getValue());
+			reduceCanvasWidthFactor = webElement.getSize().width;
+		} catch (Exception e) {
+			reduceCanvasWidthFactor = 0;
+		}
+	}
+
+	public static CanvasManager getCanvasManager() {
+		return new CanvasManager();
+	}
+
+	public List<CanvasElement> getCanvasElements() {
+		return canvasElements.values().stream().collect(Collectors.toList());
+	}
+
+	private void addCanvasElement(CanvasElement element) {
+		canvasElements.put(element.getUniqueId(), element);
+	}
+
+	private void moveElementOnCanvas(CanvasElement canvasElement, ImmutablePair<Integer, Integer> newLocation)
+			throws Exception {
+		GeneralUIUtils.waitForLoader();
+		Thread.sleep(500);
+		actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+		actions.clickAndHold();
+		actions.moveToElement(canvas, newLocation.left, newLocation.right);
+		actions.release();
+		actions.perform();
+		canvasElement.setLocation(newLocation);
+		GeneralUIUtils.waitForLoader();
+
+	}
+
+	public void moveElementOnCanvas(CanvasElement canvasElement) throws Exception {
+		moveElementOnCanvas(canvasElement, getFreePosition());
+	}
+
+	public void deleteElementFromCanvas(CanvasElement canvasElement) throws Exception {
+		GeneralUIUtils.waitForLoader();
+		actions.moveToElement(canvas, canvasElement.getLocation().left, canvasElement.getLocation().right);
+		actions.click();
+		actions.perform();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralCanvasItems.DELETE_INSTANCE_BUTTON.getValue())
+				.click();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ModalItems.OK.getValue()).click();
+		canvasElements.remove(canvasElement.getUniqueId());
+		GeneralUIUtils.waitForLoader();
+	}
+
+	private String getItemName(WebElement canvasItem) {
+		String canvasItemName = canvasItem.getAttribute("data-tests-id");
+
+		return canvasItemName.substring(canvasItemName.lastIndexOf("-"));
+	}
+
+	public CanvasElement createElementOnCanvas(WebElement canvasItem) throws Exception {
+		GeneralUIUtils.waitForLoader();
+		ImmutablePair<Integer, Integer> freePosition = getFreePosition();
+		actions.moveToElement(canvasItem, 0, 0);
+		actions.clickAndHold();
+		actions.moveToElement(canvas, freePosition.left, freePosition.right);
+		actions.release();
+		actions.perform();
+
+		String uniqueId = getItemName(canvasItem) + "_" + UUID.randomUUID().toString();
+		CanvasElement canvasElement = new CanvasElement(uniqueId, freePosition, canvasItem);
+		addCanvasElement(canvasElement);
+		GeneralUIUtils.waitForLoader();
+		return canvasElement;
+	}
+
+	private ImmutablePair<Integer, Integer> getFreePosition() {
+		// TODO mshitrit use better method
+		ImmutablePair<Integer, Integer> randomPosition = null;
+		boolean freePosition = false;
+		int minSpace = 150;
+		while (!freePosition) {
+			ImmutablePair<Integer, Integer> tempRandomPosition = getRandomPosition();
+			freePosition = !canvasElements.values().stream().map(e -> e.getLocation())
+					.filter(e -> Math.abs(e.left - tempRandomPosition.left) < minSpace
+							&& Math.abs(e.right - tempRandomPosition.right) < minSpace)
+					.findAny().isPresent();
+			randomPosition = tempRandomPosition;
+		}
+		return randomPosition;
+	}
+
+	private ImmutablePair<Integer, Integer> getRandomPosition() {
+		int edgeBuffer = 50;
+		Random random = new Random();
+		int xElement = random.nextInt(canvas.getSize().width - 2 * edgeBuffer - reduceCanvasWidthFactor) + edgeBuffer;
+		int yElement = random.nextInt(canvas.getSize().height - 2 * edgeBuffer) + edgeBuffer;
+		return new ImmutablePair<Integer, Integer>(xElement, yElement);
+	}
+
+	public void linkElements(CanvasElement firstElement, CanvasElement secondElement) throws Exception {
+		GeneralUIUtils.waitForLoader();
+		drawSimpleLink(firstElement, secondElement);
+
+		selectReqAndCapAndConnect();
+
+		GeneralUIUtils.waitForLoader();
+
+	}
+
+	private void selectReqAndCapAndConnect() {
+		// Select First Cap
+		GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_CAP.getValue()).get(0).click();
+		// Select First Req
+		GeneralUIUtils.getWebElementsListByTestID(DataTestIdEnum.LinkMenuItems.LINK_ITEM_REQ.getValue()).get(0).click();
+		// Connect
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LinkMenuItems.CONNECT_BUTTON.getValue()).click();
+	}
+
+	private void drawSimpleLink(CanvasElement firstElement, CanvasElement secondElement) {
+
+		int yOffset = CANVAS_ELEMENT_Y_OFFSET;
+		int xOffset = CANVAS_ELEMENT_X_OFFSET;
+
+		actions.moveToElement(canvas, firstElement.getLocation().left + xOffset,
+				firstElement.getLocation().right - yOffset);
+
+		actions.clickAndHold();
+		actions.moveToElement(canvas, secondElement.getLocation().left + xOffset,
+				secondElement.getLocation().right - yOffset);
+		actions.release();
+		actions.perform();
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
new file mode 100644
index 0000000..e9ba11f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/CatalogUIUtilitis.java
@@ -0,0 +1,232 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.CatalogPageLeftPanelFilterTitle;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.annotations.Test;
+
+import com.aventstack.extentreports.Status;
+
+public class CatalogUIUtilitis {
+	
+	
+	
+	
+
+	// Get all Categories , Subcategories and Icons.
+	public void getAllCategoriesAndSubcategories() throws IOException, JSONException {
+		RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+		JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+		for (int i = 0; i < categories.length(); i++) {
+			String categoryname = (String) categories.getJSONObject(i).get("name");
+			JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+			for (int j = 0; j < subcategories.length(); j++) {
+				String subcategoryname = (String) subcategories.getJSONObject(j).get("name");
+				System.out.println(subcategoryname);
+			}
+			for (int j = 0; j < subcategories.length(); j++) {
+				JSONArray icons = (JSONArray) subcategories.getJSONObject(j).get("icons");
+				for (int k = 0; k < icons.length(); k++) {
+					System.out.println(icons.get(k));
+				}
+			}
+			System.out.println("-------------------------------");
+		}
+	}
+
+	@Test
+	// FOr testing---delete.
+	public static List<String> abcd() throws IOException, JSONException {
+		RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+		JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+		List<String> allcat = new ArrayList<>();
+		String uniqueId = null;
+		for (int i = 0; i < categories.length(); i++) {
+			String categoryname = (String) categories.getJSONObject(i).get("name");
+			uniqueId = (String) categories.getJSONObject(i).get("uniqueId");
+			allcat.add(uniqueId);
+			JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+			for (int j = 0; j < subcategories.length(); j++) {
+				String subcategoryname = (String) subcategories.getJSONObject(j).get("name");
+				uniqueId = (String) subcategories.getJSONObject(j).get("uniqueId");
+				allcat.add(uniqueId);
+			}
+		}
+		return allcat;
+
+	}
+	
+	public static void clickTopMenuButton(TopMenuButtonsEnum button) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s button ...", button.name()));
+		switch (button) {
+		case CATALOG:
+			GeneralUIUtils.getWebElementByTestID(button.getButton()).click();
+			break;
+		case HOME:
+			GeneralUIUtils.getWebElementByTestID(button.getButton()).click();
+			break;
+		case ON_BOARDING:
+			GeneralUIUtils.getWebElementByTestID(button.getButton()).click();
+			break;
+		default:
+			break;
+		}
+		GeneralUIUtils.ultimateWait();
+	}
+	
+	public static String catalogFilterTypeChecBox(TypesEnum enumtype) throws Exception {
+		String Type = enumtype.toString().toLowerCase();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s ...", Type));
+		GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+		return Type;
+	}
+	
+	public static List<String> catalogFilterStatusChecBox(CheckBoxStatusEnum statusEnum) throws Exception {
+		List<String> status = null;
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s status", statusEnum.name()));
+		switch (statusEnum) {
+		case IN_DESIGN:
+			status = Arrays.asList("NOT_CERTIFIED_CHECKIN", "NOT_CERTIFIED_CHECKOUT");
+			GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+			break;
+		case READY_FOR_TESTING:
+			status = Arrays.asList("READY_FOR_CERTIFICATION");
+			GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+			break;
+		case IN_TESTING:
+			status = Arrays.asList("CERTIFICATION_IN_PROGRESS");
+			GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+			break;
+		case CERTIFIED:
+			status = Arrays.asList("CERTIFIED");
+			GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+			break;
+		case DISTRIBUTED:
+			status = Arrays.asList("CERTIFIED");
+			GeneralUIUtils.getWebElementByTestID(statusEnum.getCatalogValue()).click();
+			break;
+		}
+		return status;
+	}
+
+	// Get all Categories uniqueID .//The parent categories.
+	public static List<String> getCategories() throws IOException, JSONException {
+		List<String> allCategoriesList = new ArrayList<>();
+		RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+		JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+		for (int i = 0; i < categories.length(); i++) {
+			String categoryname = (String) categories.getJSONObject(i).get("name");
+			System.out.println(categoryname);
+			allCategoriesList.add(categoryname);
+		}
+		return allCategoriesList;
+	}
+
+	@Test
+	// Get Subcategories by Category name
+	public static List<String> getAllSubcategoriesByUniqueId(String uniqueId) throws IOException, JSONException {
+
+		RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+		JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+		List<String> subCategories = new ArrayList<>();// subCategories to
+														// return.
+		JSONArray subcategories = null;
+
+		for (int i = 0; i < categories.length(); i++) {
+
+			String categoryuniqueId = (String) categories.getJSONObject(i).get("uniqueId");
+
+			if (categoryuniqueId.contentEquals(uniqueId)) {
+				subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+
+				for (int j = 0; j < subcategories.length(); j++) {
+
+					subCategories.add((String) subcategories.getJSONObject(j).get("uniqueId"));
+				}
+
+				break;
+			}
+		}
+		if (subcategories == null) {
+			subCategories.add(uniqueId);
+		}
+		return subCategories;
+	}
+
+	@Test
+	// Get icons by category name
+	public void getSubCategoryIcons() throws IOException, JSONException {
+		RestResponse allcategoriesJson = CatalogRestUtils.getAllCategoriesTowardsCatalogBe();
+
+		JSONArray categories = new JSONArray(allcategoriesJson.getResponse());
+		for (int i = 0; i < categories.length(); i++) {
+			String subcategoryname = (String) categories.getJSONObject(i).get("name");
+			if (subcategoryname.contentEquals("Generic")) {
+				JSONArray subcategories = (JSONArray) categories.getJSONObject(i).get("subcategories");
+				for (int j = 0; j < subcategories.length(); j++) {
+					JSONArray icons = (JSONArray) subcategories.getJSONObject(j).get("icons");
+					for (int k = 0; k < icons.length(); k++) {
+						System.out.println(icons.get(k));
+					}
+				}
+				break;
+			}
+		}
+	}
+	
+	
+	public static WebElement clickOnUpperCategoryCheckbox() throws InterruptedException {
+		List<WebElement> categorieCheckboxes = GeneralUIUtils.getElementsByCSS("span[data-tests-id*='category']"); // get all categories and subcategories
+		WebElement categorieCheckbox = categorieCheckboxes.get(0);
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s category ...", categorieCheckbox.getText()));
+		categorieCheckbox.click();
+		GeneralUIUtils.ultimateWait();
+		return categorieCheckbox;
+	}
+
+	public static void clickOnLeftPanelElement(DataTestIdEnum.CatalogPageLeftPanelFilterTitle leftPanelElement) throws InterruptedException {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s", leftPanelElement.name()));
+		GeneralUIUtils.getElementsByCSS(leftPanelElement.getValue()).forEach(WebElement::click);
+	}
+
+	public static WebElement catalogSearchBox(String searchText) {
+		WebElement searchBox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+		searchBox.clear();
+		searchBox.sendKeys(searchText);
+		return searchBox;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
new file mode 100644
index 0000000..08b392f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/DownloadManager.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.io.File;
+import java.util.List;
+
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.AttFtpClient;
+import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+public class DownloadManager {
+	
+	
+	public File fetchDownloadedFile(){
+		
+		File retrieveLastModifiedFileFromFTP = null;
+				
+		if (DriverFactory.getConfig().isRemoteTesting()){
+			
+				
+			try {
+				
+				AttFtpClient instance = AttFtpClient.getInstance();			   	  
+				AttFtpClient.getInstance().retrieveListOfFile();
+			   	retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP();
+								
+			} catch (Exception e) {
+				System.out.println("could not retriev file");
+			}
+			
+			return retrieveLastModifiedFileFromFTP;
+			
+		}
+		
+		
+		return retrieveLastModifiedFileFromFTP;
+		
+	}
+
+	
+	/**
+	 * this method download csar file from VSP repository to default browser download directory  
+	 * @param vspName
+	 * @throws Exception
+	 */
+	public static void downloadCsarByNameFromVSPRepository(String vspName, String vspId) throws Exception{
+	    FileHandling.cleanCurrentDownloadDir();
+		HomePage.showVspRepository();
+		boolean vspFound = HomePage.searchForVSP(vspName);
+		if (vspFound){
+			ExtentTestActions.log(Status.INFO, String.format("Going to downloading VSP %s", vspName));
+			List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
+//			GeneralUIUtils.ultimateWait();
+//			WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5);
+//			WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+			elemenetsFromTable.get(1).click();
+//			findElement.click();
+			GeneralUIUtils.waitForLoader();
+            GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.DOWNLOAD_CSAR.getValue());
+    		ExtentTestActions.log(Status.INFO, "Succeeded to downloaded CSAR file named " + vspId + " into folder " + SetupCDTest.getWindowTest().getDownloadDirectory());
+            GeneralUIUtils.getElementsByCSS("div[class^='w-sdc-modal-close']").forEach(e -> e.click());
+            GeneralUIUtils.ultimateWait();
+		}
+	}
+	
+//	AttFtpClient instance = AttFtpClient.getInstance();
+//	
+//	 String server = "135.177.130.113";
+//     int port = 2121;
+//     String user = "admin";
+//     String pass = "admin";
+//     AttFtpClient.getInstance().init(server, port, user, pass);
+//     
+//     try {
+//   	  AttFtpClient.getInstance().retrieveListOfFile();
+//   	  
+//   	  File retrieveLastModifiedFileFromFTP = instance.retrieveLastModifiedFileFromFTP();
+//   	  String content = new String(Files.readAllBytes(Paths.get(retrieveLastModifiedFileFromFTP.getPath())), StandardCharsets.UTF_8);
+////   	  instance.deleteFilesFromFTPserver();
+//   	  System.out.println(content);
+//   	  readFile(retrieveLastModifiedFileFromFTP);
+//		
+//	} finally {
+//		instance.terminateClient();
+//	}
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
new file mode 100644
index 0000000..6008f20
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/FileHandling.java
@@ -0,0 +1,505 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.common.util.GeneralUtility;
+import org.yaml.snakeyaml.Yaml;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class FileHandling {
+
+//	------------------yaml parser methods----------------------------
+	public static Map<?, ?> parseYamlFile(String filePath) throws Exception {
+		Yaml yaml = new Yaml();
+		File file = new File(filePath);
+		InputStream inputStream = new FileInputStream(file);
+		Map<?, ?> map = (Map<?, ?>) yaml.load(inputStream);
+		return map;
+	}
+	
+	/**
+	 * The method return map fetched objects by pattern from yaml file 
+	 * @param yamlFile
+	 * @param pattern
+	 * @return
+	 * @throws Exception
+	 */
+	public static Map<String, Object> parseYamlFileToMapByPattern(File yamlFile, String pattern) throws Exception {
+		Map<?, ?> yamlFileToMap = FileHandling.parseYamlFile(yamlFile.toString());
+		Map<String, Object> objectMap = getObjectMapByPattern(yamlFileToMap, pattern);
+		return objectMap;
+	}
+	
+	@SuppressWarnings("unchecked")
+	public static Map<String, Object> getObjectMapByPattern(Map<?, ?> parseUpdetedEnvFile, String pattern) {
+		Map<String, Object> objectMap = null;
+		
+		Object objectUpdetedEnvFile = parseUpdetedEnvFile.get(pattern);
+		if(objectUpdetedEnvFile instanceof HashMap){
+			objectMap = (Map<String, Object>) objectUpdetedEnvFile;
+		}
+		return objectMap;
+	}
+	
+//	-------------------------------------------------------------------------------------------------
+	
+	public static String getFilePath(String folder) {
+		String filepath = System.getProperty("filepath");
+		if (filepath == null && System.getProperty("os.name").contains("Windows")) {
+			filepath = FileHandling.getResourcesFilesPath() + folder + File.separator;
+		}
+		
+		else if(filepath.isEmpty() && !System.getProperty("os.name").contains("Windows")){
+				filepath = FileHandling.getBasePath() + "Files" + File.separator + folder + File.separator;
+		}
+		
+		System.out.println(filepath);
+		
+		return filepath;
+	}
+
+	public static String getBasePath() {
+		return System.getProperty("user.dir") + File.separator;
+	}
+	
+	public static String getDriversPath() {
+		return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+				+ File.separator + "ci" + File.separator + "drivers" + File.separator;
+	}
+
+	public static String getResourcesFilesPath() {
+		return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+				+ File.separator + "Files" + File.separator;
+	}
+	
+	public static String getResourcesEnvFilesPath() {
+		return getBasePath() + File.separator + "src" + File.separator + "main" + File.separator + "resources"
+				+ File.separator + "Files" + File.separator + "ResourcesEnvFiles" +File.separator;
+	}
+
+	public static String getCiFilesPath() {
+		return getBasePath() + "src" + File.separator + "main" + File.separator + "resources"
+				+ File.separator + "ci";
+	}
+
+	public static String getConfFilesPath() {
+		return getCiFilesPath() + File.separator + "conf" + File.separator;
+	}
+
+	public static String getTestSuitesFilesPath() {
+		return getCiFilesPath() + File.separator + "testSuites" + File.separator;
+	}
+	
+	public static String getVnfRepositoryPath() {
+		return getFilePath("VNFs");
+	}
+	
+	public static File getConfigFile(String configFileName) throws Exception {
+		File configFile = new File(FileHandling.getBasePath() + File.separator + "conf" + File.separator + configFileName);
+		if (!configFile.exists()) {
+			configFile = new File(FileHandling.getConfFilesPath() + configFileName);
+		}
+		return configFile;
+	}
+
+	public static Object[] filterFileNamesFromFolder(String filepath, String extension) {
+		try {
+			File dir = new File(filepath);
+			List<String> filenames = new ArrayList<String>();
+			
+			FilenameFilter extensionFilter = new FilenameFilter() {
+				public boolean accept(File dir, String name) {
+					return name.endsWith(extension);
+				}
+			};
+			
+			if (dir.isDirectory()) {
+				for (File file : dir.listFiles(extensionFilter)) {
+					filenames.add(file.getName());
+				}
+				return filenames.toArray();
+			}
+
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	public static String[] getArtifactsFromZip(String filepath, String zipFilename){
+		try{
+			ZipFile zipFile = new ZipFile(filepath + File.separator + zipFilename);
+			Enumeration<? extends ZipEntry> entries = zipFile.entries();
+			
+			String[] artifactNames = new String[zipFile.size() - 1];
+
+			int i = 0;
+			while(entries.hasMoreElements()){
+				ZipEntry nextElement = entries.nextElement();
+				if (!nextElement.isDirectory()){ 
+					if (!nextElement.getName().equals("MANIFEST.json")){
+						String name = nextElement.getName();
+						artifactNames[i++] = name;
+					}
+				}
+			}
+			zipFile.close();
+			return artifactNames;
+		}
+		catch(ZipException zipEx){
+			System.err.println("Error in zip file named : " +  zipFilename);	
+			zipEx.printStackTrace();
+		} catch (IOException e) {
+			System.err.println("Unhandled exception : ");
+			e.printStackTrace();
+		}
+		
+		return null;
+		
+	}
+
+	public static Object[] getZipFileNamesFromFolder(String filepath) {
+		return filterFileNamesFromFolder(filepath, ".zip");
+	}
+
+	public static int countFilesInZipFile(String[] artifactsArr, String reqExtension){
+		int fileCounter = 0;
+		for (String artifact : artifactsArr){
+			String extensionFile = artifact.substring(artifact.lastIndexOf(".") + 1 , artifact.length());
+			if (extensionFile.equals(reqExtension)){
+				fileCounter++;
+			}
+		}
+		return fileCounter;
+	}
+	
+
+	public static synchronized File getLastModifiedFileFromDir() throws Exception{
+		return getLastModifiedFileFromDir(SetupCDTest.getWindowTest().getDownloadDirectory());
+	}
+	
+	public static synchronized File getLastModifiedFileFromDir(String dirPath){
+	    File dir = new File(dirPath);
+	    File[] files = dir.listFiles();
+	    if (files == null) {
+	    	assertTrue("File not found under directory " + dirPath, false);
+	        return null;
+	    }
+
+	    File lastModifiedFile = files[0];
+	    for (int i = 1; i < files.length; i++) {
+	    	if(files[i].isDirectory()) {
+	    		continue;
+	    	}
+	    	if (lastModifiedFile.lastModified()  < files[i].lastModified()) {
+	           lastModifiedFile = files[i];
+	    	}
+	    }
+	    return lastModifiedFile;
+	}
+
+	public static void deleteDirectory(String directoryPath) {
+		File dir = new File(directoryPath);
+		try {
+			FileUtils.deleteDirectory(dir);
+		} catch (IOException e) {
+			System.out.println("Failed to delete " + dir);
+			SetupCDTest.getExtendTest().log(Status.INFO, "Failed to delete " + dir);
+		}
+	}
+	
+	public static void createDirectory(String directoryPath) {
+		File directory = new File(String.valueOf(directoryPath));
+	    if (! directory.exists()){
+	        directory.mkdir();
+	    }
+	}
+
+
+	/**
+	 * The method append data to existing file, if file not exists - create it
+	 * @param pathToFile
+	 * @param text
+	 * @param leftSpaceCount
+	 * @throws IOException
+	 */
+	public static synchronized void writeToFile(File pathToFile, Object text, Integer leftSpaceCount) throws IOException{
+		
+		BufferedWriter bw = null;
+		FileWriter fw = null;
+		if(!pathToFile.exists()){
+			createEmptyFile(pathToFile);
+		}
+		try {
+			fw = new FileWriter(pathToFile, true);
+			bw = new BufferedWriter(fw);
+			StringBuilder sb = new StringBuilder();
+			if(leftSpaceCount > 0 ){
+				for(int i = 0; i < leftSpaceCount; i++){
+					sb.append(" ");
+				}
+			}
+			bw.write(sb.toString() + text);
+			bw.newLine();
+			bw.close();
+			fw.close();
+		} catch (Exception e) {
+			SetupCDTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile);
+		}
+	}
+	
+	public static synchronized void writeToFile(File pathToFile, Map<String, Pair<String, Object>> dataMap, Integer leftSpaceCount) throws IOException{
+		
+		BufferedWriter bw = null;
+		FileWriter fw = null;
+		try {
+			if(!pathToFile.exists()){
+				createEmptyFile(pathToFile);
+			}
+			fw = new FileWriter(pathToFile, true);
+			bw = new BufferedWriter(fw);
+			StringBuilder sb = new StringBuilder();
+			if(leftSpaceCount > 0 ){
+				for(int i = 0; i < leftSpaceCount; i++){
+					sb.append(" ");
+				}
+			}
+			for(Map.Entry<String, Pair<String, Object>> entry : dataMap.entrySet()){
+				Object record = ArtifactUIUtils.getFormatedData(entry.getKey(), entry.getValue().right);
+				bw.write(sb.toString() + record);
+				bw.newLine();
+			}
+			bw.close();
+			fw.close();
+		} catch (Exception e) {
+			SetupCDTest.getExtendTest().log(Status.INFO, "Unable to write to flie " + pathToFile);
+		}
+	}
+	
+	public static void deleteLastDowloadedFiles(List<File> files) throws IOException {
+		for (File file : files) {
+			File fileToDelete =new File(Config.instance().getWindowsDownloadDirectory()+file.getName());
+			fileToDelete.delete();
+		}
+	}
+
+	public static void cleanCurrentDownloadDir() throws IOException {
+		try{
+			ExtentTestActions.log(Status.INFO, "Cleaning directory " + SetupCDTest.getWindowTest().getDownloadDirectory());
+			System.gc();
+			FileUtils.cleanDirectory(new File(SetupCDTest.getWindowTest().getDownloadDirectory()));
+		}
+		catch(Exception e){
+			
+		}
+	}
+	
+	public static boolean isFileDownloaded(String downloadPath, String fileName) {
+		boolean flag = false;
+		File dir = new File(downloadPath);
+		File[] dir_contents = dir.listFiles();
+		for (int i = 0; i < dir_contents.length; i++) {
+			if (dir_contents[i].getName().equals(fileName))
+				return flag = true;
+		}
+		return flag;
+	}
+	
+	public static String getMD5OfFile(File file) throws IOException {
+		String content = FileUtils.readFileToString(file);
+		String md5 = GeneralUtility.calculateMD5ByString(content);
+		return md5;
+	}
+	
+	public static File createEmptyFile(String fileToCreate) {
+		File file= new File(fileToCreate);
+		try {
+			if(file.exists()){
+				deleteFile(file);
+			}
+			file.createNewFile();
+			SetupCDTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate);
+		} catch (IOException e) {
+			SetupCDTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate);
+			e.printStackTrace();
+		}
+		return file;
+	}
+	
+	public static File createEmptyFile(File fileToCreate) {
+		try {
+			if(fileToCreate.exists()){
+				deleteFile(fileToCreate);
+			}
+			fileToCreate.createNewFile();
+			SetupCDTest.getExtendTest().log(Status.INFO, "Create file " + fileToCreate);
+		} catch (IOException e) {
+			SetupCDTest.getExtendTest().log(Status.INFO, "Failed to create file " + fileToCreate);
+			e.printStackTrace();
+		}
+		return fileToCreate;
+	}
+	
+	public static void deleteFile(File file){
+		
+		try{
+    		if(file.exists()){
+    			file.deleteOnExit();
+    			SetupCDTest.getExtendTest().log(Status.INFO, "File " + file.getName() + "has been deleted");
+    		}else{
+    			SetupCDTest.getExtendTest().log(Status.INFO, "Failed to delete file " + file.getName());
+    		}
+    	}catch(Exception e){
+    		e.printStackTrace();
+    	}
+
+	}
+	
+	
+	/**
+	 * get file list from directory by extension array
+	 * @param directory
+	 * @param okFileExtensions
+	 * @return
+	 */
+	public static List<File> getHeatAndHeatEnvArtifactsFromZip(File directory, String[] okFileExtensions){
+		
+			List<File> fileList = new ArrayList<>();
+			File[] files = directory.listFiles();
+			
+			for (String extension : okFileExtensions){
+				for(File file : files){
+					if (file.getName().toLowerCase().endsWith(extension)){
+						fileList.add(file);
+					}
+				}
+			}
+			return fileList;
+	}
+	
+	private static final int BUFFER_SIZE = 4096;
+    public static void unzip(String zipFilePath, String destDirectory) throws IOException {
+        File destDir = new File(destDirectory);
+        if (!destDir.exists()) {
+            destDir.mkdir();
+        }
+        ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath));
+        ZipEntry entry = zipIn.getNextEntry();
+//         iterates over entries in the zip file
+        while (entry != null) {
+        	String entryName;
+        	if(System.getProperty("os.name").contains("Windows")){
+        		entryName = entry.getName().replaceAll("/", "\\"+File.separator);
+        	}else{
+        		entryName = entry.getName();
+        	}
+            String filePath = destDirectory + entryName;
+            String currPath = destDirectory;
+            String[] dirs = entryName.split("\\"+File.separator);
+            String currToken;
+            for(int i = 0; i<dirs.length;++i){
+            	currToken = dirs[i];
+            	if(!entry.isDirectory() && i==dirs.length-1){
+            		 extractFile(zipIn, filePath);
+            	} else {
+            		if(currPath.endsWith(File.separator)){
+            			currPath = currPath + currToken;
+            		}else{
+            			currPath = currPath + File.separator + currToken;
+            		}
+//                     if the entry is a directory, make the directory
+                    File dir = new File(currPath);
+                    dir.mkdir();
+                }
+            }
+            zipIn.closeEntry();
+            entry = zipIn.getNextEntry();
+        }
+        zipIn.close();
+    }
+
+    private static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
+        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
+        byte[] bytesIn = new byte[BUFFER_SIZE];
+        int read = 0;
+        while ((read = zipIn.read(bytesIn)) != -1) {
+            bos.write(bytesIn, 0, read);
+        }
+        bos.close();
+    }
+	
+    public static int getFileCountFromDefaulDownloadDirectory(){
+    	return new File(SetupCDTest.getWindowTest().getDownloadDirectory()).listFiles().length;
+    }
+    
+    
+    public static String getKeyByValueFromPropertyFormatFile(String fullPath, String key) {
+		Properties prop = new Properties();
+		InputStream input = null;
+		String value = null;
+		try {
+			input = new FileInputStream(fullPath);
+			prop.load(input);
+			value = (prop.getProperty(key));
+
+		} catch (IOException ex) {
+			ex.printStackTrace();
+		} finally {
+			if (input != null) {
+				try {
+					input.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+
+		return value.replaceAll("\"","");
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
new file mode 100644
index 0000000..19c2242
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/GeneralUIUtils.java
@@ -0,0 +1,790 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.datatypes.CatalogFilterTitlesEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.DashboardCardEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.NoSuchElementException;
+import org.openqa.selenium.OutputType;
+import org.openqa.selenium.TakesScreenshot;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.FluentWait;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+
+public final class GeneralUIUtils {
+
+	public static final String FILE_NAME = "Valid_tosca_Mycompute.yml";
+	
+	private static int timeOut=(int) (60*1.5);
+	
+//	public static void setTimeOut(int time) {
+//		if (time>0) {
+//			timeOut=time;	
+//		}
+//		else {
+//			timeOut=timeOut;
+//		}
+//	}
+
+	/**************** DRIVER ****************/
+	
+	public static WebDriver getDriver() {
+		try{
+			return DriverFactory.getDriver();
+		}
+		catch(Exception e){
+			e.printStackTrace();
+		}
+		return null;
+	}
+	/****************************************/
+	
+	public static List<WebElement> getElemenetsFromTable(By by) {
+		return getDriver().findElements(by);
+	}
+
+	public static File takeScreenshot(String screenshotFilename, String dir, String testName) throws IOException {
+		if (screenshotFilename == null) {
+			if (testName != null){
+				screenshotFilename = testName;
+			}
+			else
+			{
+				screenshotFilename = UUID.randomUUID().toString();
+			}
+		}
+		try {
+			File scrFile = ((TakesScreenshot) getDriver()).getScreenshotAs(OutputType.FILE);
+			File filePath = new File(String.format("%s/%s.png", dir, screenshotFilename));
+			new File(dir).mkdirs();
+			FileUtils.copyFile(scrFile, filePath);
+			return filePath;
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return null;
+	}
+	
+	public static File takeScreenshot(String screenshotFilename, String dir) throws IOException{
+		return takeScreenshot(screenshotFilename, dir, null);
+	}
+
+
+	public static void scrollDown() {
+		try{
+			Robot robot = new Robot();
+			robot.keyPress(KeyEvent.VK_DOWN);
+			robot.keyRelease(KeyEvent.VK_DOWN);
+			GeneralUIUtils.waitForLoader();
+		}
+		catch(Exception e){
+			e.printStackTrace();
+		}
+	}
+
+	public static void minimizeCatalogFilterByTitle(CatalogFilterTitlesEnum titlesEnum) {
+
+		switch (titlesEnum) {
+		case CATEGORIES:
+			GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click();
+			break;
+		case STATUS:
+			GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click();
+			break;
+		case TYPE:
+			GeneralUIUtils.getWebElementByTestID(titlesEnum.getValue()).click();
+			break;
+		default:
+			break;
+		}
+	
+	}
+
+	public static WebElement getWebElementByTestID(String dataTestId) {
+		return getWebElementByTestID(dataTestId, timeOut);
+	}
+	
+	public static WebElement getWebElementByTestID(String dataTestId, int timeout) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeout);
+		return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+	}
+	
+	public static boolean isWebElementExistByTestId(String dataTestId) {
+		if(getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).size() == 0) {
+			return false;
+		}
+		return true;
+	}
+
+	public static WebElement getInputElement(String dataTestId) {
+		try{
+			ultimateWait();
+			return getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+		}
+		catch(Exception e){
+			return null;
+		}
+	}
+
+	public static List<WebElement> getInputElements(String dataTestId) {
+		ultimateWait();
+		return getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+
+	}
+	
+	public static WebElement getWebElementBy(By by) {
+		return getWebElementBy(by, timeOut);
+	}
+	
+	public static WebElement getWebElementBy(By by, int timeOut) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfElementLocated(by));
+	}
+	
+	public static List<String> getWebElementListText(List<WebElement>elements) {
+		List<String>Text=new ArrayList<>();
+		for (WebElement webElement : elements) {
+			Text.add(webElement.getText());
+		}
+		return Text;
+	}
+	
+	
+	public static List<WebElement> getWebElementsListBy(By by) {
+		return getWebElementsListBy(by, timeOut);
+	}
+	
+	public static List<WebElement> getWebElementsListBy(By by, int timeOut) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(by));
+	}
+	
+	public static List<WebElement> getWebElementsListByContainTestID(String dataTestId) {
+		try{
+			WebDriverWait wait = new WebDriverWait(getDriver(), 10);
+			return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@data-tests-id, '"+dataTestId+"')]")));
+		}
+		catch(Exception e){
+			return new ArrayList<WebElement>();
+		}
+	}
+	
+	public static List<WebElement> getWebElementsListByContainsClassName(String containedText) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("//*[contains(@class, '"+containedText+"')]")));
+	}
+	
+	public static WebElement getWebElementByContainsClassName(String containedText) {
+		return getWebElementBy(By.xpath("//*[contains(@class, '"+containedText+"')]"));
+	}
+	
+	public static WebElement getWebElementByClassName(String className) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfElementLocated(By.className(className)));
+	}
+	
+	public static WebElement getWebElementByLinkText(String linkText) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@text='" + linkText + "']")));
+	}
+	
+	
+	public static List<WebElement> getWebElementsListByTestID(String dataTestId) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+	}
+	
+	public static List<WebElement> getWebElementsListByClassName(String className) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.className(className)));
+	}
+	
+	
+
+
+	public static Boolean isElementInvisibleByTestId(String dataTestId) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(
+				ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+	}
+	
+	public static Boolean isElementVisibleByTestId(String dataTestId) {
+		try{
+			WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+			if(wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//*[@data-tests-id='" + dataTestId + "']")))).isDisplayed()){
+				return true;
+			}else {
+				return false;
+			}
+		}
+		catch(Exception e){
+			return false;
+		}
+	}
+	
+	public static void clickOnElementByTestId(String dataTestId) {
+		clickOnElementByTestIdWithoutWait(dataTestId);
+		ultimateWait();
+	}
+	
+	public static void clickOnElementByTestIdWithoutWait(String dataTestId) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).click();
+	}
+	
+	public static void clickOnElementByTestId(String dataTestId, int customTimeout) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout);
+		wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).click();
+	}
+
+	public static WebElement waitForElementVisibilityByTestId(String dataTestId) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+	}
+	
+	public static Boolean waitForElementInVisibilityByTestId(String dataTestId) {
+		return waitForElementInVisibilityByTestId(dataTestId, timeOut);
+	}
+	
+	public static Boolean waitForElementInVisibilityByTestId(String dataTestId, int timeOut) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		boolean displayed = getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId + "']")).isEmpty();
+		if (!displayed){
+			Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + dataTestId + "'])")));
+			ultimateWait();
+			return until;
+		}
+		return false;
+	}
+	
+	public static Boolean waitForElementInVisibilityByTestId(By by) {
+		return waitForElementInVisibilityBy(by, timeOut);
+	}
+	
+	
+	public static Boolean waitForElementInVisibilityBy(By by, int timeOut) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		boolean displayed = getDriver().findElements(by).isEmpty();
+		if (!displayed){
+			Boolean until = wait.until(ExpectedConditions.invisibilityOfElementLocated(by));
+			sleep(1000);
+			return until;
+		}
+		return false;
+	}
+	
+	
+	public static void setWebElementByTestId(String elemetID, String value) {
+		WebElement resourceDescriptionTextbox = GeneralUIUtils.getWebElementByTestID(elemetID);
+		resourceDescriptionTextbox.clear();
+		resourceDescriptionTextbox.sendKeys(value);
+		
+	}
+	
+	public static WebElement hoverOnAreaByTestId(String areaId) {
+		Actions actions = new Actions(getDriver());
+		WebElement area = getWebElementByTestID(areaId);
+		actions.moveToElement(area).perform();
+		ultimateWait();
+		return area;
+	}
+	
+	public static WebElement hoverOnAreaByClassName(String className) {
+		Actions actions = new Actions(getDriver());
+		WebElement area = getWebElementByClassName(className);
+		actions.moveToElement(area).perform();
+		GeneralUIUtils.ultimateWait();
+		return area;
+	}
+	
+	public static void clickElementUsingActions(WebElement element){
+		Actions actions = new Actions(getDriver());
+		
+		actions.moveToElement(element);
+		actions.perform();
+		
+		actions.click();
+		actions.perform();
+		
+		ultimateWait();
+	}
+	
+	public static void waitForLoader() {
+		waitForLoader(timeOut);
+	}
+	
+	public static void waitForLoader(int timeOut) {
+		sleep(500);
+		waitForElementInVisibilityBy(By.className("tlv-loader"), timeOut);
+	}
+	
+	public static void findComponentAndClick(String resourceName) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Searching for " + resourceName + " in homepage");
+		WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+		try{
+			searchTextbox.clear();
+			searchTextbox.sendKeys(resourceName);
+			ultimateWait();
+		}
+		catch(Exception e){
+			SetupCDTest.getExtendTest().log(Status.INFO, "Can't interact with search bar");
+			e.printStackTrace();
+		}
+		
+		
+		try{
+			SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on the %s component from home screen", resourceName));
+			clickOnElementByTestId(resourceName);
+			GeneralUIUtils.ultimateWait();
+			getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
+		}
+		catch(Exception e){
+			SetupCDTest.getExtendTest().log(Status.INFO, "Can't click on component named " + resourceName);
+			e.printStackTrace();
+		}
+	}
+	
+	
+	public static String getComponentVersion(String componentName) {
+		return GeneralUIUtils.getWebElementByTestID(componentName + "Version").getText();
+	}
+	
+	public static void windowZoomOut() {
+			final int zoomOutFactor = 3;
+			for (int i = 0; i < zoomOutFactor; i++) {
+				if(getDriver() instanceof FirefoxDriver) {
+					getDriver().findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
+				}
+		}
+	}
+	
+	public static void resetZoom(){
+		getDriver().findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, "0"));
+	}
+	
+	public static void windowZoomOutUltimate(){
+		resetZoom();
+		windowZoomOut();
+//		JavascriptExecutor js = (JavascriptExecutor) driver;
+//		js.executeScript("document.body.style.zoom='90%'");
+	}
+	
+	public static void clickASDCLogo() {
+		WebDriverWait wait = new WebDriverWait(getDriver(), 15);
+		wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("ASDC")));
+		WebElement ClickASDCLogo = getDriver().findElement(By.linkText("ASDC"));
+		ClickASDCLogo.click();
+		GeneralUIUtils.waitForLoader();
+	}
+	
+	public static void sleep(int duration) {
+		try {
+			Thread.sleep(duration);
+		} catch (InterruptedException e) {
+			throw new RuntimeException(e);
+		}
+	}
+	
+	public static void moveToStep(DataTestIdEnum.StepsEnum Stepname) {
+		moveToStep(Stepname.getValue());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Going to %s page ", Stepname.toString()));
+	}
+
+	public static void moveToStep(String dataTestId) {
+		clickOnElementByTestId(dataTestId);
+		ultimateWait();
+	}
+	
+	
+	public static Select getSelectList(String item, String datatestsid) {
+		Select selectlist = new Select(getWebElementByTestID(datatestsid));
+		if (item != null) {
+			selectlist.selectByVisibleText(item);
+		}
+		return selectlist;
+	}	
+	
+	public static List<WebElement> waitForElementsListVisibilityTestMethod(DashboardCardEnum dataTestId) {
+		GeneralUIUtils.waitForLoader();
+		return getDriver().findElements(By.xpath("//*[@data-tests-id='" + dataTestId.getValue() + "']"));
+	}
+	
+    public static List<WebElement> getElementsByCSS(String cssString) throws InterruptedException {
+		GeneralUIUtils.waitForLoader();
+		List<WebElement> assets = getDriver().findElements(By.cssSelector(cssString));
+		return assets;
+	}
+   
+    public static WebElement getElementfromElementByCSS(WebElement parentElement, String cssString){
+    	WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+    	GeneralUIUtils.waitForLoader();
+    	return parentElement.findElement(By.cssSelector(cssString));
+    }
+    
+    public static WebElement getElementfromElementByXPATH(WebElement parentElement, DashboardCardEnum dataTestId){
+    	WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+    	GeneralUIUtils.waitForLoader();
+    	return HighlightMyElement( parentElement.findElement(By.xpath("//*[@data-tests-id='" + dataTestId.getValue() + "']")));
+    }
+    
+    public static WebElement HighlightMyElement(WebElement element) { 
+	   JavascriptExecutor javascript = (JavascriptExecutor) getDriver();
+	   javascript.executeScript("arguments[0].setAttribute('style', arguments[1]);", element, "color: yellow; border: 4px solid yellow;");
+	   return element;
+    } 
+    
+    public static WebElement getSelectedElementFromDropDown(String dataTestId){
+    	GeneralUIUtils.ultimateWait();;
+    	WebElement selectedElement = new Select (getDriver().findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"))).getFirstSelectedOption();
+    	return selectedElement;
+    }
+    
+    
+    public static void waitForPageLoadByReadyState() {
+        new WebDriverWait(getDriver(), 30).until((ExpectedCondition<Boolean>) wd ->	
+        	((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));
+    }
+    
+
+	public static boolean checkElementsCountInTable(int expectedElementsCount, Supplier<List<WebElement>> func) {
+		int maxWaitingPeriodMS = 10 * 1000;
+		int napPeriodMS = 100;
+		int sumOfWaiting = 0;
+		List<WebElement> elements = null;
+		boolean isKeepWaiting = false;
+		while (!isKeepWaiting) {
+			elements = func.get();
+			isKeepWaiting = (expectedElementsCount == elements.size());
+			sleep(napPeriodMS);
+			sumOfWaiting += napPeriodMS;
+			if (sumOfWaiting > maxWaitingPeriodMS)
+				return false;
+		}
+		return true;
+	}
+	
+	public static String getActionDuration(Runnable func) throws Exception{
+		long startTime = System.nanoTime();
+		func.run();
+		long estimateTime = System.nanoTime();
+	    long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
+	    String durationString = String.format("%02d:%02d", duration / 60, duration % 60);
+	    return durationString;
+	}
+	
+    public static WebElement clickOnAreaJS(String areaId) {
+    	return clickOnAreaJS(areaId, timeOut);
+    }
+    
+    
+    public static WebElement clickOnAreaJS(String areaId, int timeout) {
+    	try{
+    		ultimateWait();
+	        WebElement area = getWebElementByTestID(areaId);
+	        JavascriptExecutor javascript = (JavascriptExecutor) getDriver();
+	        //HighlightMyElement(area);
+	        Object executeScript = javascript.executeScript("arguments[0].click();", area, "color: yellow; border: 4px solid yellow;");
+	        waitForLoader(timeout);      
+	        return area;
+    	}
+    	catch (Exception e){
+    		e.printStackTrace();
+    	}
+		return null;
+    }
+
+    
+    
+    public static WebElement clickOnAreaJS(WebElement areaId) throws InterruptedException {
+        JavascriptExecutor javascript = (JavascriptExecutor) getDriver();
+        //HighlightMyElement(area);
+        javascript.executeScript("arguments[0].click();", areaId, "color: yellow; border: 4px solid yellow;");
+        return areaId;
+    }
+    
+    
+    
+    public static void clickSomewhereOnPage() {
+    	getDriver().findElement(By.cssSelector(".asdc-app-title")).click();
+	}
+    
+    public static void findComponentAndClickInCatalog(String resourceName) throws Exception {
+    	// This method will find element by element name, don't use data-tests-id argument
+		WebElement searchTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue());
+		searchTextbox.clear();
+		searchTextbox.sendKeys(resourceName);
+		ultimateWait();
+		clickOnElementByText(resourceName);
+		ultimateWait();
+	}
+    
+	public static void clickOnElementByText(String textInElement) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		HighlightMyElement(wait.until(
+				ExpectedConditions.elementToBeClickable(findByText(textInElement)))).click();
+	}
+	
+	public static void clickOnElementByText(String textInElement, int customTimeout) {
+		WebDriverWait wait = new WebDriverWait(getDriver(), customTimeout);
+		HighlightMyElement(wait.until(
+				ExpectedConditions.elementToBeClickable(findByText(textInElement)))).click();
+	}
+    
+	public static void clickJSOnElementByText(String textInElement) throws Exception {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		clickOnAreaJS(wait.until(
+				ExpectedConditions.elementToBeClickable(findByText(textInElement))));
+	}
+	
+    public static void fluentWaitTestID(String dataTestId, String text) {
+    	FluentWait<WebDriver> fluentWait = new FluentWait<WebDriver>(getDriver())
+				.withTimeout(30, TimeUnit.SECONDS)
+				.pollingEvery(50, TimeUnit.MILLISECONDS)
+				.ignoring(NoSuchElementException.class);
+
+		fluentWait.until(ExpectedConditions.refreshed(
+				ExpectedConditions.textToBePresentInElementValue(By.xpath("//*[@data-tests-id='" + dataTestId + "']"), text)));
+    }    
+    
+    public static void regularWait(WebElement element, String text){
+    	WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+
+		wait.until(ExpectedConditions.textToBePresentInElementValue(element, text));
+    }
+    
+    public static void waitForAngular(){
+    	WebDriverWait wait = new WebDriverWait(getDriver(), 90, 100);
+    	wait.until(AdditionalConditions.pageLoadWait());
+    	wait.until(AdditionalConditions.angularHasFinishedProcessing());
+    }
+    
+	public static Object getAllElementAttributes(WebElement element) {
+		return ((JavascriptExecutor)getDriver()).executeScript("var s = []; var attrs = arguments[0].attributes; for (var l = 0; l < attrs.length; ++l) { var a = attrs[l]; s.push(a.name + ':' + a.value); } ; return s;", element);
+	}
+    
+    public static boolean isElementReadOnly(WebElement element){
+    	try {
+    		HighlightMyElement(element).clear();
+			return false;
+		} catch (Exception e) {
+			return true;
+		} 	
+    }
+    
+    public static boolean isElementReadOnly(String dataTestId){
+    	return isElementReadOnly(
+    			waitForElementVisibilityByTestId(dataTestId));
+    }
+    
+    public static boolean isElementDisabled(WebElement element){
+    	return HighlightMyElement(element).getAttribute("class").contains("view-mode") || 
+    			element.getAttribute("class").contains("disabled");
+    }
+    
+    public static boolean isElementDisabled(String dataTestId){
+    	return isElementDisabled(
+    			waitForElementVisibilityByTestId(dataTestId));
+    }
+    
+    public static void ultimateWait(){
+    	long startTime = System.nanoTime();                    
+
+    	GeneralUIUtils.waitForLoader();
+    	GeneralUIUtils.waitForBackLoader();
+		GeneralUIUtils.waitForAngular();
+		
+		long estimateTime = System.nanoTime();
+		long duration = TimeUnit.NANOSECONDS.toSeconds(estimateTime - startTime);
+//		System.out.println("UltimateWait took: "+ duration);
+		if(duration > timeOut){
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Delays on page, %d seconds", duration));
+		}
+//		waitForUINotification();
+    }
+    
+    public static WebElement makeElementVisibleWithJS(WebElement element){
+    	String js = "arguments[0].style.height='auto'; arguments[0].style.visibility='visible';";
+    	((JavascriptExecutor) getDriver()).executeScript(js, element);
+    	return element;   	
+    }
+    
+    public static WebElement unhideElement(WebElement element, String attributeValue){
+    	String js = "arguments[0].setAttribute('class','" + attributeValue + "');";
+    	((JavascriptExecutor) getDriver()).executeScript(js, element);
+    	return element;   	
+    }   
+         
+    public static WebElement findByText(String textInElement){
+    	return getDriver().findElement(searchByTextContaining(textInElement));
+    }
+    public static By searchByTextContaining(String textInElement) {
+		return By.xpath("//*[contains(text(),'" + textInElement + "')]");
+	}
+    
+    
+    public static boolean findAndWaitByText(String textInElement, int timeout){
+    	try{
+    		WebDriverWait wait = new WebDriverWait(getDriver(), timeout);
+    		wait.until(ExpectedConditions.presenceOfElementLocated(searchByTextContaining(textInElement)));
+    		return true;
+    	}
+    	catch(Exception e){
+    		return false;
+    	}
+    }
+    
+    public static WebElement getClickableButtonBy(By by, int timout){
+    	try{
+    		WebDriverWait wait = new WebDriverWait(getDriver(), timout);
+    		WebElement element = wait.until(ExpectedConditions.elementToBeClickable(by));
+    		return element;
+    	}
+    	catch(Exception e){
+    		return null;
+    	}
+    }
+    
+    
+    
+    public static WebElement getButtonWithText(String textInButton){
+    	try{
+    		return getDriver().findElement(By.xpath("//button[contains(text(),'" + textInButton + "')]"));
+    	}
+    	catch(Exception e)
+    	{
+    		return null;
+    	}
+    }
+    
+    
+    public static List<WebElement> getElementsByDataTestsIdStartWith(String startWithString){
+    	ultimateWait();
+    	return getDriver().findElements(By.xpath("//*[starts-with(@data-tests-id,'" + startWithString + "')]"));
+    }
+    
+	public static void closeErrorMessage() {
+		WebElement okWebElement = getButtonWithText("OK");
+		if (okWebElement != null){
+			okWebElement.click();
+			ultimateWait();
+		}
+	}
+    
+    public static WebElement getElementByCSS(String cssString) throws InterruptedException {
+		ultimateWait();
+		return getDriver().findElement(By.cssSelector(cssString));
+	}
+    
+    public static String getDataTestIdAttributeValue(WebElement element) {
+		return element.getAttribute("data-tests-id");
+	}
+    
+    public static String getTextContentAttributeValue(WebElement element) {
+		return element.getAttribute("textContent");
+	}
+    
+    public static WebElement getElementInsideElementByDataTestsId(WebElement element, String dataTestId) {
+    	try{
+    		return element.findElement(By.xpath("//*[@data-tests-id='" + dataTestId + "']"));
+    	}
+    	catch(Exception e){
+    		return null;
+    	}
+	}
+    
+    public static void clickOnElementByCSS(String cssString) throws Exception {
+		WebDriverWait wait = new WebDriverWait(getDriver(), timeOut);
+		wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(cssString))).click();
+		ultimateWait();
+	}
+	public static String getRandomComponentName(String prefix) {
+		return prefix + GeneralUIUtils.randomNumber();
+	}
+	public static int randomNumber() {
+		Random r = new Random();
+		return r.nextInt(10000);
+	}
+	
+	public static void waitForUINotification() {
+		List<WebElement> notificationElements = getDriver().findElements(By.className("ui-notification"));
+		if (!notificationElements.isEmpty()){
+			notificationElements.forEach(WebElement::click);
+		}
+	}
+	
+	public static boolean checkForDisabledAttribute(String  dataTestId){
+		Object elementAttributes = getAllElementAttributes(waitForElementVisibilityByTestId(dataTestId));
+		return elementAttributes.toString().contains("disabled");
+	}
+	
+	public static void dragAndDropElementByY(WebElement area, int yOffset) {
+		Actions actions = new Actions(getDriver());
+		actions.dragAndDropBy(area, 10, yOffset).perform();
+		ultimateWait();
+	}
+	
+	public static void waitForBackLoader() {
+		waitForBackLoader(timeOut);
+	}
+	
+	public static void waitForBackLoader(int timeOut) {
+		sleep(100);
+		waitForElementInVisibilityBy(By.className("tlv-loader-back"), timeOut);
+	}
+	
+	public static void addStringtoClipboard(String text){
+		StringSelection selection = new StringSelection(text);
+	    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
+	    clipboard.setContents(selection, selection);
+	}
+    
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java
new file mode 100644
index 0000000..1bef2ad
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/HomeUtils.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import org.openecomp.sdc.ci.tests.datatypes.TopMenuButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class HomeUtils {
+
+	public static WebElement createAndImportButtons(CreateAndImportButtonsEnum type, WebDriver driver)
+			throws InterruptedException {
+		switch (type) {
+		case IMPORT_CP:
+		case IMPORT_VFC:
+		case IMPORT_VL:
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue());
+			return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.IMPORT_VFC.getValue());
+
+		case IMPORT_VF:
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.IMPORT_AREA.getValue());
+			return GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.IMPORT_VFC.getValue());
+		case CREATE_SERVICE:
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+			;
+			break;
+
+		case CREATE_PRODUCT:
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+			break;
+
+		default:
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+			driver.findElement(By.xpath("//*[@data-tests-id='createResourceButton']")).click();
+			break;
+		}
+		return null;
+
+	}
+
+	public static String checkBoxLifeCyclestate(CheckBoxStatusEnum lifeCycle) {
+		String Status = "IN DESIGN CHECK OUT";
+		switch (lifeCycle) {
+		case CHECKIN:
+			Status = "IN DESIGN CHECK IN";
+			if (GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).isDisplayed()) {
+				GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+			}
+			break;
+		case CHECKOUT:
+			GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+			Status = "IN DESIGN CHECK OUT";
+			break;
+		case IN_TESTING:
+			GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+			Status = "IN TESTING";
+			break;
+		case READY_FOR_TESTING:
+			GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+			Status = "READY FOR TESTING";
+			break;
+		case CERTIFIED:
+			GeneralUIUtils.getWebElementByTestID(lifeCycle.getValue()).click();
+			Status = "CERTIFIED";
+			break;
+		}
+		return Status;
+	}
+	
+	public static void findComponentAndClick(String componentName) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "finding component " + componentName);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.MainMenuButtons.SEARCH_BOX.getValue()).sendKeys(componentName);
+		WebElement foundComp = null;
+		try {
+			foundComp = GeneralUIUtils.getWebElementByTestID(componentName);
+			foundComp.click();
+			GeneralUIUtils.waitForLoader();
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.LIFECYCLE_STATE.getValue());
+		} catch (Exception e) {
+			String msg = String.format("DID NOT FIND A COMPONENT NAMED %s", componentName);
+			SetupCDTest.getExtendTest().log(Status.FAIL, msg);
+			System.out.println(msg);
+			Assert.fail(msg);
+		}
+	}
+	
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java
new file mode 100644
index 0000000..d1045ea
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ImportAssetUIUtils.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+public class ImportAssetUIUtils {
+	
+	public static final String FILE_PATH = System.getProperty("user.dir") + "\\src\\main\\resources\\Files\\";
+	public static String fileName = "JDM_vfc.yml";
+	public static final String toscaErrorMessage = "Invalid TOSCA template.";
+	public static final String yamlError = "Invalid YAML file.";
+	public static final String allReadyExistErro = "Imported resource already exists in ASDC Catalog.";
+
+	public static void importAsssetAndFillGeneralInfo(String FILE_PATH, String fileName,
+			ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception {
+		ResourceUIUtils.importFileWithSendKey(FILE_PATH, fileName, type);
+		ResourceUIUtils.fillResourceGeneralInformationPage(resourceDetails, user,true);
+	}
+
+	public static void importAsssetFillGeneralInfoAndSelectIcon(String FILE_PATH, String fileName,
+			ResourceReqDetails resourceDetails, User user, CreateAndImportButtonsEnum type) throws Exception {
+		importAsssetAndFillGeneralInfo(FILE_PATH, fileName, resourceDetails, user, type);
+		GeneralPageElements.clickCreateButton();
+		ResourceUIUtils.selectRandomResourceIcon();
+	}
+
+	// checking or unchecking the checkbox on right palette at designer
+	// workspace
+	public static void checkbox(String checkBoxname, WebDriver driver) {
+		driver.findElement(By.xpath("//label[@for='" + checkBoxname + "']")).click();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
new file mode 100644
index 0000000..dfb4b74
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/OnboardingUtils.java
@@ -0,0 +1,801 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.nio.file.FileSystems;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
+import org.apache.http.entity.mime.content.FileBody;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.ArtifactsCorrelationManager;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentArtifactPage;
+import org.openecomp.sdc.ci.tests.pages.HomePage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.verificator.VfVerificator;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+import com.clearspring.analytics.util.Pair;
+
+public class OnboardingUtils {
+
+	public OnboardingUtils() {
+	}
+
+	private static String vendorId;
+	private static String vendorLicenseName;
+	private static String vendorLicenseAgreementId;
+	private static String featureGroupId;
+
+	public static Pair<String, Map<String, String>> createVendorSoftwareProduct(String HeatFileName, String filepath, User user)
+			throws Exception {
+		Pair<String, Map<String, String>> pair = createVSP(HeatFileName, filepath, user);
+		
+		String vspid = pair.right.get("vspId");
+				
+		prepareVspForUse(user, vspid);
+		
+		return pair;
+	}
+
+	public static void prepareVspForUse(User user, String vspid) throws Exception {
+		RestResponse checkin = checkinVendorSoftwareProduct(vspid, user);
+		assertEquals("did not succeed to checking new VSP", 200, checkin.getErrorCode().intValue());
+
+		RestResponse submit = submitVendorSoftwareProduct(vspid, user);
+		assertEquals("did not succeed to submit new VSP", 200, submit.getErrorCode().intValue());
+
+		RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspid, user);
+		assertEquals("did not succeed to create package of new VSP ", 200, createPackage.getErrorCode().intValue());
+
+		SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor software product");
+	}
+
+	public static Pair<String, Map<String, String>> createVSP(String HeatFileName, String filepath, User user) throws Exception {
+		String vspName = handleFilename(HeatFileName);
+		
+		SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor software product");
+		
+		Pair<RestResponse, Map<String, String>> createNewVspPair = createNewVendorSoftwareProduct(vspName, vendorLicenseName, vendorId, vendorLicenseAgreementId, featureGroupId, user);
+		RestResponse createNewVendorSoftwareProduct = createNewVspPair.left;
+		assertEquals("did not succeed to create new VSP", 200,createNewVendorSoftwareProduct.getErrorCode().intValue());
+		String vspid = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "vspId");
+		String componentId = ResponseParser.getValueFromJsonResponse(createNewVendorSoftwareProduct.getResponse(), "componentId");
+		
+		Map<String, String> vspMeta = createNewVspPair.right;
+		Map<String, String> vspObject = new HashMap<String, String>();
+		Iterator<String> iterator = vspMeta.keySet().iterator();
+		while(iterator.hasNext()){
+			Object key = iterator.next();
+			Object value = vspMeta.get(key);
+			vspObject.put(key.toString(), value.toString());
+		}
+		vspObject.put("vspId", vspid);
+		vspObject.put("componentId", componentId);
+		vspObject.put("vendorName", vendorLicenseName);
+		vspObject.put("attContact", user.getUserId());
+		
+		RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspid, user);
+		assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+		
+		RestResponse validateUpload = validateUpload(vspid, user);
+		assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+		
+		Pair<String, Map<String, String>> pair = new Pair<String, Map<String, String>>(vspName, vspObject);
+		
+		return pair;
+	}
+	
+	public static void updateVspWithVfcArtifacts(String filepath, String vspId, String updatedSnmpPoll, String updatedSnmpTrap, String componentId, User user) throws Exception{
+		RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user);
+		assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+		ExtentTestActions.log(Status.INFO, "Deleting SNMP POLL");
+		deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_POLL);
+		ExtentTestActions.log(Status.INFO, "Deleting SNMP TRAP");
+		deleteSnmpArtifact(componentId, vspId, user, SnmpTypeEnum.SNMP_TRAP);
+		addVFCArtifacts(filepath, updatedSnmpPoll, updatedSnmpTrap, vspId, user, componentId);
+		prepareVspForUse(user, vspId);
+	}
+	
+	public static String updateVendorSoftwareProduct(String vspId, String HeatFileName, String filepath, User user)
+			throws Exception, Throwable {
+		String vspName = handleFilename(HeatFileName);
+		SetupCDTest.getExtendTest().log(Status.INFO, "Starting to update the vendor software product");
+
+		RestResponse checkout = checkoutVendorSoftwareProduct(vspId, user);
+		assertEquals("did not succeed to checkout new VSP", 200, checkout.getErrorCode().intValue());
+
+		RestResponse uploadHeatPackage = uploadHeatPackage(filepath, HeatFileName, vspId, user);
+		assertEquals("did not succeed to upload HEAT package", 200, uploadHeatPackage.getErrorCode().intValue());
+		
+		RestResponse validateUpload = validateUpload(vspId, user);
+		assertEquals("did not succeed to validate upload process", 200, validateUpload.getErrorCode().intValue());
+		
+		RestResponse checkin = checkinVendorSoftwareProduct(vspId, user);
+		assertEquals("did not succeed to checking VSP", 200, checkin.getErrorCode().intValue());
+
+
+		RestResponse submit = submitVendorSoftwareProduct(vspId, user);
+		assertEquals("did not succeed to submit VSP", 200, submit.getErrorCode().intValue());
+
+		RestResponse createPackage = createPackageOfVendorSoftwareProduct(vspId, user);
+		assertEquals("did not succeed to update package of VSP ", 200, createPackage.getErrorCode().intValue());
+
+		SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in updating the vendor software product");
+
+		return vspName;
+	}
+
+	public static String handleFilename(String heatFileName) {
+		final String namePrefix = "ciVFOnboarded-";
+		final String nameSuffix = "-" + getShortUUID();
+
+		String subHeatFileName = heatFileName.substring(0, heatFileName.lastIndexOf("."));
+
+		if ((namePrefix + subHeatFileName + nameSuffix).length() >= 50) {
+			subHeatFileName = subHeatFileName.substring(0, 50 - namePrefix.length() - nameSuffix.length());
+		}
+
+		if (subHeatFileName.contains("(") || subHeatFileName.contains(")")) {
+			subHeatFileName = subHeatFileName.replace("(", "-");
+			subHeatFileName = subHeatFileName.replace(")", "-");
+		}
+
+		String vnfName = namePrefix + subHeatFileName + nameSuffix;
+		return vnfName;
+	}
+	
+	public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user, String vspComponentId) throws Exception{
+		vspComponentId = (vspComponentId == null) ? getVSPComponentId(vspid, user) : vspComponentId;
+		if (vspComponentId != null){
+			if (snmpPoll != null){
+				ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP POLL with the file " + snmpPoll);
+				RestResponse uploadSnmpPollArtifact = uploadSnmpPollArtifact(filepath, snmpPoll, vspid, user, vspComponentId);
+				assertEquals("Did not succeed to add SNMP POLL", 200, uploadSnmpPollArtifact.getErrorCode().intValue());
+			}
+			if (snmpTrap != null){
+				ExtentTestActions.log(Status.INFO, "Adding VFC artifact of type SNMP TRAP with the file " + snmpTrap);
+				RestResponse uploadSnmpTrapArtifact = uploadSnmpTrapArtifact(filepath, snmpTrap, vspid, user, vspComponentId);
+				assertEquals("Did not succeed to add SNMP TRAP", 200, uploadSnmpTrapArtifact.getErrorCode().intValue());
+			}
+		}
+		
+		return vspComponentId;
+	}
+	
+	public static String addVFCArtifacts(String filepath, String snmpPoll, String snmpTrap, String vspid, User user) throws Exception{
+		return addVFCArtifacts(filepath, snmpPoll, snmpTrap, vspid, user, null);
+	}
+
+	private static RestResponse uploadSnmpPollArtifact(String filepath, String zipArtifact, String vspid, User user,
+			String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+		Config config = Utils.getConfig();
+		String snmpPollUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp/upload", 
+				config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
+		return uploadFile(filepath, zipArtifact, snmpPollUrl, user);
+	}
+	
+	private static RestResponse uploadSnmpTrapArtifact(String filepath, String zipArtifact, String vspid, User user,
+			String vspComponentId) throws FileNotFoundException, IOException, ClientProtocolException {
+		Config config = Utils.getConfig();
+		String snmpTrapUrl = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/snmp-trap/upload", 
+				config.getCatalogBeHost(),config.getCatalogBePort(), vspid, vspComponentId);
+		return uploadFile(filepath, zipArtifact, snmpTrapUrl, user);
+	}
+	
+	private static RestResponse deleteSnmpArtifact(String componentId, String vspId, User user, SnmpTypeEnum snmpType) throws Exception
+	{
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components/%s/monitors/%s", 
+				config.getCatalogBeHost(),config.getCatalogBePort(), vspId, componentId, snmpType.getValue());
+		String userId = user.getUserId();
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendDelete(url, headersMap);
+		return response;
+	}
+	
+	
+
+	private static String getVSPComponentId(String vspid, User user) throws Exception, JSONException {
+		RestResponse components = getVSPComponents(vspid, user);
+		String response = components.getResponse();
+		Map<String, Object> responseMap = (Map<String, Object>) JSONValue.parse(response);
+		JSONArray results = (JSONArray)responseMap.get("results");
+		for (Object res : results){
+			Map<String, Object> compMap= (Map<String, Object>) JSONValue.parse(res.toString());
+			String componentId = compMap.get("id").toString();
+			return componentId;
+		}
+		return null;
+	}
+	
+	private static RestResponse getVSPComponents(String vspid, User user) throws Exception{
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/components", config.getCatalogBeHost(),config.getCatalogBePort(), vspid);
+		String userId = user.getUserId();
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendGet(url, headersMap);
+		return response;
+	}
+
+	public static void createVendorLicense(User user) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Starting to create the vendor license");
+		vendorLicenseName = "ciLicense" + getShortUUID();
+		RestResponse vendorLicenseResponse = createVendorLicenseModels_1(vendorLicenseName, user);
+		assertEquals("did not succeed to create vendor license model", 200,
+				vendorLicenseResponse.getErrorCode().intValue());
+		vendorId = ResponseParser.getValueFromJsonResponse(vendorLicenseResponse.getResponse(), "value");
+
+		RestResponse vendorKeyGroupsResponse = createVendorKeyGroups_2(vendorId, user);
+		assertEquals("did not succeed to create vendor key groups", 200,
+				vendorKeyGroupsResponse.getErrorCode().intValue());
+		String keyGroupId = ResponseParser.getValueFromJsonResponse(vendorKeyGroupsResponse.getResponse(), "value");
+
+		RestResponse vendorEntitlementPool = createVendorEntitlementPool_3(vendorId, user);
+		assertEquals("did not succeed to create vendor entitlement pool", 200,
+				vendorEntitlementPool.getErrorCode().intValue());
+		String entitlementPoolId = ResponseParser.getValueFromJsonResponse(vendorEntitlementPool.getResponse(),
+				"value");
+
+		RestResponse vendorLicenseFeatureGroups = createVendorLicenseFeatureGroups_4(vendorId, keyGroupId,
+				entitlementPoolId, user);
+		assertEquals("did not succeed to create vendor license feature groups", 200,
+				vendorLicenseFeatureGroups.getErrorCode().intValue());
+		featureGroupId = ResponseParser.getValueFromJsonResponse(vendorLicenseFeatureGroups.getResponse(), "value");
+
+		RestResponse vendorLicenseAgreement = createVendorLicenseAgreement_5(vendorId, featureGroupId, user);
+		assertEquals("did not succeed to create vendor license agreement", 200,
+				vendorLicenseAgreement.getErrorCode().intValue());
+		vendorLicenseAgreementId = ResponseParser.getValueFromJsonResponse(vendorLicenseAgreement.getResponse(),
+				"value");
+
+		RestResponse checkinVendorLicense = checkinVendorLicense(vendorId, user);
+		assertEquals("did not succeed to checkin vendor license", 200, checkinVendorLicense.getErrorCode().intValue());
+
+		RestResponse submitVendorLicense = submitVendorLicense(vendorId, user);
+		assertEquals("did not succeed to submit vendor license", 200, submitVendorLicense.getErrorCode().intValue());
+
+		SetupCDTest.getExtendTest().log(Status.INFO, "Succeeded in creating the vendor license");
+	}
+
+	private static String getShortUUID() {
+		return UUID.randomUUID().toString().split("-")[0];
+	}
+
+	private static RestResponse actionOnComponent(String vspid, String action, String onboardComponent, User user)
+			throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/" + onboardComponent + "/%s/versions/0.1/actions",
+				config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+		String userId = user.getUserId();
+
+		JSONObject jObject = new JSONObject();
+		jObject.put("action", action);
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendPut(url, jObject.toString(), headersMap);
+		return response;
+	}
+
+	public static RestResponse checkinVendorLicense(String vspid, User user) throws Exception {
+		return actionOnComponent(vspid, "Checkin", "vendor-license-models", user);
+	}
+
+	public static RestResponse submitVendorLicense(String vspid, User user) throws Exception {
+		return actionOnComponent(vspid, "Submit", "vendor-license-models", user);
+	}
+
+	public static RestResponse createVendorLicenseModels_1(String name, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models", config.getCatalogBeHost(),
+				config.getCatalogBePort());
+		String userId = user.getUserId();
+
+		JSONObject jObject = new JSONObject();
+		jObject.put("vendorName", name);
+		jObject.put("description", "new vendor license model");
+		jObject.put("iconRef", "icon");
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+		return response;
+
+	}
+
+	public static RestResponse createVendorLicenseAgreement_5(String vspid, String featureGroupId, User user)
+			throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-agreements",
+				config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+		String userId = user.getUserId();
+
+		JSONObject licenseTermpObject = new JSONObject();
+		licenseTermpObject.put("choice", "Fixed_Term");
+		licenseTermpObject.put("other", "");
+
+		JSONObject jObjectBody = new JSONObject();
+		jObjectBody.put("name", "abc");
+		jObjectBody.put("description", "new vendor license agreement");
+		jObjectBody.put("requirementsAndConstrains", "abc");
+		jObjectBody.put("licenseTerm", licenseTermpObject);
+		jObjectBody.put("addedFeatureGroupsIds", Arrays.asList(featureGroupId).toArray());
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+		return response;
+	}
+
+	public static RestResponse createVendorLicenseFeatureGroups_4(String vspid, String licenseKeyGroupId,
+			String entitlementPoolId, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/feature-groups",
+				config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+		String userId = user.getUserId();
+
+		JSONObject jObject = new JSONObject();
+		jObject.put("name", "xyz");
+		jObject.put("description", "new vendor license feature groups");
+		jObject.put("partNumber", "123abc456");
+		jObject.put("addedLicenseKeyGroupsIds", Arrays.asList(licenseKeyGroupId).toArray());
+		jObject.put("addedEntitlementPoolsIds", Arrays.asList(entitlementPoolId).toArray());
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+		return response;
+
+	}
+
+	public static RestResponse createVendorEntitlementPool_3(String vspid, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/entitlement-pools",
+				config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+		String userId = user.getUserId();
+
+		JSONObject jEntitlementMetricObject = new JSONObject();
+		jEntitlementMetricObject.put("choice", "CPU");
+		jEntitlementMetricObject.put("other", "");
+
+		JSONObject jAggregationFunctionObject = new JSONObject();
+		jAggregationFunctionObject.put("choice", "Peak");
+		jAggregationFunctionObject.put("other", "");
+
+		JSONObject jOperationalScope = new JSONObject();
+		jOperationalScope.put("choices", Arrays.asList("Availability_Zone").toArray());
+		jOperationalScope.put("other", "");
+
+		JSONObject jTimeObject = new JSONObject();
+		jTimeObject.put("choice", "Hour");
+		jTimeObject.put("other", "");
+
+		JSONObject jObjectBody = new JSONObject();
+		jObjectBody.put("name", "def");
+		jObjectBody.put("description", "new vendor license entitlement pool");
+		jObjectBody.put("thresholdValue", "23");
+		jObjectBody.put("thresholdUnits", "Absolute");
+		jObjectBody.put("entitlementMetric", jEntitlementMetricObject);
+		jObjectBody.put("increments", "abcd");
+		jObjectBody.put("aggregationFunction", jAggregationFunctionObject);
+		jObjectBody.put("operationalScope", jOperationalScope);
+		jObjectBody.put("time", jTimeObject);
+		jObjectBody.put("manufacturerReferenceNumber", "123aaa");
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+		return response;
+	}
+
+	public static RestResponse createVendorKeyGroups_2(String vspid, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-license-models/%s/versions/0.1/license-key-groups",
+				config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+		String userId = user.getUserId();
+
+		JSONObject jOperationalScope = new JSONObject();
+		jOperationalScope.put("choices", Arrays.asList("Tenant").toArray());
+		jOperationalScope.put("other", "");
+
+		JSONObject jObjectBody = new JSONObject();
+		jObjectBody.put("name", "keyGroup");
+		jObjectBody.put("description", "new vendor license key group");
+		jObjectBody.put("operationalScope", jOperationalScope);
+		jObjectBody.put("type", "Universal");
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+
+		HttpRequest http = new HttpRequest();
+		RestResponse response = http.httpSendPost(url, jObjectBody.toString(), headersMap);
+		return response;
+	}
+
+	public static Pair<RestResponse, Map<String, String>> createNewVendorSoftwareProduct(String name, String vendorName, String vendorId,
+			String licenseAgreementId, String featureGroupsId, User user) throws Exception {
+		
+		Map<String, String> vspMetadta = new HashMap<String, String>();
+		
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products",
+				config.getCatalogBeHost(), config.getCatalogBePort());
+
+		String userId = user.getUserId();
+
+		JSONObject jlicensingDataObj = new JSONObject();
+		jlicensingDataObj.put("licenseAgreement", licenseAgreementId);
+		jlicensingDataObj.put("featureGroups", Arrays.asList(featureGroupsId).toArray());
+		
+		JSONObject jlicensingVersionObj = new JSONObject();
+		jlicensingVersionObj.put("id", "1.0");
+		jlicensingVersionObj.put("label", "1.0");
+
+		JSONObject jObject = new JSONObject();
+		jObject.put("name", name);
+		jObject.put("description", "new VSP description");
+		jObject.put("category", "resourceNewCategory.generic");
+		jObject.put("subCategory", "resourceNewCategory.generic.database");
+		jObject.put("licensingVersion", jlicensingVersionObj);
+		jObject.put("vendorName", vendorName);
+		jObject.put("vendorId", vendorId);
+		jObject.put("icon", "icon");
+		jObject.put("licensingData", jlicensingDataObj);
+		
+		vspMetadta.put("description", jObject.getString("description"));
+		vspMetadta.put("category", jObject.getString("category"));
+		vspMetadta.put("subCategory", jObject.getString("subCategory").split("\\.")[2]);
+		
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+		HttpRequest http = new HttpRequest();
+
+		RestResponse response = http.httpSendPost(url, jObject.toString(), headersMap);
+		
+		return new Pair<RestResponse, Map<String, String>>(response, vspMetadta);
+	}
+	
+	public static RestResponse getVendorSoftwareProduct(Map vspObject, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/" + vspObject.get("vspId"),
+				config.getCatalogBeHost(), config.getCatalogBePort());
+
+		String userId = user.getUserId();
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+		HttpRequest http = new HttpRequest();
+
+		RestResponse response = http.httpsSendGet(url, headersMap);
+
+		return response;
+	}
+	
+	public static RestResponse validateUpload(String vspid, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate/process",
+				config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+
+		String userId = user.getUserId();
+
+		Map<String, String> headersMap = prepareHeadersMap(userId);
+		HttpRequest http = new HttpRequest();
+		
+		String body =null;
+
+		RestResponse response = http.httpSendPut(url, body, headersMap);
+
+		return response;
+	}
+
+	public static RestResponse uploadHeatPackage(String filepath, String filename, String vspid, User user) throws Exception {
+		Config config = Utils.getConfig();
+		String url = String.format("http://%s:%s/onboarding-api/v1.0/vendor-software-products/%s/versions/0.1/orchestration-template-candidate", config.getCatalogBeHost(), config.getCatalogBePort(), vspid);
+		return uploadFile(filepath, filename, url, user);
+	}
+
+	private static RestResponse uploadFile(String filepath, String filename, String url, User user)
+			throws FileNotFoundException, IOException, ClientProtocolException {
+		CloseableHttpResponse response = null;
+
+		MultipartEntityBuilder mpBuilder = MultipartEntityBuilder.create();
+		mpBuilder.addPart("upload", new FileBody(getTestZipFile(filepath, filename)));
+
+		Map<String, String> headersMap = prepareHeadersMap(user.getUserId());
+		headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "multipart/form-data");
+
+		CloseableHttpClient client = HttpClients.createDefault();
+		try {
+			HttpPost httpPost = new HttpPost(url);
+			RestResponse restResponse = new RestResponse();
+
+			Iterator<String> iterator = headersMap.keySet().iterator();
+			while (iterator.hasNext()) {
+				String key = iterator.next();
+				String value = headersMap.get(key);
+				httpPost.addHeader(key, value);
+			}
+			httpPost.setEntity(mpBuilder.build());
+			response = client.execute(httpPost);
+			HttpEntity entity = response.getEntity();
+			String responseBody = null;
+			if (entity != null) {
+				InputStream instream = entity.getContent();
+				StringWriter writer = new StringWriter();
+				IOUtils.copy(instream, writer);
+				responseBody = writer.toString();
+				try {
+
+				} finally {
+					instream.close();
+				}
+			}
+
+			restResponse.setErrorCode(response.getStatusLine().getStatusCode());
+			restResponse.setResponse(responseBody);
+
+			return restResponse;
+
+		} finally {
+			closeResponse(response);
+			closeHttpClient(client);
+
+		}
+	}
+
+	private static void closeResponse(CloseableHttpResponse response) {
+		try {
+			if (response != null) {
+				response.close();
+			}
+		} catch (IOException e) {
+			System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+		}
+	}
+
+	private static void closeHttpClient(CloseableHttpClient client) {
+		try {
+			if (client != null) {
+				client.close();
+			}
+		} catch (IOException e) {
+			System.out.println(String.format("failed to close client or response: %s", e.getMessage()));
+		}
+	}
+
+	private static File getTestZipFile(String filepath, String filename) throws IOException {
+		Config config = Utils.getConfig();
+		String sourceDir = config.getImportResourceTestsConfigDir();
+		java.nio.file.Path filePath = FileSystems.getDefault().getPath(filepath + File.separator + filename);
+		return filePath.toFile();
+	}
+
+	public static RestResponse checkinVendorSoftwareProduct(String vspid, User user) throws Exception {
+		return actionOnComponent(vspid, "Checkin", "vendor-software-products", user);
+	}
+	
+	private static RestResponse checkoutVendorSoftwareProduct(String vspid, User user) throws Exception {
+		return actionOnComponent(vspid, "Checkout", "vendor-software-products", user);
+	}
+
+	public static RestResponse submitVendorSoftwareProduct(String vspid, User user) throws Exception {
+		return actionOnComponent(vspid, "Submit", "vendor-software-products", user);
+	}
+
+	public static RestResponse createPackageOfVendorSoftwareProduct(String vspid, User user) throws Exception {
+		return actionOnComponent(vspid, "Create_Package", "vendor-software-products", user);
+	}
+
+	protected static Map<String, String> prepareHeadersMap(String userId) {
+		Map<String, String> headersMap = new HashMap<String, String>();
+		headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");
+		headersMap.put(HttpHeaderEnum.ACCEPT.getValue(), "application/json");
+		headersMap.put(HttpHeaderEnum.USER_ID.getValue(), userId);
+		return headersMap;
+	}
+
+	
+	private static void importUpdateVSP(Pair<String, Map<String, String>> vsp, boolean isUpdate) throws Exception{
+		String vspName = vsp.left;
+		Map<String, String> vspMetadata = vsp.right;
+		boolean vspFound = HomePage.searchForVSP(vspName);
+
+		if (vspFound){
+			
+			List<WebElement> elemenetsFromTable = HomePage.getElemenetsFromTable();
+//			WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 30);
+//			WebElement findElement = wait.until(ExpectedConditions.visibilityOf(elemenetsFromTable.get(1)));
+//			findElement.click();
+			elemenetsFromTable.get(1).click();
+			GeneralUIUtils.waitForLoader();
+			
+			if (isUpdate){
+				GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.UPDATE_VSP.getValue());
+
+			}
+			else{
+				GeneralUIUtils.clickOnElementByTestId(DataTestIdEnum.ImportVfRepository.IMPORT_VSP.getValue());
+			}
+			
+			String lifeCycleState = ResourceGeneralPage.getLifeCycleState();
+			boolean needCheckout = lifeCycleState.equals(LifeCycleStateEnum.CHECKIN.getValue()) || lifeCycleState.equals(LifeCycleStateEnum.CERTIFIED.getValue());
+			if (needCheckout)
+			{
+				try {
+					ResourceGeneralPage.clickCheckoutButton();
+					Assert.assertTrue(ResourceGeneralPage.getLifeCycleState().equals(LifeCycleStateEnum.CHECKOUT.getValue()), "Did not succeed to checkout");
+					
+				} catch (Exception e) {
+					ExtentTestActions.log(Status.ERROR, "Did not succeed to checkout");
+					e.printStackTrace();
+				}
+				GeneralUIUtils.waitForLoader();
+			}
+			
+			//Metadata verification 
+			VfVerificator.verifyOnboardedVnfMetadata(vspName, vspMetadata);
+			
+			ExtentTestActions.log(Status.INFO, "Clicking create/update VNF");
+			String duration = GeneralUIUtils.getActionDuration(() -> waitUntilVnfCreated());
+		    ExtentTestActions.log(Status.INFO, "Succeeded in importing/updating " + vspName, duration);
+		}
+		else{
+			Assert.fail("Did not find VSP named " + vspName);
+		}
+	}
+
+	private static void waitUntilVnfCreated() {
+		GeneralUIUtils.clickOnElementByTestIdWithoutWait(DataTestIdEnum.GeneralElementsEnum.CREATE_BUTTON.getValue());
+		GeneralUIUtils.waitForLoader(60*10);
+		GeneralUIUtils.waitForAngular();
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.GeneralElementsEnum.CHECKIN_BUTTON.getValue());
+	}
+	
+	public static void updateVSP(Pair<String, Map<String, String>> vsp) throws Exception{
+		ExtentTestActions.log(Status.INFO, "Updating VSP " + vsp.left);
+		importUpdateVSP(vsp, true);
+	}
+	
+	public static void importVSP(Pair<String, Map<String, String>> vsp) throws Exception{
+		ExtentTestActions.log(Status.INFO, "Importing VSP " + vsp.left);
+		importUpdateVSP(vsp, false);
+	}
+
+	public static void updateVnfAndValidate(String filepath, Pair<String, Map<String, String>> vsp, String updatedVnfFile, User user) throws Exception, Throwable {
+		ExtentTestActions.log(Status.INFO, String.format("Going to update the VNF with %s......", updatedVnfFile));
+		System.out.println(String.format("Going to update the VNF with %s......", updatedVnfFile));
+		
+		Map<String, String> vspMap = vsp.right;
+		String vspId = vspMap.get("vspId");
+		
+		updateVendorSoftwareProduct(vspId, updatedVnfFile, filepath, user);
+		HomePage.showVspRepository();
+		updateVSP(vsp);
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, updatedVnfFile);
+	}
+
+	public static Pair<String, Map<String, String>> onboardAndValidate(String filepath, String vnfFile, User user) throws Exception {
+		ExtentTestActions.log(Status.INFO, String.format("Going to onboard the VNF %s", vnfFile));
+		System.out.println(String.format("Going to onboard the VNF %s", vnfFile));
+	
+		createVendorLicense(user);
+		Pair<String, Map<String, String>> createVendorSoftwareProduct = createVendorSoftwareProduct(vnfFile, filepath, user);
+		String vspName = createVendorSoftwareProduct.left;
+		
+		DownloadManager.downloadCsarByNameFromVSPRepository(vspName, createVendorSoftwareProduct.right.get("vspId"));
+		File latestFilefromDir = FileHandling.getLastModifiedFileFromDir();
+		
+		ExtentTestActions.log(Status.INFO, String.format("Searching for onboarded %s", vnfFile));
+		HomePage.showVspRepository();
+		ExtentTestActions.log(Status.INFO,String.format("Going to import %s", vnfFile.substring(0, vnfFile.indexOf("."))));
+		importVSP(createVendorSoftwareProduct);
+		
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentArtifactScreen();
+		
+		// Verify deployment artifacts
+		Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(latestFilefromDir.getAbsolutePath());
+		
+		LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+		ArtifactsCorrelationManager.addVNFartifactDetails(vspName, deploymentArtifacts);
+		
+		for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+			if(deploymentArtifact.getType().equals("HEAT_ENV")) {
+				continue;
+			} else if(deploymentArtifact.getFileName().contains(".")) {
+				ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().lastIndexOf(".")), "1", deploymentArtifact.getType());
+			} else {
+				ArtifactUIUtils.validateArtifactNameVersionType(deploymentArtifact.getFileName().trim(), "1", deploymentArtifact.getType());
+			}
+			
+		}
+		
+		DeploymentArtifactPage.verifyArtifactsExistInTable(filepath, vnfFile);
+		return createVendorSoftwareProduct;
+	}
+
+}
+
+enum SnmpTypeEnum{
+	SNMP_POLL ("snmp"),
+	SNMP_TRAP ("snmp-trap");
+	
+	private String value;
+
+	public String getValue() {
+		return value;
+	}
+
+	private SnmpTypeEnum(String value) {
+		this.value = value;
+	}
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java
new file mode 100644
index 0000000..9e478c8
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ProductUIUtils.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.awt.AWTException;
+import java.util.List;
+
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ProductGeneralPage;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+/**
+ * @author al714h
+ *
+ */
+
+public class ProductUIUtils {
+
+	protected static WebDriver driver;
+
+	public ProductUIUtils(TestName name, String className) {
+		super();
+	}
+
+	public static void fillProductGeneralPage(ProductReqDetails product, User user) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page.. "));
+		ProductGeneralPage.defineName(product.getName());
+		ProductGeneralPage.defineFullName(product.getFullName());
+		ProductGeneralPage.defineDescription(product.getDescription());
+		ProductGeneralPage.defineProjectCode(product.getProjectCode());
+		defineTagsList2(product.getTags());
+		ProductGeneralPage.defineContactId(product.getContactId());
+		GeneralUIUtils.clickSomewhereOnPage();		
+	}
+    
+	public static void createProduct(ProductReqDetails product, User user) throws Exception, AWTException {
+		clikAddProduct();
+		fillProductGeneralPage(product, user);
+		GeneralPageElements.clickCreateButton();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Product %s created", product.getName()));
+	}
+	
+	public static void defineTagsList2(List<String> productTags){
+		WebElement productTagsTextbox = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.ProductMetadataEnum.TAGS.getValue());
+		for (String tag : productTags) {
+			productTagsTextbox.clear();
+			productTagsTextbox.sendKeys(tag);
+			GeneralUIUtils.waitForAngular();
+			productTagsTextbox.sendKeys(Keys.ENTER);
+		}
+	}
+	
+	public static void clikAddProduct(){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking Add Product button"));
+		try {
+			GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_PRODUCT.getValue()).click();
+		GeneralUIUtils.ultimateWait();
+		} catch (Exception e){
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exception on catched on Add Product button, retrying ..."));
+			GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");			
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_PRODUCT.getValue()).click();
+			GeneralUIUtils.ultimateWait();
+		}
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
new file mode 100644
index 0000000..62b2f83
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/PropertiesUIUtils.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.PropertiesPage;
+import org.openqa.selenium.WebElement;
+
+import com.aventstack.extentreports.Status;
+
+public class PropertiesUIUtils {
+
+	// public static void addPropertByType(String type,String name,String
+	// defaultValue,String description) throws Exception{
+	//
+	// ResourceUIUtils.defineNewSelectList(type);
+	// ResourceUIUtils.definePropertyName(name);
+	// ResourceUIUtils.defineDefaultValueByType(defaultValue);
+	// ResourceUIUtils.defineDescription(description);
+	// Thread.sleep(2000);
+	// ResourceUIUtils.clickButton("Add");
+	// }
+	public static Map<String, String> addProperties(String name, String itemType, String defaultValue,
+			String description, String schemaType) throws Exception {
+		Map<String, String> propertyvalues = new HashMap<String, String>();
+		GeneralUIUtils.getSelectList(itemType, "propertyType");
+		ResourceUIUtils.definePropertyName(name);
+		if (itemType == "boolean") {
+			ResourceUIUtils.defineBoolenDefaultValue(defaultValue);
+			GeneralUIUtils.setWebElementByTestId("description","description");
+			Thread.sleep(2000);
+			GeneralUIUtils.getWebElementByTestID("Add").click();
+			;
+		} else if (itemType == "list" || itemType == "map") {
+			GeneralUIUtils.getSelectList(schemaType, "schemaType");
+		}
+		if (!(itemType == "boolean")) {
+			ResourceUIUtils.defineDefaultValueByType(defaultValue);
+			GeneralUIUtils.setWebElementByTestId("description", "des");
+			GeneralUIUtils.getWebElementByTestID("Add").click();
+			;
+			Thread.sleep(2000);
+		}
+		propertyvalues.put("type", itemType);
+		propertyvalues.put("defaultValue", defaultValue);
+		propertyvalues.put("description", description);
+		propertyvalues.put("name", name);
+
+		return propertyvalues;
+	}
+
+	public static void vlidateProperties(Map<String, String> propertyValues) throws InterruptedException {
+		WebElement name = GeneralUIUtils.getWebElementByTestID(propertyValues.get("name"));
+		name.getText().equalsIgnoreCase(propertyValues.get("name"));
+		WebElement defaultValue = GeneralUIUtils.getWebElementByTestID(propertyValues.get("name"));
+		defaultValue.getText().equalsIgnoreCase(propertyValues.get("defaultValue"));
+		WebElement type = GeneralUIUtils.getWebElementByTestID(propertyValues.get("type"));
+		type.getText().equalsIgnoreCase(propertyValues.get("type"));
+	}
+
+	public static void addNewProperty(PropertyTypeEnum property) {
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Adding new %s property", property.name()));
+		PropertiesPage.clickAddPropertyArtifact();
+		PropertiesPage.getPropertyPopup().insertPropertyName(property.getName());
+		PropertiesPage.getPropertyPopup().selectPropertyType(property.getType());
+		PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription());
+		PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue());
+		PropertiesPage.getPropertyPopup().clickSave();
+	}
+	
+	public static void updateProperty(PropertyTypeEnum property) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating property: %s", property.name()));
+		PropertiesPage.clickOnProperty(property.getName());
+		PropertiesPage.getPropertyPopup().insertPropertyDescription(property.getDescription());
+		PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(property.getValue());
+		PropertiesPage.getPropertyPopup().clickSave();
+	}
+	
+	public static void changePropertyDefaultValueInComposition(String propertyName, String defaultValue) {
+		GeneralUIUtils.clickOnElementByTestId(propertyName);
+		PropertiesPage.getPropertyPopup().insertPropertyDefaultValue(defaultValue);
+		PropertiesPage.getPropertyPopup().clickSave();
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
new file mode 100644
index 0000000..c76bf4b
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ResourceUIUtils.java
@@ -0,0 +1,1143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.http.HttpStatus;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.CheckBoxStatusEnum;
+import org.openecomp.sdc.ci.tests.datatypes.CreateAndImportButtonsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.Dashboard;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceCategoriesNameEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.ElementNotVisibleException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import org.testng.AssertJUnit;
+
+import com.aventstack.extentreports.Status;
+
+public final class ResourceUIUtils {
+	public static final String RESOURCE_NAME_PREFIX = "ResourceCDTest-";
+	protected static final boolean IS_BEFORE_TEST = true;
+	public static final String INITIAL_VERSION = "0.1";
+	public static final String ICON_RESOURCE_NAME = "call_controll";
+	protected static final String UPDATED_RESOURCE_ICON_NAME = "objectStorage";
+
+	private ResourceUIUtils() {
+	}
+
+	static WebDriver driver = GeneralUIUtils.getDriver();
+
+	public static void defineResourceName(String resourceName) {
+
+		WebElement resourceNameTextbox = GeneralUIUtils.getDriver().findElement(By.name("componentName"));
+		resourceNameTextbox.clear();
+		resourceNameTextbox.sendKeys(resourceName);
+	}
+
+	public static void defineResourceCategory(String category, String datatestsid) {
+
+		GeneralUIUtils.getSelectList(category, datatestsid);
+	}
+
+	// public static void uploadFileWithJavaRobot(String FilePath,String
+	// FileName) throws Exception{
+	//
+	// StringSelection Path= new StringSelection(FilePath+FileName);
+	// Thread.sleep(1000);
+	// java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().setContents(Path,
+	// null);
+	// Robot robot = new Robot();
+	// robot.delay(1000);
+	// robot.keyPress(KeyEvent.VK_CONTROL);
+	// robot.keyPress(KeyEvent.VK_V);
+	// robot.keyRelease(KeyEvent.VK_V);
+	// robot.keyRelease(KeyEvent.VK_CONTROL);
+	// robot.delay(1000);
+	// robot.keyPress(KeyEvent.VK_ENTER);
+	// robot.keyRelease(KeyEvent.VK_ENTER);
+	// robot.delay(1000);
+	// }
+	// click and upload tosca file //**to be changed.
+	public static void importFileWithSendKey(String FilePath, String FileName, CreateAndImportButtonsEnum type)
+			throws Exception {
+		WebElement importButton = HomeUtils.createAndImportButtons(type, driver).findElement(By.tagName("input"));
+		importButton.sendKeys(FilePath + FileName);
+	}
+
+	public static void importFileWithSendKeyBrowse(String FilePath, String FileName) throws Exception {
+		WebElement browsebutton = GeneralUIUtils.getWebElementByTestID("browseButton");
+		browsebutton.sendKeys(FilePath + FileName);
+	}
+
+	// public static void defineVendorName(String resourceVendorName) {
+	//
+	// WebElement resourceVendorNameTextbox =
+	// GeneralUIUtils.getWebElementByTestID("vendorName");
+	// resourceVendorNameTextbox.clear();
+	// resourceVendorNameTextbox.sendKeys(resourceVendorName);
+	// }
+
+	// public static void defineTagsList(ResourceReqDetails resource,String
+	// []resourceTags) {
+	// List<String>taglist = new ArrayList<String>();;
+	// WebElement resourceTagsTextbox =
+	// GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
+	// for (String tag : resourceTags) {
+	// resourceTagsTextbox.clear();
+	// resourceTagsTextbox.sendKeys(tag);
+	// resourceTagsTextbox.sendKeys(Keys.ENTER);
+	// taglist.add(tag);
+	// }
+	// resource.setTags(taglist);
+	// }
+
+	public static String defineUserId(String userId) {
+		//
+		WebElement resourceUserIdTextbox = ResourceGeneralPage.getContactIdField();
+		resourceUserIdTextbox.clear();
+		resourceUserIdTextbox.sendKeys(userId);
+		return userId;
+	}
+
+	public static void defineVendorRelease(String resourceVendorRelease) {
+
+		WebElement resourceVendorReleaseTextbox = GeneralUIUtils.getWebElementByTestID("vendorRelease");
+		resourceVendorReleaseTextbox.clear();
+		resourceVendorReleaseTextbox.sendKeys(resourceVendorRelease);
+	}
+
+	public static void selectResourceIcon(String resourceIcon) throws Exception {
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
+		wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@data-tests-id='" + resourceIcon + "']")))
+				.click();
+	}
+
+	public static String definePropertyName(String name) {
+
+		WebElement nameProperty = GeneralUIUtils.getDriver().findElement(By.name("propertyName"));
+		nameProperty.sendKeys(name);
+		return name;
+	}
+
+	public static void selectRandomResourceIcon() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.ICON);
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 4);
+		wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
+		List<WebElement> iconElement = GeneralUIUtils.getDriver()
+				.findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
+		iconElement.get(0).click();
+	}
+
+	public static List<WebElement> getAllObjectsOnWorkspace(WebDriver driver, ResourceReqDetails resource)
+			throws Exception {
+
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 10);
+		wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + resource.getName() + "']")));
+		return GeneralUIUtils.getDriver()
+				.findElements(By.xpath("//div[@class='" + "w-sdc-dashboard-card-info-name" + "']"));
+
+	}
+
+	public static String getErrorMessageText(String text) throws Exception {
+
+		return GeneralUIUtils.getWebElementByClassName(text).getText();
+
+	}
+
+	public static WebElement scrollElement(WebDriver driver) throws Exception {
+
+		return GeneralUIUtils.getDriver().findElement(By.className("ps-scrollbar-y"));
+	}
+
+	public static void scrollDownPage() throws AWTException, InterruptedException {
+		Robot robot = new Robot();
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+		robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+		robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+	}
+
+	public static void defineNewSelectList(String Text) {
+		WebElement mySelectElm = GeneralUIUtils.getDriver().findElement(By.className("i-sdc-form-select"));
+		Select mySelectString = new Select(mySelectElm);
+		mySelectString.selectByVisibleText(Text);
+	}
+
+	public static void defineDefaultValueByType(String Value) {
+
+		WebElement valueString = GeneralUIUtils.getDriver().findElement(By.name("value"));
+		valueString.clear();
+		valueString.sendKeys(Value);
+	}
+
+	public static void defineBoolenDefaultValue(String Value) {
+
+		WebElement elementBoolean = GeneralUIUtils.getDriver().findElement(By.name("value"));
+		Select se = new Select(elementBoolean);
+		se.selectByValue(Value);
+	}
+
+	public static void clickButtonBlue() {
+		WebElement clickButtonBlue = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
+		clickButtonBlue.click();
+	}
+
+	public static void clickButton(String selectButton) {
+
+		WebElement clickButton = GeneralUIUtils.getDriver()
+				.findElement(By.xpath("//*[@data-tests-id='" + selectButton + "']"));
+		clickButton.click();
+	}
+
+	public static WebElement Waitfunctionforbuttons(String element, int timeout) {
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
+		return wait.until(ExpectedConditions.elementToBeClickable(By.xpath(element)));
+	}
+
+	public static WebElement waitToButtonSubmitForTesting() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='submitForTesting']", 10);
+	}
+
+	public static WebElement waitToFinishButtonEnabled() {
+		return Waitfunctionforbuttons("//button[@data-tests-id='Finish']", 10);
+	}
+
+	public static WebElement waitToNextButtonEnabled() {
+		return Waitfunctionforbuttons("//button[@data-tests-id='Next']", 10);
+	}
+
+	public static WebElement waitToHomeMenu() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-home']", 10);
+	}
+
+	public static WebElement waitToCatalogMenu() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-button-catalog']", 10);
+	}
+
+	public static WebElement waitSearch() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='main-menu-input-search']", 10);
+	}
+
+	public static WebElement waitSubmitforTestingCard() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-SubmitforTesting']", 10);
+	}
+
+	public static WebElement waitViewCard() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='i-sdc-dashboard-card-menu-item-View']", 5);
+	}
+
+//	public static void waitOpenCard(String requiredElementUniqueId) throws Exception {
+//		WebElement menu = GeneralUIUtils.getDriver()
+//				.findElement(By.xpath("//*[@data-tests-id='" + requiredElementUniqueId + "']"));
+//		GeneralUIUtils.hoverOnAreaByTestId(menu);
+//	}
+
+	public static void fillResourceGeneralInformationPage(ResourceReqDetails resource, User user, boolean isNewResource) {
+		try {
+			ResourceGeneralPage.defineName(resource.getName());
+			ResourceGeneralPage.defineDescription(resource.getDescription());
+			ResourceGeneralPage.defineCategory(resource.getCategories().get(0).getSubcategories().get(0).getName());
+			ResourceGeneralPage.defineVendorName(resource.getVendorName());
+			ResourceGeneralPage.defineVendorRelease(resource.getVendorRelease());
+			if (isNewResource){
+				ResourceGeneralPage.defineTagsList(resource, new String[] { "This-is-tag", "another-tag", "Test-automation-tag" });
+			}
+			else{
+				ResourceGeneralPage.defineTagsList(resource, new String[] { "one-more-tag" });
+			}
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
+	
+	public static void fillMaxValueResourceGeneralInformationPage(ResourceReqDetails resource) {
+			String stringPattern = "ABCDabcd123456";
+			GeneralUIUtils.addStringtoClipboard(buildStringFromPattern(stringPattern, 5000));		  
+		    ResourceGeneralPage.defineNameWithPaste();
+		    ResourceGeneralPage.defineDescriptionWithPaste();
+		    ResourceGeneralPage.defineVendorNameWithPaste();
+		    ResourceGeneralPage.defineVendorReleaseWithPaste();
+//			ResourceGeneralPage.defineName(buildStringFromPattern(stringPattern, 5000));
+//			ResourceGeneralPage.defineDescription(buildStringFromPattern(stringPattern, 5000));
+//			ResourceGeneralPage.defineVendorName(buildStringFromPattern(stringPattern, 5000));
+//			ResourceGeneralPage.defineVendorRelease(buildStringFromPattern(stringPattern, 5000));
+//			ResourceGeneralPage.defineTagsList(resource, new String[] { buildStringFromPattern(stringPattern, 5000) });
+		    ResourceGeneralPage.defineTagsListWithPaste();
+			GeneralUIUtils.waitForAngular();
+	}
+	
+	public static String buildStringFromPattern(String stringPattern, int stringLength){
+		char[] chars = stringPattern.toCharArray();
+		StringBuilder sb = new StringBuilder();
+		Random random = new Random();
+		for (int i = 0; i < stringLength; i++) {
+		    char c = chars[random.nextInt(chars.length)];
+		    sb.append(c);
+		}
+		return sb.toString();
+	}
+
+	public static void fillNewResourceValues(ResourceReqDetails resource, User user) throws Exception {
+		fillResourceGeneralInformationPage(resource, user, true);
+		GeneralPageElements.clickCreateButton();
+		// selectIcon();
+	}
+
+	// coded by teddy.
+
+	public static WebElement waitfunctionforallelements(String element) {
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 5);
+		return wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@*='" + element + "']")));
+	}
+
+	public static WebElement waitFunctionForaGetElements(String element, int timeout) {
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), timeout);
+		return wait.until(
+				ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@data-tests-id='" + element + "']")));
+	}
+
+	public static void getVFCGeneralInfo(ResourceReqDetails resource, User user) throws InterruptedException {
+		Thread.sleep(2000);
+		String version = GeneralUIUtils.getWebElementsListByTestID("versionvalue").get(0).getText().substring(1);
+		String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value");
+		String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+		String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+				.getText();
+		String vendorName = GeneralUIUtils.getWebElementByTestID("vendorName").getAttribute("value");
+		String vendorRelease = GeneralUIUtils.getWebElementByTestID("vendorRelease").getAttribute("value");
+		List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
+		String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
+		int index = type.lastIndexOf(":");
+		System.out.println(type.substring(0, index));
+		String AttContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value");
+		System.out.println(resource.getVersion());
+		assertTrue(resource.getVersion().equals(version));
+		assertTrue(resource.getName().equals(name));
+		assertTrue(resource.getDescription().equals(description));
+		System.out.println(resource.getVendorName());
+		System.out.println(resource.getVendorRelease());
+		assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
+		assertTrue(resource.getVendorName().equals(vendorName));
+		assertTrue(resource.getVendorRelease().equals(vendorRelease));
+		assertTrue(resource.getCreatorUserId().equals(AttContact));
+		assertEquals(type.substring(0, index), resource.getResourceType());
+
+		for (int i = 0; i < tags.size(); i++) {
+			assertEquals(resource.getTags().get(i), tags.get(i).getText());
+		}
+	}
+
+	public static void getGeneralInfo(ResourceReqDetails resource, User user) {
+
+		// clickMore();
+		// String
+		// componentType=waitFunctionForaGetElements("componentType",3).getText();
+		// String version=waitFunctionForaGetElements("version",3).getText();
+		// String
+		// category=waitFunctionForaGetElements("category",3).getText();//get
+		// right panel Category.
+		// String
+		// resourceType=waitFunctionForaGetElements("resourceType",3).getText();//get
+		// right panel SubCategory.
+		// String date=waitfunctionforelements("creationDate",3).getText();
+		// String aouthor=waitfunctionforallelements("author'",3).getText();
+		// String
+		// vendorName=waitFunctionForaGetElements("vendorName",3).getText();
+		// String
+		// vendorRelease=waitFunctionForaGetElements("vendorRelease",3).getText();
+		// String
+		// AttContact=waitFunctionForaGetElements("attContact",3).getText();
+		// String
+		// Description=waitFunctionForaGetElements("description",3).getText();
+		List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag");
+		// // String TagVF=waitFunctionForaGetElements("tag",3).getText();
+		// assertTrue(componentType.equals("RESOURCE"));
+		// assertTrue(version.equals(resource.getVersion()));
+		// assertTrue(category.equals(resource.getCategories().get(0).getName()));
+		// assertEquals(resourceType,resource.getResourceType());
+		// // assertEquals(Date,resource.getCreationDate());
+		// // assertEquals(Aouthor,resource.getCreatorFullName());
+		// assertTrue(vendorName.equals(resource.getVendorName()));
+		// assertTrue(vendorRelease.equals(resource.getVendorRelease()));
+		// assertTrue(AttContact.equals(resource.getAttContact()));
+		// assertTrue(Description.equals(resource.getDescription()+"\nLess"));
+		for (WebElement tag : tags) {
+			System.out.println(resource.getTags().get(0));
+		}
+	}
+
+	public static void getGeneralInfoForTags(ResourceReqDetails resource, User user) {
+
+		clickMore();
+		String componentType = waitFunctionForaGetElements("componentType", 3).getText();
+		String version = waitFunctionForaGetElements("version", 3).getText();
+		String category = waitFunctionForaGetElements("category", 3).getText();// get
+																				// right
+																				// panel
+																				// Category.
+		String resourceType = waitFunctionForaGetElements("resourceType", 3).getText();// get
+																						// right
+																						// panel
+																						// SubCategory.
+		String date = GeneralUIUtils.getWebElementByClassName("creationDate").getText();
+		String aouthor = waitfunctionforallelements("author'").getText();
+		String vendorName = waitFunctionForaGetElements("vendorName", 3).getText();
+		String vendorRelease = waitFunctionForaGetElements("vendorRelease", 3).getText();
+		String attContact = waitFunctionForaGetElements("attContact", 3).getText();
+		String description = waitFunctionForaGetElements("description", 3).getText();
+		List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("tag");
+		assertTrue(componentType.equals("RESOURCE"));
+		assertTrue(version.equals(resource.getVersion()));
+		assertTrue(category.equals(resource.getCategories().get(0).getName()));
+		assertEquals(resourceType, resource.getResourceType());
+		// assertEquals(Date,resource.getCreationDate());
+		// assertEquals(Aouthor,resource.getCreatorFullName());
+		assertTrue(vendorName.equals(resource.getVendorName()));
+		assertTrue(vendorRelease.equals(resource.getVendorRelease()));
+		assertTrue(attContact.equals(resource.getContactId()));
+		assertTrue(description.equals(resource.getDescription() + "\nLess"));
+		assertTrue(tags.equals("Tag-150"));
+	}
+
+	public static WebElement searchVFNameInWorkspace(ResourceReqDetails resource, User user) throws Exception {
+
+		List<WebElement> findElements = GeneralUIUtils.getDriver()
+				.findElements(By.xpath("//div[@data-tests-id='" + resource.getUniqueId() + "']"));
+		assertNotNull("did not find any elements", findElements);
+		for (WebElement webElement : findElements) {
+			if (webElement.getText().contains(resource.getUniqueId())) {
+				System.out.println("I find it");
+				return webElement;
+			}
+		}
+		return null;
+	}
+
+	public static Boolean searchCheckOutWorkspace(ResourceReqDetails resource, User user,
+			CheckBoxStatusEnum checkBoxStatusEnum) throws Exception {
+
+		List<WebElement> findElements = GeneralUIUtils.getDriver()
+				.findElements(By.xpath("//div[@data-tests-id='component.lifecycleState']"));
+		assertNotNull("did not find any elements", findElements);
+		for (WebElement webElement : findElements) {
+			if (!webElement.getAttribute("class").contains(checkBoxStatusEnum.name())) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	// coded by tedy.
+	public static void validateWithRightPalett(ResourceReqDetails resource, User user) {
+		// String
+		// Type=Waitfunctionforallelements("sharingService.selectedEntity.getTypeForView()",3).getText();
+		String ResourceType = waitfunctionforallelements("selectedComponent.resourceType").getText();
+		System.out.println(ResourceType);
+		String Version = waitfunctionforallelements("selectedComponent.version").getText();
+		String Category = waitfunctionforallelements("selectedComponent.categories[0].name").getText();// get
+																										// right
+																										// panel
+																										// Category.
+		String CanvasSubCategory = waitfunctionforallelements("selectedComponent.categories[0].subcategories[0].name")
+				.getText();// get right panel SubCategory.
+		// String Date=Waitfunctionforelements("selectedComponent.creationDate |
+		// date: 'MM/dd/yyyy'").getText();
+		// String
+		// Aouthor=waitfunctionforallelements("selectedComponent.creatorFullName'").getText();
+		String VendorName = waitfunctionforallelements("selectedComponent.vendorName").getText();
+		String VendorRelease = waitfunctionforallelements("selectedComponent.vendorRelease").getText();
+		String AttContact = waitfunctionforallelements("selectedComponent.attContact").getText();
+		String Description = waitfunctionforallelements("selectedComponent.description").getText();
+		String TagVF = waitfunctionforallelements("tag").getText();
+		AssertJUnit.assertEquals(ResourceType, resource.getResourceType());
+		AssertJUnit.assertEquals(Version, resource.getVersion());
+		AssertJUnit.assertEquals(Category, resource.getCategories().get(0).getName());
+		AssertJUnit.assertEquals(CanvasSubCategory,
+				resource.getCategories().get(0).getSubcategories().get(0).getName());
+		// assertEquals(Date,resource.getCreationDate());
+		// assertEquals(Aouthor,resource.getCreatorFullName());
+		AssertJUnit.assertEquals(VendorName, resource.getVendorName());
+		AssertJUnit.assertEquals(VendorRelease, resource.getVendorRelease());
+		AssertJUnit.assertEquals(AttContact, resource.getContactId());
+		AssertJUnit.assertEquals(Description, resource.getDescription() + "\nLess");
+		AssertJUnit.assertEquals(TagVF, "qa123");
+	}
+
+	public static void clickMore() {
+		WebElement clickButtonSubmit = GeneralUIUtils.getDriver()
+				.findElement(By.className("ellipsis-directive-more-less"));
+		clickButtonSubmit.click();
+	}
+	
+	public static RestResponse createResourceInUI(ResourceReqDetails resource, User user)
+			throws Exception, AWTException {
+		System.out.println("creating resource...");
+		fillNewResourceValues(resource, user);
+		RestResponse getCreatedResource = RestCDUtils.getResource(resource, user);
+		AssertJUnit.assertEquals("Did not succeed to get any resource", HttpStatus.SC_OK,
+				getCreatedResource.getErrorCode().intValue());
+
+		return getCreatedResource;
+	}
+
+	public static  void createResource(ResourceReqDetails resource, User user) throws Exception {
+		ExtentTestActions.log(Status.INFO, "Going to create a new VF.");
+		WebElement addVFButton = null;
+        try {
+			GeneralUIUtils.ultimateWait();
+			try{
+				GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
+				addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+			}
+			catch (Exception e){
+				File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resource.getName());
+				final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+				SetupCDTest.getExtendTest().log(Status.WARNING, "Add VF button is not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+				showButtonsADD();
+				addVFButton = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+			}
+			addVFButton.click();
+				GeneralUIUtils.ultimateWait();
+	        } 
+        catch (Exception e ) {
+        	SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on ADD VF button, retrying ... "));
+        	GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");
+			GeneralUIUtils.ultimateWait();
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue()).click();
+			GeneralUIUtils.ultimateWait();
+        }
+		fillResourceGeneralInformationPage(resource, user, true);
+		resource.setVersion("0.1");
+		GeneralPageElements.clickCreateButton();
+	}
+	
+	public static void updateResource(ResourceReqDetails resource, User user){
+		ResourceGeneralPage.defineContactId(resource.getContactId());
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Updating General screen fields ..."));
+		fillResourceGeneralInformationPage(resource, user, false);
+		ResourceGeneralPage.clickUpdateButton();
+	}
+	
+	
+
+	public static RestResponse updateResourceInformationPage(ResourceReqDetails resource, User user)
+			throws Exception, AWTException {
+
+		fillResourceGeneralInformationPage(resource, user, true);
+		GeneralPageElements.clickCreateButton();
+		return null;
+
+	}
+
+	public static RestResponse checkInResourceInUI(ResourceReqDetails resource, User user) throws Exception {
+
+		WebElement ASDCLink = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-header-logo-link"));
+		ASDCLink.click();
+		Thread.sleep(2000);
+
+		List<WebElement> listFormInput = GeneralUIUtils.getDriver()
+				.findElements(By.className("i-sdc-left-sidebar-nav-item"));
+		WebElement addPropertyElement = listFormInput.get(0);
+		addPropertyElement.click();
+		Thread.sleep(2000);
+
+		WebElement searchResource = GeneralUIUtils.getDriver()
+				.findElement(By.className("w-sdc-header-catalog-search-input"));
+		searchResource.sendKeys("newresource4test");
+
+		Thread.sleep(1000);
+
+		WebElement buttonClickMenu = GeneralUIUtils.getDriver()
+				.findElement(By.className("w-sdc-dashboard-card-menu-button"));
+		buttonClickMenu.click();
+
+		WebElement clickMenu = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
+		clickMenu.click();
+
+		List<WebElement> clickCheckIn = GeneralUIUtils.getDriver()
+				.findElements(By.className("i-sdc-dashboard-card-menu-item"));
+		WebElement clickCheckInMenu = clickCheckIn.get(1);
+		clickCheckInMenu.click();
+
+		WebElement descriptionForSubmit = GeneralUIUtils.getDriver()
+				.findElement(By.className("w-sdc-modal-body-comment"));
+		descriptionForSubmit.sendKeys("checkin resource");
+		Thread.sleep(2000);
+		WebElement clickButtonSubmitTwo = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-btn-blue"));
+		clickButtonSubmitTwo.click();
+		Thread.sleep(2000);
+
+		WebElement buttonClickMenu1 = GeneralUIUtils.getDriver()
+				.findElement(By.className("w-sdc-dashboard-card-menu-button"));
+		buttonClickMenu1.click();
+
+		WebElement clickMenu1 = GeneralUIUtils.getDriver().findElement(By.className("w-sdc-dashboard-card-menu"));
+		clickMenu1.click();
+
+		List<WebElement> clickCheckOut = GeneralUIUtils.getDriver()
+				.findElements(By.className("i-sdc-dashboard-card-menu-item"));
+		WebElement clickCheckOutMenu = clickCheckOut.get(0);
+		clickCheckOutMenu.click();
+
+		Thread.sleep(3000);
+		RestResponse getResource = RestCDUtils.getResource(resource, user);
+		AssertJUnit.assertEquals("Did not succeed to get resource after create", 200,
+				getResource.getErrorCode().intValue());
+		return getResource;
+
+	}
+
+	public static String lifeCycleStateUI() throws InterruptedException {
+		return GeneralUIUtils.getWebElementByTestID("formlifecyclestate").getText();
+	}
+
+	public static List<String> catalogFilterResourceCategoriesChecBox(ResourceCategoriesNameEnum enumName)
+			throws Exception {
+		List<String> categories = Arrays.asList();
+		switch (enumName) {
+		case APPLICATIONL4:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("applicationServer", "defaulticon", "vl", "cp", "call_controll", "borderElement",
+					"network", "firewall", "database", "loadBalancer");
+			break;
+		case APPLICATION_SERVER:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
+			break;
+		case BORDER_ELEMENT:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("borderElement", "vl", "cp", "defaulticon");
+			break;
+		case CALL_CONTROL:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("call_controll", "vl", "cp", "defaulticon");
+			break;
+		case COMMON_NETWORK_RESOURCES:
+			GeneralUIUtils.getWebElementByLinkText("Common Network Resources").click();
+			categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+			break;
+		case CONNECTION_POINTS:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("cp", "defaulticon");
+			break;
+		case DATABASE:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("database", "vl", "cp", "defaulticon");
+			break;
+		case DATABASE_GENERIC:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("database", "vl", "cp", "defaulticon");
+			break;
+		case FIREWALL:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("firewall", "vl", "cp", "defaulticon");
+			break;
+		case GATEWAY:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("gateway", "vl", "cp", "defaulticon");
+			break;
+		case INFRASTRUCTURE:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("connector", "vl", "cp", "defaulticon");
+			break;
+		case INFRASTRUCTUREL23:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("ucpe", "vl", "cp", "defaulticon");
+			break;
+		case LAN_CONNECTORS:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
+			break;
+		case LOAD_BALANCER:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("loadBalancer", "vl", "cp", "defaulticon");
+			break;
+		case MEDIA_SERVERS:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+			break;
+		case NETWORKL4:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+			break;
+		case NETWORK_ELEMENTS:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("port", "defaulticon", "network", "connector", "vl", "cp");
+			break;
+		case NETWORK_L23:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("network", "vl", "defaulticon", "cp", "router", "port", "connector", "gateway",
+					"ucpe");
+			break;
+		case NETWORK_CONNECTIVITY:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("network", "vl", "cp", "defaulticon");
+			break;
+		case GENERIC:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("database", "port", "loadBalancer", "vl", "cp", "objectStorage", "compute",
+					"defaulticon", "ucpe", "network", "connector");
+			break;
+		case ABSTRACT:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("objectStorage", "compute", "defaulticon", "cp", "vl");
+			break;
+		case Router:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("router", "vl", "cp", "defaulticon");
+			break;
+		case VIRTUAL_LINKS:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("vl", "defaulticon");
+			break;
+		case WAN_Connectors:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("network", "port", "connector", "vl", "cp", "defaulticon");
+			break;
+		case WEB_SERVER:
+			GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+			categories = Arrays.asList("applicationServer", "vl", "cp", "defaulticon");
+			break;
+		}
+		return categories;
+	}
+
+	public static void deleteVersionInUI() throws Exception {
+
+		waitToDeleteVersion().click();
+		ResourceUIUtils.clickButtonBlue();
+	}
+
+	public static void selectTabInRightPallete(String className) throws Exception {
+		WebElement tab = GeneralUIUtils.getWebElementByClassName(className);
+		tab.click();
+	}
+
+	public static WebElement waitToDeleteVersion() {
+		return Waitfunctionforbuttons("//*[@data-tests-id='deleteVersion']", 10);
+	}
+
+	public static WebElement rihtPanelAPI() {
+		return waitFunctionForaGetElements("tab-api", 10);
+	}
+
+	/**
+	 * Click on HTML element.
+	 * 
+	 * @param dataTestId
+	 * @throws Exception
+	 */
+	public static void getWebElementByTestID(String dataTestId) throws Exception {
+		WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(), 20);
+		WebElement element = wait
+				.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@data-tests-id='" + dataTestId + "']")));
+		element.click();
+		// wait.until(ExpectedConditions.elemetto)
+		// WebElement serviceButton =
+		// GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
+		// + dataTestId + "']"));
+		// serviceButton.
+		// serviceButton.click();
+	}
+
+	/**
+	 * Move to HTML element by class name. When moving to the HTML element, it
+	 * will raise hover event.
+	 * 
+	 * @param className
+	 */
+//	public static void moveToHTMLElementByClassName(String className) {
+//		Actions actions = new Actions(GeneralUIUtils.getDriver());
+//		final WebElement createButtonsArea = GeneralUIUtils
+//				.retryMethodOnException(() -> GeneralUIUtils.getDriver().findElement(By.className(className)));
+//		actions.moveToElement(createButtonsArea).perform();
+//	}
+
+	/**
+	 * Move to HTML element by element id. When moving to the HTML element, it
+	 * will raise hover event.
+	 * 
+	 * @param className
+	 */
+//	static void moveToHTMLElementByDataTestId(String dataTestId) {
+//		// WebElement hoverArea =
+//		// GeneralUIUtils.getDriver().findElement(By.xpath("//*[@data-tests-id='"
+//		// + dataTestId + "']"));
+//		WebElement hoverArea = GeneralUIUtils.waitForElementVisibility(dataTestId);
+//		// WebDriverWait wait = new WebDriverWait(GeneralUIUtils.getDriver(),
+//		// 30);
+//		// wait.until(ExpectedConditions.visibilityOf(hoverArea));
+//
+//		Actions actions = new Actions(GeneralUIUtils.getDriver());
+//		actions.moveToElement(hoverArea).perform();
+//	}
+
+	// public static ResourceReqDetails createResourceInUI(User user){
+	// try{
+	// ResourceReqDetails defineResourceDetails =
+	// defineResourceDetails(ResourceTypeEnum.VF);
+	// ResourceUIUtils.moveToHTMLElementByClassName("w-sdc-dashboard-card-new");
+	// ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+	// GeneralUIUtils.waitForLoader();
+	//// GeneralUIUtils.sleep(1000);
+	// fillResourceGeneralInformationPage(defineResourceDetails, user);
+	// GeneralPageElements.clickCreateButton();
+	// return defineResourceDetails;
+	// }
+	// catch( Exception e){
+	// throw new RuntimeException(e);
+	// }
+	// }
+
+	/**
+	 * Import VFC
+	 * 
+	 * @param user
+	 * @param filePath
+	 * @param fileName
+	 * @return
+	 * @throws Exception
+	 */
+
+	public static void importVfc(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+			throws Exception {
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VFC resource ", resourceMetaData.getName()));
+		GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+		GeneralUIUtils.ultimateWait();
+		// Insert file to the browse dialog		
+		WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC");
+		WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+		if (!buttonVFC.isDisplayed()){
+			File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+			final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+			SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));			
+		}
+		try{
+			fileInputElement.sendKeys(filePath + fileName);
+		} catch (ElementNotVisibleException e) {
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible"));
+			showButtons();
+			fileInputElement.sendKeys(filePath + fileName);
+		} 
+		// Fill the general page fields.
+		GeneralUIUtils.ultimateWait();
+		fillResourceGeneralInformationPage(resourceMetaData, user, true);
+		GeneralPageElements.clickCreateButton();
+	}
+	
+	public static void importVfcNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+			throws Exception {
+		GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+		// Insert file to the browse dialog
+		WebElement buttonVFC = GeneralUIUtils.findByText("Import VFC");
+		WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+		if (!buttonVFC.isDisplayed()){
+			File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+			final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+			SetupCDTest.getExtendTest().log(Status.WARNING, "VFC button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));			
+		}
+		try{
+			fileInputElement.sendKeys(filePath + fileName);
+		} catch (ElementNotVisibleException e) {
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting VFC file input to visible"));
+			showButtons();
+			fileInputElement.sendKeys(filePath + fileName);
+		}
+		// Fill the general page fields.
+		GeneralUIUtils.waitForLoader();
+		fillResourceGeneralInformationPage(resourceMetaData, user, true);
+	}
+	
+	
+	public static void importVfFromCsar(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+			throws Exception {
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s", resourceMetaData.getName()));  
+		GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+		GeneralUIUtils.ultimateWait();
+		// Insert file to the browse dialog	
+		WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset");
+		WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+		if (!buttonDCAE.isDisplayed()){
+			File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+			final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+			SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));			
+		}
+		try{
+			fileInputElement.sendKeys(filePath + fileName);
+		} catch (ElementNotVisibleException e) {
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible"));
+			showButtons();
+			fileInputElement.sendKeys(filePath + fileName);
+		}    
+		// Fill the general page fields.
+		GeneralUIUtils.ultimateWait();
+		fillResourceGeneralInformationPage(resourceMetaData, user, true);
+		GeneralPageElements.clickCreateButton(10*60);
+//		GeneralUIUtils.ultimateWait(); "don't change import of csar can take longer then 3 minutes"
+		GeneralUIUtils.waitForLoader(10*60);
+	}
+	
+	public static void importVfFromCsarNoCreate(ResourceReqDetails resourceMetaData, String filePath, String fileName, User user)
+			throws Exception {
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Creating new VF asset resource %s, Create button will not be clicked", resourceMetaData.getName()));  
+		GeneralUIUtils.hoverOnAreaByTestId(Dashboard.IMPORT_AREA.getValue());
+		GeneralUIUtils.ultimateWait();
+		// Insert file to the browse dialog
+		WebElement buttonDCAE = GeneralUIUtils.findByText("Import DCAE asset");
+		WebElement fileInputElement = GeneralUIUtils.getInputElement(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+		if (!buttonDCAE.isDisplayed()){
+			File imageFilePath = GeneralUIUtils.takeScreenshot(null, SetupCDTest.getScreenshotFolder(), "Warning_" + resourceMetaData.getName());
+			final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+			SetupCDTest.getExtendTest().log(Status.WARNING, "DCAE button not visible after hover on import area of Home page, moving on ..." + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath));
+		}
+		try{
+			fileInputElement.sendKeys(filePath + fileName);
+		} catch (ElementNotVisibleException e) {
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exeption catched on file input, converting DCAE file input to visible"));
+			showButtons();
+			fileInputElement.sendKeys(filePath + fileName);
+		}
+		// Fill the general page fields.
+		GeneralUIUtils.ultimateWait();
+		fillResourceGeneralInformationPage(resourceMetaData, user, true);
+		GeneralUIUtils.waitForLoader(10*60);
+	}
+	
+	public static void updateVfWithCsar(String filePath, String fileName) {
+		ExtentTestActions.log(Status.INFO, "Updating VF with updated CSAR file named " + fileName);
+		WebElement browseWebElement = GeneralUIUtils.getInputElement(DataTestIdEnum.GeneralElementsEnum.UPLOAD_FILE_INPUT.getValue());
+		browseWebElement.sendKeys(filePath + fileName);
+		GeneralUIUtils.ultimateWait();
+		GeneralPageElements.clickUpdateButton();
+		GeneralUIUtils.waitForLoader();
+		ExtentTestActions.log(Status.INFO, "VF is updated.");
+	}
+	
+	
+
+	// public static ResourceReqDetails importVfcInUI(User user, String
+	// filePath, String fileName, ResourceTypeEnum resourceType) {
+	// ResourceReqDetails defineResourceDetails =
+	// defineResourceDetails(resourceType);
+	// ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
+	//
+	// // Insert file to the browse dialog
+	// final WebElement browseWebElement =
+	// GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VFC_FILE.getValue());
+	// browseWebElement.sendKeys(filePath + fileName);
+	//
+	// // Fill the general page fields.
+	// GeneralUIUtils.waitForLoader();
+	// fillResourceGeneralInformationPage(defineResourceDetails, user);
+	// GeneralPageElements.clickCreateButton();
+	// return defineResourceDetails;
+	// }
+
+	/**
+	 * Import VF
+	 * 
+	 * @param user
+	 * @param filePath
+	 * @param fileName
+	 * @return
+	 * @throws Exception
+	 */
+	// public static ResourceReqDetails importVfInUI(User user, String filePath,
+	// String fileName) throws Exception {
+	// ResourceReqDetails defineResourceDetails =
+	// defineResourceDetails(ResourceTypeEnum.VF);
+	// ResourceUIUtils.moveToHTMLElementByDataTestId(Dashboard.IMPORT_AREA.getValue());
+	//
+	// // Insert file to the browse dialog
+	// final WebElement browseWebElement =
+	// GeneralUIUtils.getWebElementByDataTestId(DataTestIdEnum.Dashboard.IMPORT_VF_FILE.getValue());
+	// browseWebElement.sendKeys(filePath + fileName);
+	//
+	// // Fill the general page fields.
+	// GeneralUIUtils.waitForLoader();
+	// fillResourceGeneralInformationPage(defineResourceDetails, user);
+	// GeneralPageElements.clickCreateButton();
+	// return defineResourceDetails;
+	// }
+
+	// public static ResourceReqDetails defineResourceDetails(ResourceTypeEnum
+	// resourceType) {
+	// ResourceReqDetails resource = new ResourceReqDetails();
+	// resource = ElementFactory.getDefaultResource(NormativeTypesEnum.ROOT,
+	// ResourceCategoryEnum.APPLICATION_L4_CALL_CONTROL);
+	// resource.setVersion(INITIAL_VERSION);
+	// resource.setIcon(ICON_RESOURCE_NAME);
+	// resource.setResourceType(resourceType.toString());
+	// resource.setName(getRandomComponentName(RESOURCE_NAME_PREFIX));
+	//
+	// SetupCDTest.setCreatedComponents(Arrays.asList(resource));
+	//
+	// return resource;
+	// }
+
+	protected static String getRandomComponentName(String prefix) {
+		return prefix + new Random().nextInt(10000);
+	}
+
+	public static ImmutablePair<String, String> getFirstRIPos(ResourceReqDetails createResourceInUI, User user) {
+		String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		String xPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
+				.get("posX");
+		String yPosPostDrag = (String) ((JSONObject) ((JSONArray) jsonResource.get("componentInstances")).get(0))
+				.get("posY");
+		return new ImmutablePair<String, String>(xPosPostDrag, yPosPostDrag);
+
+	}
+
+	public static WebElement getErrorMessageText(WebDriver driver, String text) throws Exception {
+
+		return GeneralUIUtils.getWebElementByClassName(text);
+
+	}
+
+	public static void fillGeneralInfoValuesAndIcon(ResourceReqDetails resource, User user) throws Exception {
+		fillResourceGeneralInformationPage(resource, user, true);
+		
+		GeneralPageElements.clickCreateButton();
+
+		selectRandomResourceIcon();
+	}
+
+	// coded by teddy.
+	public static void getVFCGeneralInfoAndValidate(ResourceReqDetails resource, User user)
+			throws InterruptedException {
+		Thread.sleep(2000);
+		WebDriver driver = GeneralUIUtils.getDriver();
+		String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText();
+		String name = GeneralUIUtils.getWebElementByTestID( "name").getAttribute("value");
+		String description = GeneralUIUtils.getWebElementByTestID( "description").getAttribute("value");
+		String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+				.getText();
+		String vendorName = GeneralUIUtils.getWebElementByTestID( "vendorName").getAttribute("value");
+		String vendorRelease = GeneralUIUtils.getWebElementByTestID( "vendorRelease").getAttribute("value");
+		List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
+		String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
+		int index = type.lastIndexOf(":");
+		System.out.println(type.substring(0, index));
+		String AttContact = GeneralUIUtils.getWebElementByTestID( "attContact").getAttribute("value");
+		System.out.println(resource.getVersion());
+		assertTrue(resource.getVersion().equals(version.substring(1)));
+		assertTrue(resource.getName().equals(name));
+		assertTrue(resource.getDescription().equals(description));
+		System.out.println(resource.getVendorName());
+		System.out.println(resource.getVendorRelease());
+		assertTrue(resource.getCategories().get(0).getSubcategories().get(0).getName().equals(category));
+		assertTrue(resource.getVendorName().equals(vendorName));
+		assertTrue(resource.getVendorRelease().equals(vendorRelease));
+		assertTrue(resource.getCreatorUserId().equals(AttContact));
+		assertEquals(type.substring(0, index), resource.getResourceType());
+
+		for (int i = 0; i < tags.size(); i++) {
+			assertEquals(resource.getTags().get(i), tags.get(i).getText());
+		}
+	}
+
+	public static RestResponse createResourceNG(ResourceReqDetails resource, User user) throws Exception, AWTException {
+
+		GeneralUIUtils.hoverOnAreaByTestId("w-sdc-dashboard-card-new");
+		ResourceUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_VF.getValue());
+		fillResourceGeneralInformationPage(resource, user, true);
+		GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.LifeCyleChangeButtons.CREATE.getValue());
+		return null;
+
+	}
+	
+	public static void showButtons(){
+		String parentElementClassAttribute = "sdc-dashboard-import-element-container";
+		WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
+		GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
+		GeneralUIUtils.ultimateWait();
+		SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible..."));
+	}
+	
+	public static void showButtonsADD(){
+		try {
+			GeneralUIUtils.ultimateWait();
+			String parentElementClassAttribute = "sdc-dashboard-create-element-container";
+			WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
+			GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
+			GeneralUIUtils.ultimateWait();
+		} catch (Exception e ){
+			GeneralUIUtils.ultimateWait();
+			String parentElementClassAttribute = "sdc-dashboard-create-element-container";
+			WebElement fileInputElementWithVisible = GeneralUIUtils.getDriver().findElement(By.className(parentElementClassAttribute));
+			GeneralUIUtils.unhideElement(fileInputElementWithVisible, parentElementClassAttribute);
+			GeneralUIUtils.ultimateWait();
+		}
+		SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Input buttons now visible..."));
+	}
+	
+	public static void clickOnElementByText(String textToClick, String customizationFoLog){
+		String customizationFoLogLocal = customizationFoLog != null ? customizationFoLog : "";
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking on %s %s", textToClick, customizationFoLogLocal));
+		GeneralUIUtils.clickOnElementByText(textToClick);
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
new file mode 100644
index 0000000..b2bad99
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/RestCDUtils.java
@@ -0,0 +1,344 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
+import org.openecomp.sdc.ci.tests.config.Config;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ProductReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.DriverFactory;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
+import org.openecomp.sdc.ci.tests.utils.rest.CatalogRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.CategoryRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ProductRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResourceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openecomp.sdc.ci.tests.utils.rest.ServiceRestUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.UserRestUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class RestCDUtils {
+
+	private static void setResourceUniqueIdAndUUID(ComponentReqDetails element, RestResponse getResourceResponse) {
+		element.setUniqueId(ResponseParser.getUniqueIdFromResponse(getResourceResponse));
+		element.setUUID(ResponseParser.getUuidFromResponse(getResourceResponse));
+	}
+
+	public static RestResponse getResource(ResourceReqDetails resource, User user) {
+		final String getResourceMsg = "Trying to get resource named " + resource.getName() + " with version " + resource.getVersion();
+		final String succeedGetResourceMsg = "Succeeded to get resource named " + resource.getName() + " with version " + resource.getVersion();
+		final String failedGetResourceMsg = "Failed to get resource named " + resource.getName() + " with version " + resource.getVersion();
+		try {
+			ExtentTestActions.log(Status.INFO, getResourceMsg);
+			System.out.println(getResourceMsg);
+			GeneralUIUtils.sleep(1000);
+			RestResponse getResourceResponse = null;
+			String reourceUniqueId = resource.getUniqueId();
+			if (reourceUniqueId != null) {
+				getResourceResponse = ResourceRestUtils.getResource(reourceUniqueId);
+				if (getResourceResponse.getErrorCode().intValue() == 200) {
+					ExtentTestActions.log(Status.INFO, succeedGetResourceMsg);
+					System.out.println(succeedGetResourceMsg);
+				}
+				return getResourceResponse;
+			}
+			JSONObject getResourceJSONObject = null;
+			getResourceResponse = ResourceRestUtils.getResourceByNameAndVersion(user.getUserId(), resource.getName(), resource.getVersion());
+			if (getResourceResponse.getErrorCode().intValue() == 200) {
+//				JSONArray jArray = new JSONArray(getResourceResponse.getResponse());
+//				for (int i = 0; i < jArray.length(); i++) {
+//					getResourceJSONObject = jArray.getJSONObject(i);
+//					String resourceType = ResponseParser.getValueFromJsonResponse(getResourceJSONObject.toString(), "resourceType");
+//					if (resourceType.equals(resource.getResourceType())) {
+//						getResourceResponse.setResponse(getResourceJSONObject.toString());
+						setResourceUniqueIdAndUUID(resource, getResourceResponse);
+						ExtentTestActions.log(Status.INFO, succeedGetResourceMsg);
+						System.out.println(succeedGetResourceMsg);
+						return getResourceResponse;
+//					}
+//				}
+			}
+			ExtentTestActions.log(Status.INFO, failedGetResourceMsg);
+			return getResourceResponse;
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+	public static RestResponse getService(ServiceReqDetails service, User user) {
+		try {
+			Thread.sleep(3500);
+			RestResponse getServiceResponse = ServiceRestUtils.getServiceByNameAndVersion(user, service.getName(),
+					service.getVersion());
+			if (getServiceResponse.getErrorCode().intValue() == 200) {
+				setResourceUniqueIdAndUUID(service, getServiceResponse);
+			}
+			return getServiceResponse;
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+
+	}
+
+	public static RestResponse getProduct(ProductReqDetails product, User user) {
+		try {
+			Thread.sleep(3500);
+			RestResponse getProductResponse = ProductRestUtils.getProductByNameAndVersion(product.getName(),
+					product.getVersion(), user.getUserId());
+			if (getProductResponse.getErrorCode().intValue() == 200) {
+				setResourceUniqueIdAndUUID(product, getProductResponse);
+			}
+			return getProductResponse;
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+	public static Map<String, String> getAllElementVersionsFromResponse(RestResponse getResource) throws Exception {
+		Map<String, String> versionsMap = new HashMap<String, String>();
+		try {
+			ObjectMapper mapper = new ObjectMapper();
+
+			JSONObject object = new JSONObject(getResource.getResponse());
+			versionsMap = mapper.readValue(object.get("allVersions").toString(), Map.class);
+
+		} catch (Exception e) {
+			e.printStackTrace();
+			return versionsMap;
+
+		}
+
+		return versionsMap;
+	}
+
+	public static void deleteElementVersions(Map<String, String> elementVersions, boolean isBeforeTest, Object clazz,
+			User user) throws Exception {
+		Iterator<String> iterator = elementVersions.keySet().iterator();
+		while (iterator.hasNext()) {
+			String singleVersion = iterator.next();
+			String uniqueId = elementVersions.get(singleVersion);
+			RestResponse deleteResponse = null;
+			if (clazz instanceof ServiceReqDetails) {
+				deleteResponse = ServiceRestUtils.deleteServiceById(uniqueId, user.getUserId());
+			} else if (clazz instanceof ResourceReqDetails) {
+				deleteResponse = ResourceRestUtils.deleteResource(uniqueId, user.getUserId());
+			} else if (clazz instanceof ProductReqDetails) {
+				deleteResponse = ProductRestUtils.deleteProduct(uniqueId, user.getUserId());
+			}
+
+			if (isBeforeTest) {
+				assertTrue(deleteResponse.getErrorCode().intValue() == 204
+						|| deleteResponse.getErrorCode().intValue() == 404);
+			} else {
+				assertTrue(deleteResponse.getErrorCode().intValue() == 204);
+			}
+		}
+	}
+
+	public static void deleteAllResourceVersionsAfterTest(ComponentReqDetails componentDetails,
+			RestResponse getObjectResponse, User user) {
+		try {
+			deleteAllComponentVersion(false, componentDetails, getObjectResponse, user);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public static void deleteAllResourceVersionsBeforeTest(ComponentReqDetails componentDetails,
+			RestResponse getObjectResponse, User user) throws Exception {
+		deleteAllComponentVersion(true, componentDetails, getObjectResponse, user);
+	}
+
+	public static void deleteAllComponentVersion(boolean isBeforeTest, ComponentReqDetails componentDetails,
+			RestResponse getObjectResponse, User user) throws Exception {
+		if (getObjectResponse.getErrorCode().intValue() == 404)
+			return;
+		Map<String, String> componentVersionsMap = getAllElementVersionsFromResponse(getObjectResponse);
+		System.out.println("deleting...");
+		deleteElementVersions(componentVersionsMap, isBeforeTest, componentDetails, user);
+		componentDetails.setUniqueId(null);
+	}
+
+	
+	
+	public static  String getExecutionHostAddress() {
+		
+		String computerName = null;
+		try {
+			   computerName = InetAddress.getLocalHost().getHostAddress().replaceAll("\\.", "&middot;");
+			   System.out.println(computerName);
+			  if (computerName.indexOf(".") > -1)
+			    computerName = computerName.substring(0,
+			        computerName.indexOf(".")).toUpperCase();
+			} catch (UnknownHostException e) {
+				System.out.println("Uknown hostAddress");
+			}
+			return computerName != null ? computerName : "Uknown hostAddress";
+	}
+
+	public static Map<String, List<Component>> getCatalogAsMap() throws IOException {
+		User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+		RestResponse catalog = CatalogRestUtils.getCatalog(defaultAdminUser.getUserId());
+		Map<String, List<Component>> convertCatalogResponseToJavaObject = ResponseParser
+				.convertCatalogResponseToJavaObject(catalog.getResponse());
+		return convertCatalogResponseToJavaObject;
+	}
+
+	public static Map<String, List<CategoryDefinition>> getCategories() throws Exception {
+		
+		User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+		
+		Map<String,List<CategoryDefinition>> map = new HashMap<String,List<CategoryDefinition>>();
+				
+		
+		RestResponse allResourceCategories = CategoryRestUtils.getAllCategories(defaultAdminUser, ComponentTypeEnum.RESOURCE_PARAM_NAME);
+		RestResponse allServiceCategories = CategoryRestUtils.getAllCategories(defaultAdminUser, ComponentTypeEnum.SERVICE_PARAM_NAME);
+	
+		List<CategoryDefinition> parsedResourceCategories = ResponseParser.parseCategories(allResourceCategories);
+		List<CategoryDefinition> parsedServiceCategories = ResponseParser.parseCategories(allServiceCategories);
+		
+		map.put(ComponentTypeEnum.RESOURCE_PARAM_NAME, parsedResourceCategories);
+		map.put(ComponentTypeEnum.SERVICE_PARAM_NAME, parsedServiceCategories);
+		
+		return map;
+	}
+
+	public static void deleteCreatedComponents(Map<String, List<Component>> map) throws IOException {
+		
+		System.out.println("going to delete all created components...");
+		
+		User defaultAdminUser = ElementFactory.getDefaultUser(UserRoleEnum.ADMIN);
+		final String userId = defaultAdminUser.getUserId();
+		
+		List<Component> resourcesArrayList = map.get("products");
+		List<String>  collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("Ci")).map(e -> e.getUniqueId())
+				.collect(Collectors.toList());
+		for (String uId : collect) {
+			ProductRestUtils.deleteProduct(uId, userId);
+		}
+		
+		resourcesArrayList = map.get("services");
+		collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci")).map(e -> e.getUniqueId())
+				.collect(Collectors.toList());
+		for (String uId : collect) {
+			ServiceRestUtils.markServiceToDelete(uId, userId);
+		}
+		ServiceRestUtils.deleteMarkedServices(userId);		
+		
+		resourcesArrayList = map.get("resources");
+		collect = resourcesArrayList.stream().filter(s -> s.getName().startsWith("ci"))
+				.map(e -> e.getUniqueId()).collect(Collectors.toList());
+		for (String uId : collect) {			
+			ResourceRestUtils.markResourceToDelete(uId, userId);
+		}
+		ResourceRestUtils.deleteMarkedResources(userId);
+	
+	
+	
+
+	
+	}
+
+	public static void deleteCategoriesByList(List<CategoryDefinition> listCategories, String componentType, User user) throws Exception {
+		
+		for (CategoryDefinition categoryDefinition : listCategories) {
+			if (categoryDefinition.getName().toLowerCase().startsWith("ci")) {
+				List<SubCategoryDefinition> subcategories = categoryDefinition.getSubcategories();
+				if (subcategories != null) {
+					for (SubCategoryDefinition subCategoryDefinition : subcategories) {
+	
+						CategoryRestUtils.deleteSubCategory(subCategoryDefinition.getUniqueId(),
+								categoryDefinition.getUniqueId(), user.getUserId(),
+								componentType);
+					}
+				}
+	
+				CategoryRestUtils.deleteCategory(categoryDefinition.getUniqueId(), user.getUserId(),
+						componentType);
+	
+			}
+		}
+	}
+	
+	public static String getUserRole(User reqUser, User user){
+		try{
+			RestResponse getUserRoleResp = UserRestUtils.getUserRole(reqUser, user);
+			JSONObject jObject = new JSONObject(getUserRoleResp.getResponse());
+			return jObject.getString("role");
+		}
+		catch(Exception e){
+			return null;
+		}
+	}
+	
+	public static RestResponse getUser(User reqUser, User user){
+		try{
+			return UserRestUtils.getUser(reqUser, user);
+		}
+		catch(Exception e){
+			return null;
+		}
+	}
+
+	/*************************************/
+	
+	public static void deleteOnDemand() throws IOException {
+		Config config = DriverFactory.getConfig();
+		if(!config.getSystemUnderDebug()){
+			deleteCreatedComponents(getCatalogAsMap());
+		}else{
+			System.out.println("Accordindig to configuration components will not be deleted, in case to unable option to delete, please change systemUnderDebug parameter value to false ...");
+		}
+	}
+
+	public static void deleteCategories(User user) throws Exception {
+		Map<String, List<CategoryDefinition>> categoriesMap = getCategories();
+		List<CategoryDefinition> listCategories = categoriesMap.get(ComponentTypeEnum.RESOURCE_PARAM_NAME);
+		deleteCategoriesByList(listCategories, ComponentTypeEnum.RESOURCE_PARAM_NAME, user);
+		listCategories = categoriesMap.get(ComponentTypeEnum.SERVICE_PARAM_NAME);
+		deleteCategoriesByList(listCategories, ComponentTypeEnum.SERVICE_PARAM_NAME, user);
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java
new file mode 100644
index 0000000..8b07e62
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/utilities/ServiceUIUtils.java
@@ -0,0 +1,286 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.utilities;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.awt.AWTException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.junit.rules.TestName;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.StepsEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceCategoriesNameEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ServiceCategoriesEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.GeneralPageElements;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.Select;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.aventstack.extentreports.Status;
+
+public class ServiceUIUtils {
+
+	protected static WebDriver driver;
+
+	public ServiceUIUtils(TestName name, String className) {
+		super();
+	}
+
+	public static String defineServiceName(String Name) {
+		WebElement serviceName = GeneralUIUtils.getWebElementByTestID("name");
+		serviceName.clear();
+		serviceName.sendKeys(Name);
+		return Name;
+	}
+
+	public void moveResourceInstanceToCanvasUI() throws Exception {
+		List<WebElement> moveResource = driver.findElements(By.className("sprite-resource-icons"));
+		WebElement moveResourceToCanvasResourceOne = moveResource.get(0);
+		// WebElement moveResource =
+		// driver.findElement(By.className("sprite-resource-icons"));
+		Actions action = new Actions(driver);
+		action.moveToElement(moveResourceToCanvasResourceOne);
+		action.clickAndHold(moveResourceToCanvasResourceOne);
+		action.moveByOffset(635, 375);
+		action.release();
+		action.perform();
+		WebElement moveResourceToCanvasResourceTwo = moveResource.get(1);
+		action.moveToElement(moveResourceToCanvasResourceTwo);
+		action.clickAndHold(moveResourceToCanvasResourceTwo);
+		action.moveByOffset(535, 375);
+		action.release();
+		action.perform();
+		WebElement moveResourceToCanvasResourceTree = moveResource.get(2);
+		action.moveToElement(moveResourceToCanvasResourceTree);
+		action.clickAndHold(moveResourceToCanvasResourceTree);
+		action.moveByOffset(435, 375);
+		action.release();
+		action.perform();
+		Thread.sleep(2000);
+	}
+
+	public static String catalogFilterServiceCategoriesChecBox(ServiceCategoriesNameEnum enumName) throws Exception {
+		String Type = null;
+		GeneralUIUtils.getWebElementByTestID(enumName.getValue()).click();
+		return Type;
+	}
+
+	public static List<String> catalogServiceTypeChecBox(ServiceCategoriesNameEnum enumtype) throws Exception {
+		List<String> categories = null;
+		switch (enumtype) {
+		case NETWORK_L13:
+			GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+			categories = Arrays.asList("network_l_1-3");
+			break;
+		case NETWORKL4:
+			GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+			categories = Arrays.asList("network_l_4 ");
+			break;
+		case MOBILITY:
+			GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+			categories = Arrays.asList("mobility");
+			break;
+		case VOIPCALL_CONTROL:
+			GeneralUIUtils.getWebElementByTestID(enumtype.getValue()).click();
+			categories = Arrays.asList("call_controll ");
+			break;
+		}
+		return categories;
+	}
+
+	public static WebElement waitToNextButtonEnabled() {
+		return GeneralUIUtils.getWebElementByTestID("Next");
+	}
+
+	public static WebElement waitToFinishButtonEnabled() {
+		return GeneralUIUtils.getWebElementByTestID("Finish");
+	}
+
+	public static WebElement deleteServiceInUI() {
+
+		return GeneralUIUtils.getWebElementByTestID("deleteVersion");
+	}
+
+	// get the service view data for validate.
+	// created by tedy.
+	public static void getServiceGeneralInfo(ServiceReqDetails service, User user) throws InterruptedException {
+		Thread.sleep(2000);
+		String version = GeneralUIUtils.getSelectList(null, "versionHeader").getFirstSelectedOption().getText()
+				.substring(1);
+		String name = GeneralUIUtils.getWebElementByTestID("name").getAttribute("value");
+		String description = GeneralUIUtils.getWebElementByTestID("description").getAttribute("value");
+		String category = GeneralUIUtils.getSelectList(null, "selectGeneralCategory").getFirstSelectedOption()
+				.getText();
+		List<WebElement> tags = GeneralUIUtils.getWebElementsListByTestID("i-sdc-tag-text");
+		String type = GeneralUIUtils.getWebElementsListByTestID("type").get(1).getText();
+		int index = type.lastIndexOf(":");
+		System.out.println(type.substring(0, index));
+		String attContact = GeneralUIUtils.getWebElementByTestID("attContact").getAttribute("value");
+		String pmatt = GeneralUIUtils.getWebElementByTestID("pmatt").getAttribute("value");
+		System.out.println(service.getVersion());
+		assertTrue(service.getVersion().equals(version));
+		assertTrue(service.getName().equals(name));
+		assertTrue(service.getDescription().equals(description));
+		assertTrue(service.getCategories().get(0).getName().equals(category));
+		System.out.println(service.getContactId());
+		assertTrue(service.getContactId().equals(attContact));
+		assertTrue(service.getProjectCode().equals(pmatt));
+		for (int i = 0; i < tags.size(); i++) {
+			assertEquals(service.getTags().get(i), tags.get(i).getText());
+		}
+
+	}
+
+//	public static void defineTagsList(ServiceReqDetails service, String[] serviceTags) {
+//		List<String> taglist = new ArrayList<String>();		
+//		WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
+//		for (String tag : serviceTags) {
+//			serviceTagsTextbox.clear();
+//			serviceTagsTextbox.sendKeys(tag);
+//			GeneralUIUtils.sleep(1000);
+//			serviceTagsTextbox.sendKeys(Keys.ENTER);
+//			taglist.add(tag);
+//		}
+//		taglist.add(0, service.getName());
+//		service.setTags(taglist);
+//	}
+	
+	public static void defineTagsList2(List<String> serviceTags){
+		WebElement serviceTagsTextbox = GeneralUIUtils.getWebElementByTestID("i-sdc-tag-input");
+		for (String tag : serviceTags) {
+			serviceTagsTextbox.clear();
+			serviceTagsTextbox.sendKeys(tag);
+			GeneralUIUtils.waitForAngular();
+			serviceTagsTextbox.sendKeys(Keys.ENTER);
+		}
+	}
+
+	public static Select defineServiceCategory(String category) {
+
+		return GeneralUIUtils.getSelectList(category, "selectGeneralCategory");
+	}
+
+	public static void defineServicePmatt(String pmatt) {
+		WebElement attPmattTextbox = GeneralUIUtils.getWebElementByTestID("pmatt");
+		attPmattTextbox.clear();
+		attPmattTextbox.sendKeys(pmatt);
+	}
+
+	public static void selectRandomResourceIcon() throws Exception {
+		GeneralUIUtils.moveToStep(StepsEnum.ICON);
+		WebDriverWait wait = new WebDriverWait(driver, 6);
+		wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[contains(@data-tests-id, 'iconBox')]")));
+		List<WebElement> iconElement = driver.findElements(By.xpath("//*[contains(@data-tests-id, 'iconBox')]"));
+		iconElement.get(0).click();
+	}
+
+	public static String defineDescription(String description) {
+		WebElement descriptionTextbox = GeneralUIUtils.getWebElementByTestID("description");
+		descriptionTextbox.clear();
+		descriptionTextbox.sendKeys(description);
+		return description;
+	}
+
+	public static void defineContactId(String userId) {
+		WebElement attContact = GeneralUIUtils.getWebElementByTestID("attContact");
+		attContact.clear();
+		attContact.sendKeys(userId);
+	}
+
+	public static WebElement clickAddArtifact() {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking Add Artifact button"));
+		return GeneralUIUtils.getWebElementByTestID("addArtifactButton");
+	}
+
+	public static WebElement getArtifactName() {
+		return GeneralUIUtils.getWebElementByTestID("artifactName");
+	}
+
+	public static WebElement getArtifactDetails() {
+		return GeneralUIUtils.getWebElementByTestID("artifactDisplayName");
+	}
+
+	public static void fillServiceGeneralPage(ServiceReqDetails service, User user) throws Exception {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Fill in metadata values in general page"));
+		ServiceGeneralPage.defineName(service.getName());
+		ServiceGeneralPage.defineDescription(service.getDescription());
+		ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName());
+		ServiceGeneralPage.defineProjectCode(service.getProjectCode());
+		defineTagsList2(service.getTags());
+		ServiceGeneralPage.defineContactId(service.getContactId());
+		GeneralUIUtils.clickSomewhereOnPage();		
+	}
+    
+	public static void createService(ServiceReqDetails service, User user) throws Exception, AWTException {
+		clickAddService();
+		fillServiceGeneralPage(service, user);
+		GeneralPageElements.clickCreateButton();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("The service %s was created", service.getName()));
+	}
+	
+	public static void setServiceCategory(ServiceReqDetails service, ServiceCategoriesEnum category){
+		CategoryDefinition categoryDefinition = new CategoryDefinition();
+		categoryDefinition.setName(category.getValue());
+		List<CategoryDefinition> categories = new ArrayList<>();
+		categories.add(categoryDefinition);
+		service.setCategories(categories);
+	}
+	
+	public static void createServiceWithDefaultTagAndUserId(ServiceReqDetails service, User user) {
+		clickAddService();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Defining General Page fields"));
+		ServiceGeneralPage.defineName(service.getName());
+		ServiceGeneralPage.defineDescription(service.getDescription());
+		ServiceGeneralPage.defineCategory(service.getCategories().get(0).getName());
+		ServiceGeneralPage.defineProjectCode(service.getProjectCode());
+		GeneralUIUtils.ultimateWait();
+		GeneralPageElements.clickCreateButton();
+	}
+	
+	public static void clickAddService(){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Clicking the Add Service button"));
+		try {
+	    GeneralUIUtils.hoverOnAreaByTestId(DataTestIdEnum.Dashboard.ADD_AREA.getValue());
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+		GeneralUIUtils.ultimateWait();
+		} catch (Exception e){
+			SetupCDTest.getExtendTest().log(Status.WARNING, String.format("Exception on catched on Add Service button, retrying ..."));
+			GeneralUIUtils.hoverOnAreaByClassName("w-sdc-dashboard-card-new");			
+			GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.Dashboard.BUTTON_ADD_SERVICE.getValue()).click();
+			GeneralUIUtils.ultimateWait();
+		}
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
new file mode 100644
index 0000000..25f71ee
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CatalogVerificator.java
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.DistributionStatusEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.TypesEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.testng.Assert;
+import org.testng.TestNGException;
+
+import com.aventstack.extentreports.Status;
+
+public class CatalogVerificator {
+	
+	public static int getResourceNumber(ResourceTypeEnum resourceType, Map<String, List<Component>> catalogAsMap) throws Exception {
+		List<Component> resourcesArrayList = catalogAsMap.get("resources");
+		return resourcesArrayList.stream().
+				                  filter(s -> ((Resource)s).getResourceType().equals(resourceType)).
+				                  collect(Collectors.toList()).size();
+	}
+	
+	public static int getTypeNumber(TypesEnum enumtype) throws Exception{
+		Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+		switch (enumtype) {
+		case RESOURCE:
+			return getResourceNumber(catalogAsMap);
+		case SERVICE:
+			return getServiceNumber(catalogAsMap);
+		case PRODUCT:
+			return getProductsNumber(catalogAsMap);
+		default:
+			return getResourceNumber(ResourceTypeEnum.valueOf(enumtype.name()), catalogAsMap);
+		}		
+	}
+	
+	public static int getResourceNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
+		return catalogAsMap.get("resources").size();
+	}
+	
+	public static int getServiceNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
+		return catalogAsMap.get("services").size();
+	}
+	
+	public static int getProductsNumber(Map<String, List<Component>> catalogAsMap) throws Exception {
+		return catalogAsMap.get("products").size();
+	}
+	
+	public static void validateType(TypesEnum enumtype) throws Exception{		
+		int numberOfElementsFromBE = getTypeNumber(enumtype);
+		int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s elements, should be %s ...", enumtype.name(), numberOfElementsFromBE));
+		Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+	}
+	
+	public static int getStatusNumber(List<LifeCycleStateEnum> status) throws Exception {
+		Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+		return catalogAsMap.entrySet().stream().
+				            map(s -> s.getValue()).
+				            flatMap(List::stream).
+				            filter(s -> status.contains(mapBeLifecycleToUIStatus(s))).
+				            collect(Collectors.toList()).size();
+	}
+	
+	public static void validateStatus(List<LifeCycleStateEnum> status, String checkboxName) throws Exception{
+		int numberOfElementsFromBE = getStatusNumber(status);
+		int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s elements , should be %s ...", checkboxName, numberOfElementsFromBE));
+		Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+	}
+	
+	public static int getCategoryNumber(String categoryName) throws Exception {
+		Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+		List<Component> serviceAndResourceList = new ArrayList<Component>();
+		serviceAndResourceList.addAll(catalogAsMap.get("resources"));
+		serviceAndResourceList.addAll(catalogAsMap.get("services"));
+		return serviceAndResourceList.stream().
+				                      filter(s -> s.getCategories().get(0).getName().equals(categoryName)).
+				                      collect(Collectors.toList()).size();
+	}
+	
+	public static void validateCategory(String categoryName) throws Exception{
+		int numberOfElementsFromBE = getCategoryNumber(categoryName);
+		int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s category elements , should be %s ...", categoryName, numberOfElementsFromBE));
+		Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+	}
+	
+	public static int getSubCategoryNumber(String categoryName , String subCategoryName) throws Exception {
+		Map<String, List<Component>> catalogAsMap = RestCDUtils.getCatalogAsMap();
+		List<Component> resourcesArrayList = catalogAsMap.get("resources");
+		return resourcesArrayList.stream().
+				                  filter(s -> s.getCategories().get(0).getName().equals(categoryName) &&
+				                              s.getCategories().get(0).getSubcategories().get(0).getName().equals(subCategoryName)).
+				                  collect(Collectors.toList()).size(); 
+	}
+	
+	public static void validateSubCategory(String categoryName, String subCategoryName) throws Exception{
+		int numberOfElementsFromBE = getSubCategoryNumber(categoryName, subCategoryName);
+		int numberOfElementsFromUI = getNumberOfElementsFromCatalogHeader();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating number of %s/%s subcategory elements , should be %s ...", categoryName, subCategoryName, numberOfElementsFromBE));
+		Assert.assertEquals(numberOfElementsFromBE, numberOfElementsFromUI, String.format("Expected : %s, Actual: %s", numberOfElementsFromBE, numberOfElementsFromUI));
+	}
+	
+	public static int getNumberOfElementsFromCatalogHeader(){
+		String elementsAsString = GeneralUIUtils.getWebElementByClassName("w-sdc-dashboard-catalog-header").getText();
+		String numberOfElementsAsString = elementsAsString.split(" ")[0];
+		if (numberOfElementsAsString.equals("No")){
+			return 0;
+		} else {
+			return Integer.parseInt(numberOfElementsAsString);
+		}		
+	}
+	
+	private static LifeCycleStateEnum mapBeLifecycleToUIStatus(Component component){
+		boolean isServiceAndDistributed = component.getComponentType().equals(ComponentTypeEnum.SERVICE) && 
+				                          ((Service) component).getDistributionStatus().equals(DistributionStatusEnum.DISTRIBUTED);
+		switch (component.getLifecycleState()) {
+		case CERTIFIED:
+			if (isServiceAndDistributed){
+				return LifeCycleStateEnum.DISTRIBUTED;
+			} else {
+			    return LifeCycleStateEnum.CERTIFIED;
+			}
+		case READY_FOR_CERTIFICATION:
+			return LifeCycleStateEnum.READY_FOR_TESTING;
+		case CERTIFICATION_IN_PROGRESS:
+			return LifeCycleStateEnum.IN_TESTING;
+		case NOT_CERTIFIED_CHECKIN:
+			return LifeCycleStateEnum.CHECKIN;  //to IN DESIGN
+		case NOT_CERTIFIED_CHECKOUT:
+			return LifeCycleStateEnum.CHECKOUT;	//to IN DESIGN
+		default:
+	        throw new TestNGException("Missing enum value in enum converter");
+		}
+	}
+		
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java
new file mode 100644
index 0000000..9cb305d
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/CustomizationUUIDVerificator.java
@@ -0,0 +1,27 @@
+package org.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class CustomizationUUIDVerificator {
+
+	public static void validateCustomizationUUIDuniqueness(List customizationUUIDs) {
+		boolean hasNoDuplicates = CustomizationUUIDVerificator.containsUnique(customizationUUIDs);
+		assertTrue("There are duplicate customizationUUIDs in list",hasNoDuplicates==true);
+	}
+
+	public static <T> boolean containsUnique(List<T> list){
+	    Set<T> set = new HashSet<>();
+	
+	    for (T t: list){
+	        if (!set.add(t))
+	            return false;
+	    }
+	
+	    return true;
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
new file mode 100644
index 0000000..0d06d8e
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/DeploymentViewVerificator.java
@@ -0,0 +1,328 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+
+import org.apache.commons.io.FileUtils;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.execute.devCI.ArtifactFromCsar;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.SkipException;
+import org.testng.TestException;
+import org.testng.TestNGException;
+
+import com.aventstack.extentreports.Status;
+
+public class DeploymentViewVerificator {
+	
+	private static String[] currentProperties = {"isBase", 
+            "vf_module_label", 
+            "vf_module_description", 
+            "min_vf_module_instances", 
+            "max_vf_module_instances", 
+            "initial_count", 
+            "vf_module_type", 
+            "volume_group",
+            "vfc_list",
+            "availability_zone_count"};
+	
+	private static Map<String, HashMap<String, List<String>>> deploymentViewData = new HashMap<String, HashMap<String, List<String>>>(){
+		{
+			HashMap<String, List<String>> segw_heat_c3_base , segw_heat_c3_VMs1 ;
+			
+			segw_heat_c3_base = new HashMap<String, List<String>>();
+			segw_heat_c3_base.put("members", Arrays.asList("segw_internet_security_group", "segw_security_group", "int_layer2vlan_net"));
+			segw_heat_c3_base.put("artifacts", Arrays.asList("segw_heat_c3_base.yml", "segw_heat_c3_base.env"));
+			segw_heat_c3_base.put("properties", Arrays.asList(currentProperties));
+			put("segw_heat_c3_base", segw_heat_c3_base);
+			segw_heat_c3_VMs1 = new HashMap<String, List<String>>();
+			segw_heat_c3_VMs1.put("members", Arrays.asList("segw_oam_protected_0_port", 
+										                    "fw_oam_int_layer2vlan_1_port", 
+										                    "segw_0", "segw_internet_1_port", 
+										                    "segw_layer2vlan_2_port",
+										                    "fw_gn_0", "fw_gn_hsl_direct_3_port", 
+										                    "fw_oam_oam_mgmt_0_port", 
+										                    "fw_oam_hsl_direct_3_port", 
+										                    "fw_gn_oam_mgmt_0_port",
+										                    "fw_oam_oam_direct_2_port",
+										                    "fw_gn_gn_direct_2_port",
+										                    "fw_oam_0",
+										                    "fw_gn_int_layer2vlan_1_port"));
+			segw_heat_c3_VMs1.put("artifacts", Arrays.asList("segw_heat_c3_VMs1.yml", "segw_heat_c3_VMs1.env"));
+			segw_heat_c3_VMs1.put("properties", Arrays.asList(currentProperties));
+	        put("segw_heat_c3_VMs1", segw_heat_c3_VMs1);
+		}
+	};
+	
+	private static Map<String, HashMap<String, List<String>>> deploymentViewDataMixedArtefects = new HashMap<String, HashMap<String, List<String>>>(){
+		{
+			HashMap<String, List<String>> module_1_ldsa, module_2_ldsa, base_ldsa;
+			
+			module_1_ldsa = new HashMap<String, List<String>>();
+			module_1_ldsa.put("members", new ArrayList(Arrays.asList("ltm_oam_protected_0_port", "ltm_dmz_direct_0_port", "ltm_server_0")));
+			module_1_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_1_ldsa.yaml", "module_1_ldsa.env", "base_ldsa.33.yaml", "module_1_ldsa.11.yaml")));
+			module_1_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+			put("module_1_ldsa", module_1_ldsa);
+			module_2_ldsa = new HashMap<String, List<String>>();
+			module_2_ldsa.put("members", new ArrayList(Arrays.asList("ltm_server_0")));
+			module_2_ldsa.put("artifacts", new ArrayList(Arrays.asList("module_2_ldsa.yaml", "module_2_ldsa.env", "base_ldsa.3.yaml", "module_2_ldsa.22.yaml")));
+			module_2_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+	        put("module_2_ldsa", module_2_ldsa);
+	        base_ldsa = new HashMap<String, List<String>>();
+	        base_ldsa.put("members", new ArrayList(Arrays.asList("ldsa_sec_grp_1")));
+	        base_ldsa.put("artifacts", new ArrayList(Arrays.asList("base_ldsa.yaml", "module_2_ldsa.2.yaml", "module_1_ldsa.1.yaml")));
+	        base_ldsa.put("properties", new ArrayList(Arrays.asList(currentProperties)));
+	        put("base_ldsa", base_ldsa);
+		}
+	};
+	
+	private Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile;
+	
+	public DeploymentViewVerificator(String pathToCSAR) throws Exception {		
+		deploymentViewDataFromFile = getDeploymentViewDataFromCSAR(pathToCSAR);
+	}
+	
+	public DeploymentViewVerificator() throws Exception {		
+		deploymentViewDataFromFile = deploymentViewDataMixedArtefects;
+	}
+
+	
+	public  void verifyDeploymentPageSubElements(String moduleName) throws Exception{
+		HashMap<String, List<String>> moduleProperties = getDeploymentViewData().get(moduleName);
+		
+		// add env placeholder to deployment view data
+		if (!moduleProperties.get("artifacts").contains(moduleName + ".env")){
+			moduleProperties.get("artifacts").add(moduleName + ".env");
+		}
+		
+		List<WebElement> members, artifacts, properties;
+		members = DeploymentPage.getGroupMembersList(moduleName);
+		artifacts = DeploymentPage.getArtifactNames();
+		properties = DeploymentPage.getPropertyNames();
+		
+		File imageFilePath = GeneralUIUtils.takeScreenshot(moduleName + UUID.randomUUID(), SetupCDTest.getScreenshotFolder(), null);
+		final String absolutePath = new File(SetupCDTest.getReportFolder()).toURI().relativize(imageFilePath.toURI()).getPath();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating group  %s, should be %s members, %s artefacts " + SetupCDTest.getExtendTest().addScreenCaptureFromPath(absolutePath), 
+				                                                       moduleName, moduleProperties.get("members").size(), moduleProperties.get("artifacts").size()));
+		
+		assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size());		
+		assertTrue(moduleProperties.get("artifacts").containsAll(artifacts.stream().
+				                                                map(e -> e.getAttribute("textContent")).
+				                                                collect(Collectors.toList())));
+		assertTrue(moduleProperties.get("members").size() == members.size(), "Members amount not as expected, expected " + moduleProperties.get("members").size());
+		assertTrue(moduleProperties.get("members").containsAll(members.stream().
+												                map(e -> e.getAttribute("textContent")).
+												                collect(Collectors.toList())));
+		assertTrue(moduleProperties.get("properties").size() == properties.size(), "Properties amount not as expected, expected " + moduleProperties.get("properties").size());
+		assertTrue(moduleProperties.get("properties").containsAll(properties.stream().
+												                map(e -> e.getAttribute("textContent")).
+												                collect(Collectors.toList())));
+		DeploymentPage.clickOnProperties();
+		DeploymentPage.clickOnArtifacts();
+	}
+	
+	public  void verifyDeploymentPageModules(List<WebElement> modules){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF groups , should be %s groups ", getDeploymentViewData().size())); 
+	    assertFalse(modules.isEmpty(), "No modules found");
+	    assertTrue(modules.size() == getDeploymentViewData().size(), "Modules amount not as expected, expected " + getDeploymentViewData().size());
+		for (WebElement module: modules){
+		    assertTrue(getDeploymentViewData().containsKey(module.getText().split("\\.\\.")[1]));
+		}
+	}
+	
+	public static void verifyComponentNameChanged(String oldName, String newName){
+		try{
+			GeneralUIUtils.clickOnElementByText(oldName, 10);
+			assertTrue(false, "Element name don't changed");
+		} catch(Exception e){
+			GeneralUIUtils.clickOnElementByText(newName);
+		}
+	}
+
+	public  Map<String, HashMap<String, List<String>>> getDeploymentViewData() {
+//		return deploymentViewData;
+		return getDeploymentViewDataFromFile();
+	}
+	
+	public static Map<String, HashMap<String, List<String>>> buildDeploymentViewDataFromCSAR(String pathToCSAR, File mainServiceTemplate) throws Exception{
+		ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(mainServiceTemplate);
+		Map<String, HashMap<String, List<String>>> deploymentViewDataFromFile = new HashMap<String, HashMap<String, List<String>>>();
+		Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups();
+		List<String> keyList = groups.keySet().stream().collect(Collectors.toList());
+		HashMap<String, List<String>> groupsToArtefacts = getDeploymentArtefactsMapedToGroupsFromCSAR(pathToCSAR);
+		for(String groupKey: keyList){
+			HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>();
+			tempGroupMap.put("artifacts", groupsToArtefacts.get(groupKey));
+			if (groups.get(groupKey).getMembers() == null){
+				tempGroupMap.put("members", Arrays.asList());
+			} else {
+				tempGroupMap.put("members", groups.get(groupKey).getMembers());
+			}			
+			tempGroupMap.put("properties", Arrays.asList(currentProperties));
+			deploymentViewDataFromFile.put(groupKey, tempGroupMap);
+		}
+		return deploymentViewDataFromFile;
+	}
+	
+    public static HashMap<String, List<String>> getDeploymentArtefactsMapedToGroupsFromCSAR(String pathToFile) throws Exception {	
+		Map<String, Object> combinedMap = ArtifactFromCsar.combineHeatArtifacstWithFolderArtifacsToMap(pathToFile);
+		LinkedList<HeatMetaFirstLevelDefinition> deploymentArtifacts = ((LinkedList<HeatMetaFirstLevelDefinition>) combinedMap.get("Deployment"));
+		HashMap<String, List<String>> tempGroupMap = new HashMap<String, List<String>>();
+		for(HeatMetaFirstLevelDefinition deploymentArtifact: deploymentArtifacts) {
+			String groupName = deploymentArtifact.getFileName().trim().substring(0, deploymentArtifact.getFileName().indexOf("."));
+			if(deploymentArtifact.getType().equals("HEAT")) { 				
+				tempGroupMap.put(groupName, new ArrayList(Arrays.asList(deploymentArtifact.getFileName().trim())));
+			} else {
+				// update current key 
+				tempGroupMap.get(groupName).add(deploymentArtifact.getFileName().trim());
+				tempGroupMap.put(groupName, tempGroupMap.get(groupName));
+			}
+		}
+		return tempGroupMap;
+	}
+    
+    public static Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromCSAR(String pathToCsar) throws Exception {
+		String outputFolder = unzipCsarFile(pathToCsar);
+		
+		File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + "MainServiceTemplate.yaml");
+		Map<String, HashMap<String, List<String>>> deploymentViewData = buildDeploymentViewDataFromCSAR(pathToCsar, pathToMainServiceTemplate);
+		cleanFolders(outputFolder);
+		
+		return deploymentViewData;
+	}
+
+    public static void cleanFolders(String outputFolder) throws IOException {
+		System.gc();
+		FileUtils.cleanDirectory(new File(outputFolder));
+		FileUtils.deleteDirectory(new File(outputFolder));
+	}
+
+	public static String unzipCsarFile(String pathToCsar) {
+		File csarFile = new File(pathToCsar);
+		
+		
+		File dir = new File(csarFile.getParent() + File.separator + "output"+UUID.randomUUID() + File.separator + UUID.randomUUID());
+		if(!dir.exists()) {
+			dir.mkdirs();
+		}
+
+		String outputFolder = dir.getPath();
+		ArtifactFromCsar.unZip(pathToCsar, outputFolder);
+		return outputFolder;
+	}
+	
+	public static void validateEditPopoverFields(String expectedVNFName, String expectedHeatName, String expectedModuleName){
+		String VNFname = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.RESOURCE_NAME_ON_POPOVER.getValue()).getText();
+		String heatName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.NAME_INPUT.getValue()).getAttribute("value");
+		String moduleName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.DeploymentScreen.MODULE_NAME_ON_POPOVER.getValue()).getText();
+		assertTrue(expectedVNFName.equals(VNFname), String.format("VNF name Expected: %s, Actual: %s ", expectedVNFName, VNFname));
+		assertTrue(expectedHeatName.equals(heatName), String.format("HEAT name Expected: %s, Actual: %s ", expectedHeatName, heatName ));
+		assertTrue(expectedModuleName.equals(moduleName), String.format("Module name Expected: %s, Actual: %s ", expectedModuleName, moduleName));		
+	}
+	
+	public static void validateEditPopoverButtons(String newName, String invalidModuleName, String validModueName ){
+		DeploymentPage.updateAndCancel(newName, DataTestIdEnum.DeploymentScreen.X_BUTTON);
+		verifyComponentNameChanged(invalidModuleName, validModueName);
+		DeploymentPage.clickOnEditIcon();
+		DeploymentPage.updateAndCancel(newName, DataTestIdEnum.DeploymentScreen.CANCEL);
+		verifyComponentNameChanged(invalidModuleName, validModueName);
+	}
+	
+	public static void validateEditPopover() throws Exception{
+		String moduleRowText = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue()).get(0).getText();
+		DeploymentPage.clickOnModuleName(moduleRowText);
+		DeploymentPage.clickOnEditIcon();
+		String[] splitedModuleName = moduleRowText.split("\\.\\.");
+		
+		validateEditPopoverFields(splitedModuleName[0], splitedModuleName[1], splitedModuleName[2]);
+		
+		String newName = "kuku";
+		String newModuleName = DeploymentPage.reconstructModuleName(splitedModuleName, newName);
+		validateEditPopoverButtons(newName, newModuleName, moduleRowText);				
+	}
+
+	private  Map<String, HashMap<String, List<String>>> getDeploymentViewDataFromFile() {
+		return deploymentViewDataFromFile;
+	}
+
+	public static void validateModuleNameUpadate() throws Exception{
+		List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
+		int i = 0;
+		for(WebElement moduleRow :moduleRowsFromTable){
+			String moduleRowText = moduleRow.getText();
+			String updatedName = "updatedName" + i;
+			DeploymentPage.updateModuleName(moduleRowText, updatedName);
+			String updatedModuleName = DeploymentPage.reconstructModuleName(moduleRowText.split("\\.\\."), updatedName);
+			verifyComponentNameChanged(moduleRowText, updatedModuleName);
+			// Close module
+			GeneralUIUtils.clickOnElementByText(updatedModuleName);
+			i++;
+		}		
+	}
+
+	public static void regularDepoymentScreenVerificator(Map<String, HashMap<String, String>> metaDataFromUI, DeploymentViewVerificator  verificator) throws Exception, InterruptedException {
+		ResourceGeneralPage.getLeftMenu().moveToDeploymentViewScreen();
+		List<WebElement> moduleRowsFromTable = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DeploymentScreen.MODULES.getValue());
+		verificator.verifyDeploymentPageModules(moduleRowsFromTable);
+		for(WebElement moduleRow :moduleRowsFromTable){
+			String moduleRowText = moduleRow.getText();
+			String middleName = moduleRowText.split("\\.\\.")[1];
+			verificator.verifyDeploymentPageSubElements(middleName);
+			if (metaDataFromUI != null){
+				SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating %s group version, should be %s ", moduleRowText, metaDataFromUI.get(moduleRowText.split("\\.\\.")[1])));
+				String groupVersion = DeploymentPage.getGroupVersion().split(":")[1].trim();
+				String increasedVersion = String.valueOf(Integer.parseInt(metaDataFromUI.get(middleName).get("version")) + 1);
+				assertTrue(groupVersion.equals(increasedVersion));
+				if ( metaDataFromUI.get(middleName).get("moduleID") != "primary"){
+					String moduleID = DeploymentPage.getModuleID();
+					assertFalse(moduleID.equals(metaDataFromUI.get(middleName).get("moduleID")));
+				}				
+			}
+			// Close module
+			GeneralUIUtils.clickOnElementByText(moduleRowText);
+		}
+	}
+	
+	
+	
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
new file mode 100644
index 0000000..f53bfa4
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ErrorMessageUIVerificator.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.ci.tests.datatypes.ErrorMessageProperties;
+import org.openecomp.sdc.ci.tests.datatypes.enums.ErrorInfo;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public class ErrorMessageUIVerificator {
+
+	private static ErrorMessageProperties getErrorByType(ActionStatus errorType){
+		try{
+			ErrorInfo errorInfo = ErrorValidationUtils.parseErrorConfigYaml(errorType.name());
+			String messageId = errorInfo.getMessageId();
+			String code = errorInfo.getCode().toString();
+			
+			return new ErrorMessageProperties(messageId, code);
+		}
+		catch(Exception e){
+			return null;
+		}
+	}
+
+	public static void validateErrorMessage(ActionStatus errorMessage) {
+		String errorMessageBox = null;
+		try{
+			errorMessageBox = GeneralUIUtils.getWebElementByClassName("w-sdc-modal-caption").getText();
+		}
+		catch(Exception e){
+			ExtentTestActions.log(Status.INFO, "Did not find an error message popup.");
+			Assert.fail("Did not find an error message popup.");
+		}
+		
+		ExtentTestActions.log(Status.INFO, "An error message raised, validating its content.");
+		ErrorMessageProperties expectedResponseError = getErrorByType(errorMessage);
+		Assert.assertTrue(errorMessageBox.contains(expectedResponseError.getCode()), "Error message code is not " + expectedResponseError.getCode());
+		Assert.assertTrue(errorMessageBox.contains(expectedResponseError.getMessageId()), "Error message ID is not " + expectedResponseError.getMessageId());
+	}
+
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
new file mode 100644
index 0000000..2c1f59f
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/ServiceVerificator.java
@@ -0,0 +1,335 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.function.Predicate;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.GroupInstanceProperty;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.ComponentReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum.PropertiesPopupEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.ServiceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.CompositionPage;
+import org.openecomp.sdc.ci.tests.pages.DeploymentPage;
+import org.openecomp.sdc.ci.tests.pages.PropertyPopup;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.pages.ServiceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.Select;
+
+import com.aventstack.extentreports.Status;
+
+public class ServiceVerificator {
+
+	private ServiceVerificator() {	
+	}	
+
+	public static void verifyNumOfComponentInstances(ComponentReqDetails component, String version, int numOfVFC,
+			User user) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing the number of components on the canvas; should be %s", numOfVFC));  
+		String responseAfterDrag = null;
+		component.setVersion(version);
+		if (component instanceof ServiceReqDetails) {
+			responseAfterDrag = RestCDUtils.getService((ServiceReqDetails) component, user).getResponse();
+		} else if (component instanceof ResourceReqDetails) {
+			responseAfterDrag = RestCDUtils.getResource((ResourceReqDetails) component, user).getResponse();
+		}
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		int size = ((JSONArray) jsonResource.get("componentInstances")).size();
+		assertTrue(size == numOfVFC);
+		ExtentTestActions.log(Status.INFO, "The number of components on the canvas was verified.");
+	}
+	
+	public static void verifyServiceUpdatedInUI(ServiceReqDetails service) {
+		assertTrue(service.getName().equals(ResourceGeneralPage.getNameText()));
+		assertTrue(service.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+		assertTrue(service.getCategory().equals(ServiceGeneralPage.getCategoryText()));
+		assertTrue(service.getProjectCode().equals(ServiceGeneralPage.getProjectCodeText()));
+		for(String tag: ServiceGeneralPage.getTags()){
+			assertTrue(service.getTags().contains(tag));
+		}
+		assertTrue(service.getContactId().equals(ResourceGeneralPage.getContactIdText()));		
+	}
+	
+	public static void verifyServiceDeletedInUI(ServiceReqDetails service) throws InterruptedException {
+		Thread.sleep(1000);
+		List<WebElement> cardElements = GeneralUIUtils.getElementsByCSS(DataTestIdEnum.DashboardCardEnum.DASHBOARD_CARD.getValue());
+		if (!(cardElements.isEmpty())){
+			for (WebElement cardElement: cardElements){
+				WebElement componentName = GeneralUIUtils.getElementfromElementByCSS(cardElement, 
+                        DataTestIdEnum.DashboardCardEnum.INFO_NAME.getValue());
+				WebElement componentType = GeneralUIUtils.getElementfromElementByCSS(cardElement,
+                        DataTestIdEnum.DashboardCardEnum.ASSET_TYPE_CSS.getValue());
+				
+				String componentNameStr    = componentName.getAttribute("textContent").trim(), 
+					   componentTypeStr    = componentType.getAttribute("class");
+				
+				if(componentTypeStr.equals("S")){
+					assertTrue( !(componentNameStr.equals(service.getName())), "Deleted service was found !!!");
+				}
+			}
+		}
+	}
+	
+	public static void verifyServiceLifecycle(ServiceReqDetails service, User user, LifecycleStateEnum expectedLifecycleState) {
+		String responseAfterDrag = RestCDUtils.getService(service, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		String actualLifecycleState = jsonResource.get("lifecycleState").toString();
+		assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState);
+	}
+	
+	public static void verifyLinkCreated(ServiceReqDetails createServiceInUI, User user, int expectedRelationsSize) {
+		String responseAfterDrag = RestCDUtils.getService(createServiceInUI, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize);
+
+	}
+	
+	public static void verifyManagmentWorkflow(String expectedName, String expectedDescription){
+		String actualName = GeneralUIUtils.getWebElementBy(By.cssSelector("div[class='text name']")).getText();
+		String actualDescription = GeneralUIUtils.getWebElementBy(By.cssSelector("div[class='text description']")).getText();
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing name ( should be %s ) and description ( should be %s ) ", expectedName, expectedDescription));
+		assertTrue(actualName.equals(expectedName) && actualDescription.equals(expectedDescription));
+	}
+	
+	public static void verifyVersionUI(String expected){
+		String actualVersion = GeneralUIUtils.getSelectedElementFromDropDown(DataTestIdEnum.GeneralElementsEnum.VERSION_HEADER.getValue()).getText().replace("V", "");
+		assertTrue(actualVersion.equals(expected), String.format( "Expected version: %s, Actual version: %s", expected, actualVersion));
+	}
+	
+	public static void verifyOpenTabTitle(DataTestIdEnum.CompositionScreenEnum currentTab) throws Exception{
+		List<String> expectedTitles  = new ArrayList<String>();
+		for(String expectedTitle: currentTab.getTitle()){
+			expectedTitles.add(expectedTitle);
+		}		
+		for (WebElement actualTitle: CompositionPage.getOpenTabTitle()){
+			int indexOfTitle = expectedTitles.indexOf(actualTitle.getText());
+			assertTrue(indexOfTitle >= 0, "Wrong title");
+			expectedTitles.remove(indexOfTitle);
+		}
+		assertTrue(expectedTitles.size() == 0, "Missing titles in " + currentTab.getValue());
+	}
+	
+	public static void verifyDeploymentPageSubElements(String moduleName, DeploymentViewVerificator verificatorObj) throws Exception{
+		HashMap<String, List<String>> moduleProperties = verificatorObj.getDeploymentViewData().get(moduleName);
+		
+		ServiceVerificator.moveMetadataPropertiesArtifactSection(-700);
+		
+		List<WebElement> artifacts, properties;
+		artifacts = DeploymentPage.getArtifactNames();
+		properties = DeploymentPage.getPropertyNames();
+		assertTrue(moduleProperties.get("artifacts").size() == artifacts.size(), "Artifacts amount not as expected, expected " + moduleProperties.get("artifacts").size());
+		assertTrue(moduleProperties.get("artifacts").containsAll(artifacts.stream().
+				                                                map(e -> e.getAttribute("textContent")).
+				                                                collect(Collectors.toList())));
+		assertTrue(moduleProperties.get("properties").size() == properties.size(), "Properties amount not as expected, expected " + moduleProperties.get("properties").size());
+		assertTrue(moduleProperties.get("properties").containsAll(properties.stream().
+												                map(e -> e.getAttribute("textContent")).
+											 	                collect(Collectors.toList())));
+		
+		DeploymentPage.clickOnProperties();
+		DeploymentPage.clickOnArtifacts();
+		ServiceVerificator.moveMetadataPropertiesArtifactSection(700);
+	}
+	
+	public static void verifyVFModuleCustomizationUUID(ServiceReqDetails service) throws Exception {
+		Predicate<String> componentInstancePredicate = e -> e.length() > 35;
+		List<String> customizationUUIDList = getAllVFModuleCustomizationUUIDs(service);
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating vfModuleCustomizationUUID uniqness ... "));
+		assertTrue(customizationUUIDList.stream().allMatch(componentInstancePredicate), "vfModuleCustomizationUUID is less then 35 chars");
+		CustomizationUUIDVerificator.validateCustomizationUUIDuniqueness(customizationUUIDList);
+	}
+
+	public static List<String> getAllVFModuleCustomizationUUIDs(ServiceReqDetails service) throws Exception {
+		Service serviceObj = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service.getName(), service.getVersion());
+		List<String> customizationUUIDList = serviceObj.getComponentInstances().get(0).getGroupInstances().stream().
+                                                                                     map(e -> e.getCustomizationUUID()).
+                                                                                     collect(Collectors.toList());
+		
+		return customizationUUIDList;
+	}
+	
+	public static String getVFModulePropertieValue(ServiceReqDetails service, String propertyName, String moduleName) throws Exception {
+		Service serviceObj = AtomicOperationUtils.getServiceObjectByNameAndVersion(UserRoleEnum.DESIGNER, service.getName(), service.getVersion());	
+		List<GroupInstance> groupInstances = serviceObj.getComponentInstances().get(0).getGroupInstances();		
+		List<GroupInstanceProperty> groupInstancesProperties = groupInstances.stream().
+				                                                              filter(e -> e.getName().equals(moduleName)).
+				                                                              findFirst().
+				                                                              get().
+				                                                              convertToGroupInstancesProperties();		
+		String propertieValue = groupInstancesProperties.stream().
+				                                         filter(e -> e.getName().equals(propertyName)).
+				                                         findFirst().
+				                                         get().
+				                                         getValue();
+		return propertieValue;
+	}
+	
+	public static boolean isEqualCustomizationUUIDsAfterChanges(List<String> listBefore, List<String> listAfter){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating if vfModuleCustomizationUUID changed after certification ... "));
+		return (listBefore.size() == listAfter.size()) && (listBefore.containsAll(listAfter));
+	}
+
+	public static void verifyDisabledServiceProperties() throws Exception{
+		List<String> propertiesForCheck = Arrays.asList("isBase", "vf_module_type", "vf_module_label", "vf_module_description");
+		List<PropertiesPopupEnum> popupElementsForCheck = Arrays.asList(PropertiesPopupEnum.PROPERTY_NAME, 
+				                                                        PropertiesPopupEnum.PROPERTY_DESCRIPTION, 
+				                                                        PropertiesPopupEnum.PROPERTY_TYPE, 
+				                                                        PropertiesPopupEnum.PROPERTY_VALUE);
+		ServiceVerificator.moveMetadataPropertiesArtifactSection(-700);
+		List<WebElement> properties = DeploymentPage.getPropertyNames();
+		
+		for(WebElement property : properties){
+			if (propertiesForCheck.contains(property.getAttribute("textContent"))){
+				DeploymentPage.clickOnProperty(property);
+				Select propertTypeElement = new Select(GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_TYPE.getValue()));
+				boolean isTypeBoolean = propertTypeElement.getFirstSelectedOption().getText().contains("boolean");
+				for (PropertiesPopupEnum popupElement: popupElementsForCheck){
+					if (isTypeBoolean && popupElement == PropertiesPopupEnum.PROPERTY_VALUE){
+						assertTrue(GeneralUIUtils.checkForDisabledAttribute(DataTestIdEnum.PropertiesPopupEnum.PROPERTY_BOOLEAN_VALUE.getValue()), String.format("Element %s not disabled ", property.getText()));
+					} else {
+						assertTrue(GeneralUIUtils.checkForDisabledAttribute(popupElement.getValue()), String.format("Element %s not disabled ", property.getText()));
+					}					
+				}
+				new PropertyPopup().clickCancel();
+			}
+		}
+		
+		DeploymentPage.clickOnProperties();
+		ServiceVerificator.moveMetadataPropertiesArtifactSection(700);
+	}
+
+	public static void verifyEnabledServiceProperties() throws Exception{
+		List<String> propertiesForCheck = Arrays.asList("initial_count", "max_vf_module_instances", "min_vf_module_instances");
+		
+		ServiceVerificator.moveMetadataPropertiesArtifactSection(-700);
+		List<WebElement> properties = DeploymentPage.getPropertyNames();
+		
+		ServiceVerificator.positiveFlow(propertiesForCheck, properties);
+		ServiceVerificator.negativeFlow(propertiesForCheck, properties);
+		
+		DeploymentPage.clickOnProperties();
+		ServiceVerificator.moveMetadataPropertiesArtifactSection(700);			
+	}
+
+	public static void positiveFlow(List<String> propertiesForCheck, List<WebElement> properties)
+			throws InterruptedException {
+		int baseNumber = new Random().nextInt(100) + 2;
+		for(WebElement property : properties){
+			String propertyName = property.getAttribute("textContent");
+			if (propertiesForCheck.contains(propertyName)){
+				DeploymentPage.clickOnProperty(property);				
+				int actualNumber = 0;
+				if (propertyName.equals("initial_count")){
+					actualNumber = baseNumber;
+				} else if (propertyName.equals("max_vf_module_instances")) {
+					actualNumber = baseNumber + 1;
+				} else if (propertyName.equals("min_vf_module_instances")){
+					actualNumber = baseNumber - 1;				
+				}
+				
+				new PropertyPopup().insertPropertyDefaultValue(String.valueOf(actualNumber));
+				new PropertyPopup().clickSave();
+				assertTrue(DeploymentPage.getPropertyValueFromPropertiesList(propertyName).equals(String.valueOf(actualNumber)));
+			}
+		}
+	}
+
+	public static void negativeFlow(List<String> propertiesForCheck, List<WebElement> properties)
+				throws Exception {
+			int currentMaxValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("max_vf_module_instances"));
+			int currentMinValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("min_vf_module_instances"));
+			int currentInitialValue = Integer.valueOf(DeploymentPage.getPropertyValueFromPropertiesList("initial_count"));		
+			PropertyPopup propertyPopupObj = new PropertyPopup();
+			
+			for(WebElement property : properties){
+				String propertyName = property.getAttribute("textContent");
+				if (propertiesForCheck.contains(propertyName)){
+					DeploymentPage.clickOnProperty(property);				
+					if (propertyName.equals("initial_count")){
+						
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMaxValue + 1));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMinValue - 1));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(0));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+						
+					} else if (propertyName.equals("max_vf_module_instances")) {
+						
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentInitialValue - 1));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMinValue - 1));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(0));
+						verifyErrorPresentAndSaveDisabled();
+						
+					} else if (propertyName.equals("min_vf_module_instances")){
+						
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentInitialValue + 1));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();
+						propertyPopupObj.insertPropertyDefaultValue(String.valueOf(currentMaxValue + 1));
+						ServiceVerificator.verifyErrorPresentAndSaveDisabled();				
+					}				
+									
+					new PropertyPopup().clickCancel();
+				}
+			}
+		}
+
+	public static void verifyErrorPresentAndSaveDisabled() throws Exception{
+		assertTrue(DeploymentPage.isPropertySaveButtonDisabled());
+		assertTrue(DeploymentPage.getPropertyErrorValidationMessdge().size() == 1);
+	}
+
+	public static void moveMetadataPropertiesArtifactSection(int offset) throws InterruptedException {
+		WebElement dragLineElement = GeneralUIUtils.getElementByCSS("div.rg-top");
+		GeneralUIUtils.dragAndDropElementByY(dragLineElement, offset);
+	}
+	
+    
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
new file mode 100644
index 0000000..3b0b458
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/UserManagementVerificator.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.lang3.text.WordUtils;
+import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.pages.AdminGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.validation.ErrorValidationUtils;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public class UserManagementVerificator {
+
+
+	
+	public static void validateUserCreated(String userId, UserRoleEnum role){
+		
+		ExtentTestActions.log(Status.INFO, "Validating that a new user is created and displayed in the first row in the table.");
+		
+		final int firstRow = 0;
+		
+		WebElement actualFirstName = AdminGeneralPage.getUserManagementTab().getFirstName(firstRow);
+		WebElement actualLastName = AdminGeneralPage.getUserManagementTab().getLastName(firstRow);
+		WebElement actualUserId = AdminGeneralPage.getUserManagementTab().getUserId(firstRow);
+		WebElement actualEmail = AdminGeneralPage.getUserManagementTab().getEmail(firstRow);
+		WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(firstRow);
+		WebElement actualLastActive = AdminGeneralPage.getUserManagementTab().getLastActive(firstRow);
+		
+		
+		String actualFirstNameText = actualFirstName.getText();
+		String actualLastNameText = actualLastName.getText();
+		String actualUserIdText = actualUserId.getText();
+		String actualEmailText = actualEmail.getText();
+		String actualRoleText = actualRole.getText();
+		String actualLastActiveText = actualLastActive.getText();
+		
+		Assert.assertTrue(actualFirstNameText.equals("---"), "Actual first name is not '---'.");
+		Assert.assertTrue(actualLastNameText.equals("---"), "Actual last name is not '---'.");
+		Assert.assertTrue(actualUserIdText.equals(userId), "Actual user id is not  " + userId);
+		Assert.assertTrue(actualEmailText.equals("---"), "Actual email is not '---'.");
+		Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(role.name().toLowerCase())), "Actual role is not " + role.name());
+		Assert.assertTrue(actualLastActiveText.equals("Waiting"), "Actual role is not 'Waiting'.");
+	}
+	
+	
+	public static void validateUserRoleUpdated(int rowIndx, UserRoleEnum updatedRole){
+		ExtentTestActions.log(Status.INFO, "Validating role is updated to " + updatedRole.name() + " in UI.");
+		WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(rowIndx);
+		String actualRoleText = actualRole.getText();
+		Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(updatedRole.name().toLowerCase())), "Actual role is not " + updatedRole.name());
+	}
+	
+	public static void validateUserRoleUpdatedViaRest(User reqUser, User user, UserRoleEnum expectedUserRole){
+		try{
+			ExtentTestActions.log(Status.INFO, "Validating role is updated to " + expectedUserRole.name() + " in BE.");
+			String actualUserRole = RestCDUtils.getUserRole(reqUser, user);
+			Assert.assertTrue(expectedUserRole.name().toLowerCase().equals(actualUserRole.toLowerCase()), "User role is not updated.");
+		}
+		catch(Exception e){
+			Assert.fail("The actual user role is null");
+		}
+	}
+	
+	public static void validateUserNotFoundViaRest(User reqUser, User user){
+		try{
+			ExtentTestActions.log(Status.INFO, "Validating user " + reqUser.getUserId() + " is not found in BE.");
+			RestResponse getUserResp = RestCDUtils.getUser(reqUser, user);
+			ErrorValidationUtils.checkBodyResponseOnError(ActionStatus.USER_INACTIVE.name(), Arrays.asList(reqUser.getUserId()), getUserResp.getResponse());
+		}
+		catch(Exception e){
+			Assert.fail("The response message does not describe the user is not found.");
+		}
+	}
+	
+	public static void validateUserIdNotFound(String userId){
+		ExtentTestActions.log(Status.INFO, "Validating that user " + userId + " is not found.");
+		AdminGeneralPage.getUserManagementTab().searchUser(userId);
+		List<WebElement> rows = AdminGeneralPage.getUserManagementTab().getAllRowsDisplayed();
+		Assert.assertEquals(rows.size(), 0, String.format("There are %s rows instead of none.", rows.size()));
+	}
+	
+	public static void validateOnlySingleRowDisplayed(){
+		ExtentTestActions.log(Status.INFO, "Validating that only a single row is displayed in table.");
+		List<WebElement> rows = AdminGeneralPage.getUserManagementTab().getAllRowsDisplayed();
+		Assert.assertEquals(rows.size(), 1, String.format("There are %s rows instead of %s.", rows.size(), 1));
+	}
+	
+	public static void validateRowDisplayedCorrectly(User user, int rowindex){
+		String role = user.getRole();
+		String userId = user.getUserId();
+		String firstName = user.getFirstName();
+		String lastName = user.getLastName();
+		String email = user.getEmail();
+		
+		ExtentTestActions.log(Status.INFO, "Validating that the row is properly displayed.");
+
+		WebElement actualFirstName = AdminGeneralPage.getUserManagementTab().getFirstName(rowindex);
+		WebElement actualLastName = AdminGeneralPage.getUserManagementTab().getLastName(rowindex);
+		WebElement actualUserId = AdminGeneralPage.getUserManagementTab().getUserId(rowindex);
+		WebElement actualEmail = AdminGeneralPage.getUserManagementTab().getEmail(rowindex);
+		WebElement actualRole = AdminGeneralPage.getUserManagementTab().getRole(rowindex);
+		
+		
+		String actualFirstNameText = actualFirstName.getText();
+		String actualLastNameText = actualLastName.getText();
+		String actualUserIdText = actualUserId.getText();
+		String actualEmailText = actualEmail.getText();
+		String actualRoleText = actualRole.getText();
+		
+		Assert.assertTrue(actualFirstNameText.equals(firstName), "Actual first name is not " + firstName);
+		Assert.assertTrue(actualLastNameText.equals(lastName), "Actual last name is not " + lastName);
+		Assert.assertTrue(actualUserIdText.equals(userId), "Actual user id is not  " + userId);
+		Assert.assertTrue(actualEmailText.contains(email), "Actual email does not contain " + email);
+		Assert.assertTrue(actualRoleText.equals(WordUtils.capitalize(role.toLowerCase())), "Actual role is not " + role);
+	}
+	
+	public static void validateFirstRowDisplayedCorrectly(User user){
+		validateRowDisplayedCorrectly(user, 0);
+	}
+	
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java
new file mode 100644
index 0000000..ac009c6
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCArtifactVerificator.java
@@ -0,0 +1,347 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.ci.tests.datatypes.HeatMetaFirstLevelDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.VFCArtifact;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public class VFCArtifactVerificator {
+	
+	private static final String ARTIFACTS = "artifacts";
+	private static final String DEPLOYMENT_ARTIFACTS = "deploymentArtifacts";
+	private static List<VFCArtifact> vfcArtifactList = new ArrayList<VFCArtifact>();
+	private static JSONObject jsonResource;
+	
+	public static void verifyVFCArtifactsNotInVFArtifactList(ResourceReqDetails resource , User user, RestResponse optionalGetResponse, Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap){
+		ExtentTestActions.log(Status.INFO, "Verifying that VFC artifacts are not as part of VF artifacts.");
+		LinkedList<HeatMetaFirstLevelDefinition> expectedDeploymentArtifacts = expectedArtifactMap.get(DEPLOYMENT_ARTIFACTS);
+		LinkedList<HeatMetaFirstLevelDefinition> expectedInformationalArtifacts = expectedArtifactMap.get(ARTIFACTS);
+		
+		Map<String, Object> vfDepArtifacts = getVFDeploymentArtifacts(resource, user, optionalGetResponse);
+		for (Object artifact : vfDepArtifacts.values()){
+			JSONObject acArtifact = ((JSONObject) JSONValue.parse(artifact.toString()));
+			String acArtifactName = acArtifact.get("artifactName").toString();
+			
+			for(HeatMetaFirstLevelDefinition exDepArtifact : expectedDeploymentArtifacts){
+				assertTrue(!exDepArtifact.getType().equals(acArtifactName));
+			}
+		}
+		
+		Map<String, Object> vfInfoArtifacts = getVFInforamtionalArtifacts(resource, user, optionalGetResponse);
+		for (Object artifact : vfInfoArtifacts.values()){
+			JSONObject acArtifact = ((JSONObject) JSONValue.parse(artifact.toString()));
+			if (acArtifact.containsKey("artifactName")){
+				String acArtifactName  = acArtifact.get("artifactName").toString();
+				
+				for(HeatMetaFirstLevelDefinition exInfoArtifact : expectedInformationalArtifacts){
+					assertTrue(!exInfoArtifact.getType().equals(acArtifactName));
+				}
+			}
+			
+
+		}
+
+
+		
+	}
+	
+	public static void verifyVfcArtifactUpdated(String instanceName, ResourceReqDetails resource, User user){
+		ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts are updated.");
+		List<VFCArtifact> vfcArtifactsBeforeUpdate = getVfcArtifactList();
+		
+		setVfcArtifactList(new ArrayList<VFCArtifact>());
+		setActualVfcArtifactList(instanceName, resource, user);
+		
+		for (VFCArtifact artifact : vfcArtifactsBeforeUpdate){
+			String artifactnameBeforeUpdate = artifact.getArtifactname();
+			for (VFCArtifact newArtifact : vfcArtifactList){
+				String artifactnameAfterUpdate = newArtifact.getArtifactname();
+				if (artifactnameBeforeUpdate.equals(artifactnameAfterUpdate)){
+					String artifactUUIDAfterUpdate = newArtifact.getArtifactUUID();
+					assertTrue(!artifactUUIDAfterUpdate.equals(artifact.getArtifactUUID()));
+					
+					int artifactVersionAfterUpdate = Integer.parseInt(newArtifact.getArtifactVersion());
+					int artifactVersionBeforeUpdate = Integer.parseInt(artifact.getArtifactVersion());
+					assertTrue(artifactVersionAfterUpdate == artifactVersionBeforeUpdate + 1);
+					
+					
+					vfcArtifactList.remove(newArtifact);
+					
+					ExtentTestActions.log(Status.INFO, "VFC artifacts are updated and verified.");
+					
+					break;
+				}
+			}
+		}
+		
+		
+		assertTrue(vfcArtifactList.size() == 0);
+		
+	}
+	
+	public static void verifyVFCArtifactNotChanged(String instanceName, ResourceReqDetails resource, User user){
+		ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts are not chaned after update.");
+		List<VFCArtifact> vfcArtifactsBeforeUpdate = getVfcArtifactList();
+		
+		setVfcArtifactList(new ArrayList<VFCArtifact>());
+		setActualVfcArtifactList(instanceName, resource, user);
+		
+		for (VFCArtifact artifact : vfcArtifactsBeforeUpdate){
+			String artifactnameBeforeUpdate = artifact.getArtifactname();
+			for (VFCArtifact newArtifact : vfcArtifactList){
+				String artifactnameAfterUpdate = newArtifact.getArtifactname();
+				if (artifactnameBeforeUpdate.equals(artifactnameAfterUpdate)){
+					String artifactUUIDAfterUpdate = newArtifact.getArtifactUUID();
+					assertTrue(artifactUUIDAfterUpdate.equals(artifact.getArtifactUUID()));
+					
+					int artifactVersionAfterUpdate = Integer.parseInt(newArtifact.getArtifactVersion());
+					int artifactVersionBeforeUpdate = Integer.parseInt(artifact.getArtifactVersion());
+					assertTrue(artifactVersionAfterUpdate == artifactVersionBeforeUpdate);
+					
+					vfcArtifactList.remove(newArtifact);
+					break;
+				}
+			}
+		}
+		
+		
+		assertTrue(vfcArtifactList.size() == 0);
+		
+	}
+	
+	public static void verifyNoVfcArtifacts(ResourceReqDetails resource , User user, RestResponse optionalGetResponse){
+		ExtentTestActions.log(Status.INFO, "Verifying that there are no VFC artifacts at all.");
+		JSONArray jArr = getVFInstances(resource, user, optionalGetResponse);
+		for (Object instanceObj : jArr){
+			JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString());
+			List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance);
+			
+			assertTrue(actualDeploymentArtifacts == null || actualDeploymentArtifacts.size() == 0);
+		}
+	}
+	
+	public static void verifyVfcArtifacts(ResourceReqDetails resource , User user, String instanceName, Map<String, LinkedList<HeatMetaFirstLevelDefinition>> expectedArtifactMap, 
+			RestResponse optionalGetResponse){
+		ExtentTestActions.log(Status.INFO, "Verifying VFC artifacts for instance named " + instanceName);
+		
+		String exCompName = instanceName.split(".vfc.")[1].toLowerCase();
+		String exName = instanceName.split(".heat.")[1].toLowerCase();
+		
+		JSONArray jArr = getVFInstances(resource, user, optionalGetResponse);
+		int jArrSize = jArr.size();
+		
+		for (Object instanceObj : jArr){
+			JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString());
+			String componentName = instance.get("componentName").toString().toLowerCase();
+			String name = instance.get("name").toString().toLowerCase();
+			
+			if (componentName.contains(exCompName) || name.toLowerCase().equals(exName)){
+				
+				List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance);
+				LinkedList<HeatMetaFirstLevelDefinition> expectedDeploymentArtifacts = expectedArtifactMap.get(DEPLOYMENT_ARTIFACTS);
+				checkVFCArtifactsExist(expectedDeploymentArtifacts, actualDeploymentArtifacts);
+				
+				
+				List<String> actualInformationalArtifacts = getActualVfcInstanceArtifactsFromJson(ARTIFACTS, instance);
+				LinkedList<HeatMetaFirstLevelDefinition> expectedInformationalArtifacts = expectedArtifactMap.get(ARTIFACTS);
+				checkVFCArtifactsExist(expectedInformationalArtifacts, actualInformationalArtifacts);
+				
+				jArr.remove(instanceObj);
+				
+				ExtentTestActions.log(Status.INFO, "VFC artifacts for instance named " + instanceName + "are verified.");
+				
+				break;
+			}
+		}
+		
+		assertTrue(jArr.size() == jArrSize - 1, "Instance " + instanceName + " was not found and tested");
+		
+	}
+
+
+
+	private static JSONArray getVFInstances(ResourceReqDetails resource, User user, RestResponse response) {
+		
+		jsonResource = getVFAsJsonObject(resource, user, response);
+		JSONArray jArr = (JSONArray) jsonResource.get("componentInstances");
+		return jArr;
+	}
+	
+	private static Map<String, Object> getVFDeploymentArtifacts(ResourceReqDetails resource, User user, RestResponse response) {
+		
+		jsonResource = getVFAsJsonObject(resource, user, response);
+		Map<String, Object> jArr = (Map<String, Object>) jsonResource.get(DEPLOYMENT_ARTIFACTS);
+		return jArr;
+	}
+	
+	private static Map<String, Object> getVFInforamtionalArtifacts(ResourceReqDetails resource, User user, RestResponse response) {
+		
+		jsonResource = getVFAsJsonObject(resource, user, response);
+		Map<String, Object> jArr = (Map<String, Object>) jsonResource.get(ARTIFACTS);
+		return jArr;
+	}
+	
+	private static JSONObject getVFAsJsonObject(ResourceReqDetails resource, User user, RestResponse response) {
+		if (response == null){
+			resource.setUniqueId(null);
+			response = RestCDUtils.getResource(resource, user);
+			assertTrue(response.getErrorCode().intValue() == 200);
+			getVFAsJsonObject(resource, user, response);
+		}
+		
+		String responseAfterDrag = response.getResponse();
+		jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		return jsonResource;
+	}
+	
+	
+	
+	private static List<String> getActualVfcInstanceArtifactsFromJson(String artifactKind, JSONObject instanceFromJson){
+		Object actualtObject = instanceFromJson.get(artifactKind);
+		if (actualtObject != null){
+			JSONObject actualJsonObject = (JSONObject) JSONValue.parse(actualtObject.toString());
+			List<String> actualArtifacts = (List<String>) actualJsonObject.keySet().stream().map(e -> actualJsonObject.get(e).toString()).collect(Collectors.toList());
+			return actualArtifacts;
+		}
+		return null;
+	}
+
+	private static void checkVFCArtifactsExist(LinkedList<HeatMetaFirstLevelDefinition> expectedArtifacts, List<String> actualArtifacts) {
+		if (expectedArtifacts == null){
+			return;
+		}
+		
+		if (expectedArtifacts.size() != actualArtifacts.size()){
+			ExtentTestActions.log(Status.FAIL, "Expected and actual VFC artifacts lists size are not the same. Expected size: " + expectedArtifacts.size() + " , actual size: " + actualArtifacts.size());
+			Assert.fail("Expected and actual VFC artifacts lists size are not the same. Expected size: " + expectedArtifacts.size() + " , actual size: " + actualArtifacts.size());
+		}
+		
+		List<String> types = new ArrayList<String>();
+		List<String> fileNames = new ArrayList<String>();
+		for (HeatMetaFirstLevelDefinition exArtifact : expectedArtifacts){
+			
+				fileNames.add(exArtifact.getFileName());
+				types.add(exArtifact.getType());
+			
+		}
+		
+		for (int i = 0 ; i < actualArtifacts.size() ; i++){
+			String actualArtifactsString = actualArtifacts.get(i);
+			JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString));
+			
+			String acArtifactFileName = acArtifact.get("artifactName").toString();
+			String acArtifactType = acArtifact.get("artifactType").toString();
+			
+			assertTrue(types.contains(acArtifactType), "List does not contain " + acArtifactType);
+			assertTrue(fileNames.contains(acArtifactFileName), "List does not contain " + acArtifactFileName);
+			
+			types.remove(acArtifactType);
+			fileNames.remove(acArtifactFileName);
+			
+		}
+		
+		assertTrue(types.size() == 0);
+		assertTrue(fileNames.size() == 0);
+		
+	}
+	
+	public static List<VFCArtifact> getVfcArtifactList(){
+		return vfcArtifactList;
+	}
+	
+
+	public static void setVfcArtifactList(List<VFCArtifact> vfcArtifactList) {
+		VFCArtifactVerificator.vfcArtifactList = vfcArtifactList;
+	}
+
+	public static void setActualVfcArtifactList(String instanceName, ResourceReqDetails resource , User user) {
+		String exCompName = instanceName.split(".vfc.")[1].toLowerCase();
+		String exName = instanceName.split(".heat.")[1].toLowerCase();
+		
+		JSONArray jArr = getVFInstances(resource, user, null);
+		
+		for (Object instanceObj : jArr){
+			JSONObject instance = (JSONObject) JSONValue.parse(instanceObj.toString());
+			String componentName = instance.get("componentName").toString().toLowerCase();
+			String name = instance.get("name").toString().toLowerCase();
+			
+			if (componentName.contains(exCompName) || name.toLowerCase().equals(exName)){
+				List<String> actualDeploymentArtifacts = getActualVfcInstanceArtifactsFromJson(DEPLOYMENT_ARTIFACTS, instance);
+				List<String> actualInformationalArtifacts = getActualVfcInstanceArtifactsFromJson(ARTIFACTS, instance);
+		
+				if (actualDeploymentArtifacts != null){
+					for (int i = 0 ; i < actualDeploymentArtifacts.size() ; i++){
+						String actualArtifactsString = actualDeploymentArtifacts.get(i);
+						JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString));
+						
+						if (acArtifact.containsKey("artifactName")){
+							String acArtifactType = acArtifact.get("artifactName").toString();
+							String acArtifactFileName = acArtifact.get("artifactType").toString();
+							String acArtifactUUID = acArtifact.get("artifactUUID").toString();
+							String acArtifactVersion = acArtifact.get("artifactVersion").toString();
+							
+							vfcArtifactList.add(new VFCArtifact(acArtifactType, acArtifactFileName, acArtifactUUID, acArtifactVersion));
+						}
+					}
+				}
+				if (actualInformationalArtifacts != null){
+					for (int i = 0 ; i < actualInformationalArtifacts.size() ; i++){
+						String actualArtifactsString = actualInformationalArtifacts.get(i);
+						JSONObject acArtifact = ((JSONObject) JSONValue.parse(actualArtifactsString));
+						
+						if (acArtifact.containsKey("artifactName")){
+							String acArtifactType = acArtifact.get("artifactName").toString();
+							String acArtifactFileName = acArtifact.get("artifactType").toString();
+							String acArtifactUUID = acArtifact.get("artifactUUID").toString();
+							String acArtifactVersion = acArtifact.get("artifactVersion").toString();
+							vfcArtifactList.add(new VFCArtifact(acArtifactType, acArtifactFileName, acArtifactUUID, acArtifactVersion));
+						}
+						
+						
+					}
+				}
+			}
+		}
+	}
+	
+}
+
+
+
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java
new file mode 100644
index 0000000..0872a3a
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VFCverificator.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.AssertJUnit.assertFalse;
+
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+
+
+public class VFCverificator {
+
+	public static void verifyVFCUpdatedInUI(ResourceReqDetails vf) {
+		assertFalse(vf.getName().equals(ResourceGeneralPage.getNameText()));
+		assertFalse(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+		assertFalse(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText()));
+		assertFalse(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText()));
+	}
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
new file mode 100644
index 0000000..7f01b86
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfModuleVerificator.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.GroupProperty;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
+import org.openecomp.sdc.ci.tests.datatypes.TypeHeatMetaDefinition;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsMetadataDefinition;
+import org.openecomp.sdc.ci.tests.tosca.datatypes.ToscaGroupsTopologyTemplateDefinition;
+import org.openecomp.sdc.ci.tests.utils.ToscaParserUtils;
+
+import com.aventstack.extentreports.Status;
+
+public class VfModuleVerificator {
+
+	private static final String [] PROPERTY_TYPES = {"vf_module_label", "min_vf_module_instances", "max_vf_module_instances", "initial_count"};
+	private static final String VF_MODULE_TYPE = "org.openecomp.groups.VfModule";
+	
+	/**
+	 * compare number of groups from HEAT.meta file vs TOSCA yaml groups generated by ASDC
+	 * @param listTypeHeatMetaDefinition - java object created from HEAT.meta file
+	 * @param toscaDefinition - java object created from TOSCA yaml
+	 */
+	public static void compareNumberOfVfModules(List<TypeHeatMetaDefinition> listTypeHeatMetaDefinition, ToscaDefinition toscaDefinition) {
+
+		int heatMetaGroupCount = 0;
+		int toscaDefinitionGroupCount = 0;
+		for (TypeHeatMetaDefinition typeHeatMetaDefinition : listTypeHeatMetaDefinition) {
+			heatMetaGroupCount = typeHeatMetaDefinition.getGroupHeatMetaDefinition().size();
+		}
+		toscaDefinitionGroupCount = toscaDefinition.getTopology_template().getGroups().size();
+		assertEquals("Expected num of groups in HEAT.meta file is " + heatMetaGroupCount + ", but was in TOSCA yaml file " + toscaDefinitionGroupCount, heatMetaGroupCount, toscaDefinitionGroupCount);
+	}
+
+	/**
+	 * check group structure and "metadata" parameters vs data on the service object
+	 * @param toscaDefinition
+	 */
+	public static void verifyGroupMetadata(ToscaDefinition toscaDefinition, Service service) {
+
+		Map<String, ToscaGroupsTopologyTemplateDefinition> groups = toscaDefinition.getTopology_template().getGroups();
+		for (Map.Entry<String, ToscaGroupsTopologyTemplateDefinition> groupTopologyTemplateDefinition : groups.entrySet()) {
+			String key = groupTopologyTemplateDefinition.getKey();
+			GroupInstance groupInstanceObject = getGroupInstanceByKey(key, service);
+			ToscaGroupsMetadataDefinition metadata = groupTopologyTemplateDefinition.getValue().getMetadata();
+			assertNotNull("groupInstanceObject is null", groupInstanceObject);
+			assertTrue("expected vfModuleModelName " + groupInstanceObject.getGroupName() + ", actual " + metadata.getVfModuleModelName(), groupInstanceObject.getGroupName().equals(metadata.getVfModuleModelName()));
+			assertTrue("expected vfModuleModelInvariantUUID " + groupInstanceObject.getInvariantUUID() + ", actual " + metadata.getVfModuleModelInvariantUUID(), groupInstanceObject.getInvariantUUID().equals(metadata.getVfModuleModelInvariantUUID()));
+			assertTrue("expected vfModuleModelCustomizationUUID " + groupInstanceObject.getCustomizationUUID() + ", actual " + metadata.getVfModuleModelCustomizationUUID(), groupInstanceObject.getCustomizationUUID().equals(metadata.getVfModuleModelCustomizationUUID()));
+			assertTrue("expected vfModuleModelUUID " + groupInstanceObject.getGroupUUID() + ", actual " + metadata.getVfModuleModelUUID(), groupInstanceObject.getGroupUUID().equals(metadata.getVfModuleModelUUID()));
+			assertTrue("expected vfModuleModelVersion " + groupInstanceObject.getVersion() + ", actual " + metadata.getVfModuleModelVersion(), groupInstanceObject.getVersion().equals(metadata.getVfModuleModelVersion()));
+		}
+	}
+
+	
+	/**
+	 * @param key
+	 * @param service
+	 * @return
+	 */
+	public static GroupInstance getGroupInstanceByKey(String key, Service service) {
+		for(ComponentInstance componentInstance : service.getComponentInstances()){
+			for(GroupInstance groupInstance : componentInstance.getGroupInstances()){
+				if( key.equals(groupInstance.getName())){
+					return groupInstance;
+				}
+			}
+		}
+		return null;
+	}
+
+	public static void validateSpecificModulePropertiesFromRequest(Resource resource) {
+		List<List<PropertyDataDefinition>> allProperties = resource.getGroups().stream().
+											                     filter(e -> e.getType().equals(VF_MODULE_TYPE)).
+											                     map(e -> e.getProperties()).
+											                     collect(Collectors.toList());
+		for(String propertyType :PROPERTY_TYPES){
+			int numberOfTypes = getPropertyType(allProperties, propertyType).size();
+			SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s  ", propertyType, allProperties.size(), numberOfTypes));
+			assertTrue(numberOfTypes == allProperties.size());
+		}		
+	}
+
+	public static List<PropertyDataDefinition> getPropertyType(List<List<PropertyDataDefinition>> allProperties, String propertyType) {
+		return allProperties.stream().
+				             flatMap(List::stream).
+				             filter(e -> e.getName().equals(propertyType)).
+				             collect(Collectors.toList());
+	}
+	
+	public static void validateSpecificModulePropertiesFromFile(ToscaDefinition toscaDefinition){
+		List<ToscaGroupsTopologyTemplateDefinition> vfModules = toscaDefinition.getTopology_template().getGroups().values().stream().
+											                                                            filter(e -> e.getType().equals(VF_MODULE_TYPE)).
+											                                                            collect(Collectors.toList());
+		
+		for(String propertyType :PROPERTY_TYPES){
+			int numberOfTypes = (int) vfModules.stream().
+												filter(e -> e.getProperties().containsKey(propertyType)).
+												count();
+			SetupCDTest.getExtendTest().log(Status.INFO, String.format("Validating VF property %s exist, Expected: %s, Actual: %s  ", propertyType, vfModules.size(), numberOfTypes));
+			assertTrue(numberOfTypes == vfModules.size());
+		}		
+	}
+
+	public static ToscaDefinition getToscaTemplate(String pathToCsar) throws Exception {
+		String outputFolder = DeploymentViewVerificator.unzipCsarFile(pathToCsar);
+		String templateFileName = VfModuleVerificator.getTemplateFilenname(pathToCsar);
+		
+		File pathToMainServiceTemplate = new File(outputFolder + File.separator + "Definitions" + File.separator + templateFileName);
+		ToscaDefinition toscaDefinition = ToscaParserUtils.parseToscaYamlToJavaObject(pathToMainServiceTemplate);
+		
+		DeploymentViewVerificator.cleanFolders(new File(outputFolder).getParent());
+		
+		return toscaDefinition;
+	}
+
+	public static String getTemplateFilenname(String pathToCsar) {
+		File csarFile = new File(pathToCsar);
+		String templateFileName = csarFile.getName().replaceAll("-csar.csar", "-template.yml");
+		return templateFileName;
+	}
+	
+}
diff --git a/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
new file mode 100644
index 0000000..e877146
--- /dev/null
+++ b/ui-ci/src/main/java/org/openecomp/sdc/ci/tests/verificator/VfVerificator.java
@@ -0,0 +1,245 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * 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.openecomp.sdc.ci.tests.verificator;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.JSONValue;
+import org.openecomp.sdc.be.model.LifecycleStateEnum;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.model.category.CategoryDefinition;
+import org.openecomp.sdc.ci.tests.datatypes.DataTestIdEnum;
+import org.openecomp.sdc.ci.tests.datatypes.LifeCycleStateEnum;
+import org.openecomp.sdc.ci.tests.datatypes.ResourceReqDetails;
+import org.openecomp.sdc.ci.tests.datatypes.enums.PropertyTypeEnum;
+import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.execute.setup.ExtentTestActions;
+import org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest;
+import org.openecomp.sdc.ci.tests.pages.ResourceGeneralPage;
+import org.openecomp.sdc.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.ResourceUIUtils;
+import org.openecomp.sdc.ci.tests.utilities.RestCDUtils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.testng.Assert;
+
+import com.aventstack.extentreports.Status;
+
+public final class VfVerificator {
+	
+	public static void verifyNumOfComponentInstances(ResourceReqDetails createResourceInUI, int numOfVFC, User user) {
+		ServiceVerificator.verifyNumOfComponentInstances(createResourceInUI, createResourceInUI.getVersion(), numOfVFC, user);
+	}
+
+	public static void verifyRILocationChanged(ResourceReqDetails createResourceInUI,
+			ImmutablePair<String, String> prevRIPos, User user) {
+
+		ImmutablePair<String, String> currRIPos = ResourceUIUtils.getFirstRIPos(createResourceInUI, user);
+		assertTrue(!prevRIPos.left.equals(currRIPos.left) || !prevRIPos.right.equals(currRIPos.right));
+	}
+
+	public static void verifyLinkCreated(ResourceReqDetails createResourceInUI, User user, int expectedRelationsSize) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifing that a link was created on canvas"));
+		String responseAfterDrag = RestCDUtils.getResource(createResourceInUI, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		assertTrue(((JSONArray) jsonResource.get("componentInstancesRelations")).size() == expectedRelationsSize);
+		ExtentTestActions.log(Status.INFO, "The link was verified.");
+
+	}
+
+	public static void verifyVFMetadataInUI(ResourceReqDetails vf) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying fields on General screen through UI ..."));
+		assertTrue(vf.getName().equals(ResourceGeneralPage.getNameText()));
+		assertTrue(vf.getDescription().equals(ResourceGeneralPage.getDescriptionText()));
+		assertTrue(vf.getCategories().get(0).getSubcategories().get(0).getName().equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText()));
+		assertTrue(vf.getVendorName().equals(ResourceGeneralPage.getVendorNameText()));
+		assertTrue(vf.getVendorRelease().equals(ResourceGeneralPage.getVendorReleaseText()));
+		assertTrue(vf.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+		List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable();
+		assertTrue(vf.getTags().size() == tagsList.size());
+		for (int i = 0 ; i < vf.getTags().size(); i ++ ){
+			assertTrue(vf.getTags().contains(tagsList.get(i).getText()));
+		}
+		assertTrue(vf.getContactId().equals(ResourceGeneralPage.getContactIdText()));
+	}
+	
+	public static void verifyVFUpdated(ResourceReqDetails vf, User user) {
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Verifying fields on General screen through Backend ..."));
+		String response = RestCDUtils.getResource(vf, user).getResponse();
+		Resource resource = ResponseParser.convertResourceResponseToJavaObject(response);
+		assertTrue(vf.getName().equals(resource.getName()));
+		assertTrue(vf.getDescription().equals(resource.getDescription()));
+		assertTrue(vf.getVendorName().equals(resource.getVendorName()));
+		assertTrue(vf.getVendorRelease().equals(resource.getVendorRelease()));
+		assertTrue(vf.getContactId().equals(resource.getContactId()));
+		
+		assertTrue(vf.getCategories().size() == (resource.getCategories().size()));
+		for (int i = 0 ; i < vf.getCategories().size() ; i ++)
+		{
+			CategoryDefinition expectedCategoryDefinition = vf.getCategories().get(i);
+			CategoryDefinition actualCategoryDefinition = resource.getCategories().get(i);
+			assertTrue(expectedCategoryDefinition.getName().equals(actualCategoryDefinition.getName()));
+			assertTrue(expectedCategoryDefinition.getSubcategories().get(i).getName().equals(actualCategoryDefinition.getSubcategories().get(i).getName()));
+		}
+		
+		assertTrue(vf.getTags().size() == (resource.getTags().size()));
+		for (int i = 0 ; i < vf.getTags().size() ; i ++){
+			List<String> expectedTags = vf.getTags();
+			List<String> actualTags = resource.getTags();
+			
+			assertTrue(actualTags.contains(expectedTags.get(i)));
+			
+		}				
+	}
+
+	public static void verifyVFLifecycle(ResourceReqDetails vf, User user, LifecycleStateEnum expectedLifecycleState) {
+		String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		String actualLifecycleState = jsonResource.get("lifecycleState").toString();
+		assertTrue(expectedLifecycleState.name().equals(actualLifecycleState), "actual: " + actualLifecycleState + "-- expected: " + expectedLifecycleState);
+	}
+	
+	public static void verifyVfLifecycleInUI(LifeCycleStateEnum lifecycleState){
+		GeneralUIUtils.ultimateWait();
+		assertTrue(ResourceGeneralPage.getLifeCycleState().equals(lifecycleState.getValue()));
+	}
+	
+	public static void verifyInstanceVersion(ResourceReqDetails vf, User user, String instanceName, String instanceVersion){
+		String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		JSONArray jsonArrayResource = (JSONArray) jsonResource.get("componentInstances");
+		for (int i = 0; i < jsonArrayResource.size(); i++){
+			Object object = jsonArrayResource.get(i);
+			try{
+				JSONObject jRes = (JSONObject) JSONValue.parse(object.toString());
+				String componentName = jRes.get("componentName").toString();
+				if (componentName.equals(instanceName)){
+					String componentVersion = jRes.get("componentVersion").toString();
+					assertTrue(componentVersion.equals(instanceVersion));
+				}
+			}
+			catch(Exception e){
+				System.out.println("Can't test object in componentInstances array");
+				Assert.fail("Can't test object in componentInstances array");
+			}
+		}
+	}
+	
+	public static void verifyVfDeleted(ResourceReqDetails vf, User user){
+		RestResponse response = RestCDUtils.getResource(vf, user);
+		assertTrue(response.getErrorCode().intValue() == 404);
+	}
+	
+	public static void verifyPropertiesInUI(List<PropertyTypeEnum> propertyList){
+		
+		for (PropertyTypeEnum prop : propertyList){
+			String propName = prop.getName();
+			
+			String actualName = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_NAME.getValue() + propName).getText();
+			String actualType = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_TYPE.getValue() + propName).getText();
+			String actualDesciprtion = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.PROPERTY_DESCRIPTION.getValue() + propName).getText();
+			
+			assertTrue(propName.equals(actualName), String.format("Property name is not correct. expected:%s ; actual %s", propName, actualName));
+			assertTrue(prop.getType().equals(actualType), String.format("Property type is not correct. expected:%s ; actual %s", prop.getType(), actualType));
+			assertTrue(prop.getDescription().equals(actualDesciprtion), String.format("Property description is not correct. expected:%s ; actual %s", prop.getDescription(), actualDesciprtion));
+			
+			if (prop.getSchemaDefinition() != null){
+				String actualSchema = GeneralUIUtils.getWebElementByTestID(DataTestIdEnum.PropertiesPageEnum.ENTRY_SCHEMA.getValue() + propName).getText();
+				assertTrue(prop.getSchemaDefinition().equals(actualSchema), String.format("Property schema is not correct. expected:%s ; actual %s", prop.getSchemaDefinition(), actualSchema));
+			}
+		}
+	}
+	
+	public static void verifyToscaArtifactsInfo(ResourceReqDetails vf, User user){
+		String responseAfterDrag = RestCDUtils.getResource(vf, user).getResponse();
+		JSONObject jsonResource = (JSONObject) JSONValue.parse(responseAfterDrag);
+		JSONObject toscaArtifacts = (JSONObject) jsonResource.get("toscaArtifacts");
+		
+		assertEquals(2, toscaArtifacts.size());
+		for (Object artifactObj : toscaArtifacts.keySet()){
+			JSONObject artifact = (JSONObject) JSONValue.parse(toscaArtifacts.get(artifactObj).toString());
+			assertFalse(artifact.get("artifactUUID").toString().isEmpty(), "artifactUUID field is empty");
+			assertFalse(artifact.get("artifactChecksum").toString().isEmpty(), "artifactChecksum filed is empty");
+			assertFalse(artifact.get("payloadUpdateDate").toString().isEmpty(), "payloadUpdateDate field is empty");
+			assertFalse(artifact.get("artifactVersion").toString().equals("0"), "artifactVersion field is 0");
+		}
+	}
+
+	public static void verifyVfInputs(String instanceName, Map<String, String> instancePropertiesMapFromJson,List<WebElement> propertyRowsFromTable) {
+		
+		for (int i = 0 ; i < propertyRowsFromTable.size() ; i++){
+			WebElement row = propertyRowsFromTable.get(i);
+			String propertyNameFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertyName']")).getText();
+			String propertyTypeFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertyType']")).getText();
+			String instanceNameFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "instanceName']")).getText();
+			String propertySchemaFromTable = row.findElement(By.xpath(".//*[@data-tests-id='" + "propertySchema']")).getText();
+			
+			assertTrue(instancePropertiesMapFromJson.containsKey(propertyNameFromTable), "No property named : " + propertyNameFromTable + "for instance " + instanceName);
+			String expectedType = instancePropertiesMapFromJson.get(propertyNameFromTable);
+			assertTrue(expectedType.equals(propertyTypeFromTable.toLowerCase()), propertyNameFromTable + "type is incorrect");
+			assertTrue(instanceName.equals(instanceNameFromTable), "Instance name of property named " + propertyNameFromTable + "is incorrect");
+		}
+	}
+
+	public static void verifyOnboardedVnfMetadata(String vspName, Map<String, String> vspMetadata) {
+		SetupCDTest.getExtendTest().log(Status.INFO, "Verifying metadata");
+		assertTrue(vspName.equals(ResourceGeneralPage.getNameText()), "VSP name is not valid.");
+		assertTrue(vspMetadata.get("description").equals(ResourceGeneralPage.getDescriptionText()), "VSP description is not valid.");
+		assertTrue(vspMetadata.get("subCategory").equals(GeneralUIUtils.getSelectedElementFromDropDown(ResourceGeneralPage.getCategoryDataTestsIdAttribute()).getText().toLowerCase().trim()), "VSP category is not valid.");
+		assertTrue(vspMetadata.get("vendorName").equals(ResourceGeneralPage.getVendorNameText()), "VSP vendor name is not valid.");
+		assertTrue("1.0".equals(ResourceGeneralPage.getVendorReleaseText()), "VSP version is not valid.");
+		List<WebElement> tagsList = ResourceGeneralPage.getElementsFromTagsTable();
+		assertTrue(tagsList.size() == 1, "VSP tags size is not equal to 1.");
+		assertTrue(vspName.equals(tagsList.get(0).getText()), "VSP tag is not its name.");
+		assertTrue(vspMetadata.get("attContact").equals(ResourceGeneralPage.getContactIdText()), "VSP attContact is not valid.");
+	}
+	
+	public static void verifyIsElementDisabled(String elementLocator, String elementName){
+		SetupCDTest.getExtendTest().log(Status.INFO, String.format("Checking if %s is disabled", elementName));
+		assertTrue(GeneralUIUtils.isElementReadOnly(elementLocator));
+	}
+	
+	public static void verifyFilesChecksum(File actual, File expected){
+		try {
+			String actualMd5OfFile = FileHandling.getMD5OfFile(actual);
+			String expectedMd5OfFile = FileHandling.getMD5OfFile(expected);
+			Assert.assertEquals(expectedMd5OfFile, actualMd5OfFile, "File does not exist");
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		 
+	}
+	
+}
diff --git a/ui-ci/src/main/resources/Downloads/CP_WAN.yml b/ui-ci/src/main/resources/Downloads/CP_WAN.yml
new file mode 100644
index 0000000..eeabbb8
--- /dev/null
+++ b/ui-ci/src/main/resources/Downloads/CP_WAN.yml
Binary files differ
diff --git a/ui-ci/src/main/resources/Downloads/Fortigate02_vFW_VFC.yml b/ui-ci/src/main/resources/Downloads/Fortigate02_vFW_VFC.yml
new file mode 100644
index 0000000..a24d004
--- /dev/null
+++ b/ui-ci/src/main/resources/Downloads/Fortigate02_vFW_VFC.yml
@@ -0,0 +1,63 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+
+node_types:
+
+  org.openecomp.resource.vfc.vFW.Fortigate02Tedy: 
+    derived_from: org.openecomp.resource.vfc.vFWTedy
+     
+    properties: 
+      att-part-number:
+        type: string
+        default: "ATT-FortiGate-VM02"
+      vendor-name:
+        type: string
+        default: “FORTINET”
+      vendor-model:
+        type: string
+        default: "VM02"
+      vendor-model-description:
+        type: string
+      vcpu-default:
+        type: integer
+        default: 2
+      vcpu-min:
+        type: integer
+        default: 1
+      vcpu-max:
+        type: integer
+        default: 2
+      vmemory-default:
+        default: 4
+        type: integer        
+      vmemory-units:
+        type: string
+        default: "GB"
+      vmemory-min:
+        type: integer
+        default: 1
+      vmemory-max:
+        type: integer
+        default: 4
+      vdisk-default:
+        type: integer
+        default: 20
+      vdisk-units:
+        type: string
+        default: "GB"
+      vdisk-min:
+        type: integer
+        default: 2
+      vdisk-max:
+        type: integer
+        default: 20
+      vnf-type: 
+        type: string
+        default: “Advanced FW”
+      software-version: 
+        type: string
+        default: “5.2.4”
+      software-file-name: 
+        type: string
+      vnf-feature: 
+        type: string
+        default: “IPS, AntiVirus, URL Filter, APPID”	
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/attsdc-packages.yaml b/ui-ci/src/main/resources/ci/conf/attsdc-packages.yaml
new file mode 100644
index 0000000..dcb78ee
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/attsdc-packages.yaml
@@ -0,0 +1,2 @@
+packages:
+ - org.openecomp.sdc.ci.tests.execute.resourceui
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/attsdc.yaml b/ui-ci/src/main/resources/ci/conf/attsdc.yaml
new file mode 100644
index 0000000..c5ed3db
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/attsdc.yaml
@@ -0,0 +1,63 @@
+outputFolder: target
+reportName: index.html
+catalogBeHost: 127.0.0.1
+catalogFeHost: fehost
+esHost: eshost
+disributionClientHost: disClient
+catalogFePort: 8181
+catalogBePort: 8080
+disributionClientPort: 8181
+esPort: 9200
+neoHost: neoHost
+neoPort: 7474
+neoDBusername: neo4j
+neoDBpassword: 123456
+url: http://localhost:8285/sdc1
+remoteTestingMachineIP: 0.0.0.0
+remoteTestingMachinePort: 5566
+remoteTesting: false
+resourceConfigDir: src/test/resources/CI/tests
+componentsConfigDir: src/test/resources/CI/components
+importResourceConfigDir: src/test/resources/CI/importResource
+importResourceTestsConfigDir: src/test/resources/CI/importResourceTests
+errorConfigurationFile: ../catalog-be/src/main/resources/config/error-configuration.yaml
+configurationFile: ../catalog-be/src/main/resources/config/configuration.yaml
+importTypesConfigDir: src/test/resources/CI/importTypesTest
+browser: FireFox
+windowsDownloadDirectory: "c:\\apache-ftpserver-1.1.0\\res\\home\\"
+systemUnderDebug: false
+reportDBhost: dbhost
+reportDBport: 27017
+
+useBrowserMobProxy: false
+captureTraffic: false
+
+titanPropertiesFile: src/main/resources/ci/conf/titan.properties
+
+stopOnClassFailure: false
+
+#List of non-abstract resources to keep during titan cleanup between tests
+#Only 1.0 version will be kept
+resourcesNotToDelete:
+     - tosca.nodes.Compute
+     - tosca.nodes.Database
+     - tosca.nodes.ObjectStorage
+     - tosca.nodes.BlockStorage
+     - tosca.nodes.LoadBalancer
+     - org.openecomp.resource.cp.Port
+     - org.openecomp.resource.vl.Network
+
+#Resource categories to keep (including all their subcategories)
+resourceCategoriesNotToDelete:
+     - Generic
+     - Network L2-3
+     - Network L4+
+     - Application L4+
+     - Network Connectivity
+
+#Service categories to keep
+serviceCategoriesNotToDelete:
+     - Mobility
+     - Network L1-3
+     - Network L4
+     - VoIP Call Control
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/credentials.yaml b/ui-ci/src/main/resources/ci/conf/credentials.yaml
new file mode 100644
index 0000000..481b12b
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/credentials.yaml
@@ -0,0 +1,48 @@
+    designer: {
+        username: m08740,
+        password: 272v!suAL37,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    admin: {
+        username: m08741,
+        password: 863B@rroN27,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    ops: {
+        username: m08742,
+        password: 364K!NDRed63,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    tester: {
+        username: m08743,
+        password: 373m@rBLE28,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    governor: {
+        username: m08744,
+        password: 742M!DDLE44,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    product_strategist1: {
+        username: m08745,
+        password: 824S@Nder35,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    product_manager1: {
+        username: m08746,
+        password: 747ICK!Y99,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    product_local: {
+        username: m08747,
+        password: 623z!Ggy75,
+        firstname: ASDC,
+        lastname: VITI
+    }
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/credentials.yaml_prod b/ui-ci/src/main/resources/ci/conf/credentials.yaml_prod
new file mode 100644
index 0000000..481b12b
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/credentials.yaml_prod
@@ -0,0 +1,48 @@
+    designer: {
+        username: m08740,
+        password: 272v!suAL37,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    admin: {
+        username: m08741,
+        password: 863B@rroN27,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    ops: {
+        username: m08742,
+        password: 364K!NDRed63,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    tester: {
+        username: m08743,
+        password: 373m@rBLE28,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    governor: {
+        username: m08744,
+        password: 742M!DDLE44,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    product_strategist1: {
+        username: m08745,
+        password: 824S@Nder35,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    product_manager1: {
+        username: m08746,
+        password: 747ICK!Y99,
+        firstname: ASDC,
+        lastname: VITI
+    }
+    product_local: {
+        username: m08747,
+        password: 623z!Ggy75,
+        firstname: ASDC,
+        lastname: VITI
+    }
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/credentials.yaml_webtest b/ui-ci/src/main/resources/ci/conf/credentials.yaml_webtest
new file mode 100644
index 0000000..ab37f7b
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/credentials.yaml_webtest
@@ -0,0 +1,48 @@
+    designer: {
+        username: cs0008,
+        password: 123123a,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    admin: {
+        username: jh0003,
+        password: 123123a,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    ops: {
+        username: af0006,
+        password: 123123a,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    tester: {
+        username: kb0004,
+        password: 123123a,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    governor: {
+        username: ah0002,
+        password: 123123a,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    product_strategist: {
+        username: m99126,
+        password: 1910-FruitGum,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    product_manager: {
+        username: m99127,
+        password: 747-Airplane,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
+    product_local: {
+        username: pm0001,
+        password: 123123a,
+        firstname: ASDC,
+        lastname: KASPIN
+    }
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/extent-config.xml b/ui-ci/src/main/resources/ci/conf/extent-config.xml
new file mode 100644
index 0000000..ab04b26
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/extent-config.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<extentreports>
+    <configuration>
+        <!-- report theme -->
+        <!-- standard, dark -->
+        <theme>standard</theme>
+    
+        <!-- document encoding -->
+        <!-- defaults to UTF-8 -->
+        <encoding>UTF-8</encoding>
+        
+        <!-- protocol for script and stylesheets -->
+        <!-- defaults to https -->
+        <protocol>https</protocol>
+        
+        <!-- title of the document -->
+        <documentTitle>ASDC Automation Report</documentTitle>
+        
+        <!-- report name - displayed at top-nav -->
+        <reportName> ASDC Automation Report </reportName>
+        
+        <!-- report headline - displayed at top-nav, after reportHeadline -->
+        <reportHeadline></reportHeadline>
+        
+        <!-- global date format override -->
+        <!-- defaults to yyyy-MM-dd -->
+        <dateFormat>yyyy-MM-dd</dateFormat>
+        
+        <!-- global time format override -->
+        <!-- defaults to HH:mm:ss -->
+        <timeFormat>HH:mm:ss</timeFormat>
+        
+        <!-- custom javascript -->
+        <scripts>
+            <![CDATA[
+                $(document).ready(function() {
+                    $('.logo-container').prepend("<span><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAB7CAYAAACFKW5jAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABaAAAAWgBwI7h9AAAAB3RJTUUH3wwXFAQf1clFIAAANNxJREFUeNrtnXeYXVXV/z+n3To101ImvZFGQiCANKUoSBEFebEj1hcb2MWC+lpAbGD5CaKoiL2ggIgoRUIgQAohJCG9TTLJ9Dszt52y9++PfSeZTO6duXfmTkk4n+eZJ5Nbztn7zNnrrL32Wt8NPj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PgOjjXYDhpX7WgkZMD2qY2qQFtDlSkSvjlsaGJpGUIeQAS1pyb60hMurRrv1Pj5jFnO0G1As9PvbmBiEDkeS8CSmpuEhCOi6FTW0sAYhiTRNTTM8JBoaGmDpSEODoK65EQM7YpLCCCVC97ciAUODuSU6UpO88Jpxo91NH58xwTHtcSx6vJ2DKUlTSlBVVqKVesnqlrSosaWcFTa0eXFX1nmSmrChjTc1qoCIKwlJ1W8NkDoITUPokAQ6U0I2uYL9FZZ+UNfYnvDkhoWlRnNdhIMP7HWcsqDOonKDsK7znzPLRvsS+PiMCsec4VjwWDvNaUFTh8eS8VbFvpSc4Qh5esJjKbBASDnDlZTqGmEpQQ7yPLoGSGxdIx4xtEZbyhdrA/pGIVk+ParveEt9qOH69d3i1AqTcbg8eE71aF8aH58RY8wbjresjbGiCTzpsb/JYUF9oKwpJZekhLzQkfJMIVnkCMoBY7BGIl90DQyNeEjXdhsaz4UN7V9TwvozK88p31Pzzza5uNykOqDzh2Wlo33ZfHyGlTFrOC58opMGT9DuCG6YGdG/ty0xxxby4pTgEkfKpa6gYrgNRX9ogKHhBHVta4WlPR4xtPtmRPXn/7U73XlGfYCoAf8+o2K0L6OPz7AwJg3H/Mc6aEoLFpUawe0J79RuV76525WXuYLpYrQblwUNCOh0Rk3tuQpL/119WHv4yS3O/lNnBji53OQnS6Kj3UQfn6IypgzHOcvb2ZWQnFRpWavbnDM6XfmelJCXOIKq0fQuCsHScKOmtqbE1H41K2r89Yl9qQPvmh3hnqX+9MXn+GHMGI4TH+vgX2eEtLOXJ09sscUHEx5XOUJWHysGoy+mhltmas9OCOl3/E998O9rO9yub82PMLf0uFkB93kFM+qG44HGNF/dnCSoU7s9Lt4bc+UHUp6cdqwajL6EdS01OaI/eOY469t3nxR9PuFJGTX10W6Wj8+QGFXDIaUE0M5d0XnW+k73pg5HnutJjNG+KMVG12Ba2NjzwWnB2z89O/xLDdoANG3U7baPz6AYlUeflLLHaES++nLius1d3m/bbHnB8Wg0AISEnXFvyv0H7Fu2x727gaU918HH51hkxA1Hr8EyrdkW31vZ7n67MSXqj/chJDXY3O1Zrba8HPgN8DYg2MuI+vgcM4yo4eg1QM4B7m1Kyw++2OlFRvsijEznoTaoMyGkA5wA/AT4IlDR59r4+Ix5Rsxw/L4hBWAAbwF+AZz5SprhmzpcPSnIpNChS14GfBa4HZjSYgu+uTkx2s308cmLETEc5yzvoMrSw2khrwN+AMwAmBrROXPc8b88qQNXTQxy3bQgxpHW0gLeCdxZFdAXfn5jguWtzmg318dnQIbdcLz26U7Chla+KuZ+xRbcAtT0vBc1NL4wJ8yp48zBV6ONZSSUmxrXzwzx/UURaoJZL7cGXPTPg/Yvrq4PvursPzT50xafMc+wGo4LVnRQH9LKG5LiyxNC+g0lpnZU7vXicpO7TyrhqkkBwoZ2fBgQCRFD47xai7uXlnDz/Ah1wf4v9ZOt7ikr2pw73v+qstO1n+z3jYfPmGbYwgyvf6aTqREt+uAB58uTw/rH/rSsNNhrfn8Una7kvkabn+5KsabDJeUNdwuLTGacjwtonFppcs3kIBfWBai0Bu5AhyO58rkuHm92mFFirHltrfXedTH3hWfOqRjtXvn4ZGVYhuWtWxK80CmsZ9rsT+9JiC9+bGYo/J2F0bzcm4NpwWPNDvc12qxsd9mXEoieyraxZER6OQSllsacEoPzqi0uGW+xtNyk1MyvsRL4xZ40H30xTsKT6BrMiBj/vaQu8J7tCXfHg6eXj3ZPfXyOouhD8SMvdHLj3BL99c90XrM17t2edGXpdxZG+OSscEHHSQvJ1m7Bs+0uT7Q4rIm57E4IEp7kCC9+JIxJn/OFdI1JYZ1ZUZ1lFSbnVFssLjOoCeoFN+fxFof3v9DN9m5xqC+mBnNLjL9cNSn4walhvfXaqaER6KSPT/4UdUlDSon221bWd3WdtyfpfS3pSVUSOojBHdQ1FpYZLCwzuGZKkH0pwY64x/pOj7Uxl21xwYGUoDktSAiJK6CYYQFNU0uoYV2jOqgxKaQzM2qwoFT9zIoa1Id1FZcZJI81O1y/Pn6E0QBwJWxPiDf+p9nZ8+mZoS883+4ml1Ue/6tPPscORX1ev3ZFDFfI2eu7vN+12PJkACR8dk6Ym+dHinYyiYoLtNmCVluyJynYkxQcTAmaMq/FHElaSBwJXsagmErBK/OvRkCHgK5haRDQIWRolJka5abGuIDG1IjBlLBOVUCjOqBTbmlF6UNaSP683+amTUl2xL2cf4VKS+u+bHzg479aWvJzQPq1LT5jhaLdiQ812fx2T7r0v63OHftT4m09gxUJ59da/PXUUsrynPcPlZQnSQpwhcRD1YqAKjbTAV3T0FEehaH1/CgDMtzsSgh+uCPJz3eniTmy37+ABiwsM3Z+aW7kf66aGFjlGw6fsULR/N/X11jaFzcm3tmUFld6fWICz7e7PN7icPn4wIh0KmRohIzMyccIHY7k/gM2P9ihVo1kHs2TwM6EmL4z7n0RuFZK2e4bD5+xQFHyOKSUfH5jYv7BlPh4WhDs+36nI7llS5It3d5gDn9ME3PUtOStq7r433VxVre7BaWqdDuS3UlxkSO4llGqZvbx6UuxbsRQxNA+1u7IWVnf1WBlu8snNyTYmxyLqqHF50Ba8Ku9af5nVRfXrOnm4YMOSU8OygnalxLBtJAfBZb4iWE+Y4EhT1UyN/IFC8uM/xnolv7HAZuPAN9eEGFOyfEnvZEW8HKXy0NNDvftt1nX6WJ7HN7+aZBICbrGNOB64DopZcKfsviMJkMyHBmjUQVcf3qlWbGk3OCZVjfnIJHA/QdsmtKCr5wQ4fwaixGKlw4bnoQ9ScEzbQ4PHHBY3uqwLyVUZ4doMHqYEtYJ6RrAG4G/PN5s3z/a/fZ5ZTOk2zpjON4P/BAIPnDA5n0vxGlKif6PLKEmpPOeKUHeOzXI7Oix5X2khVoCXtPh8Z9mm+WtLjsSHk6Pd1FEgrrGL5eW8JZJKrAsJI90OOLqXzekO26Y+cqQMvEZewz6Ns8YjQnAfcBpoJ6+9+xNc+PGBAcHMh4ZTigxuHpSgCsmBplXYmCNwfCfI6HdFmzu9lgT81je6rA25tGQ9NRUZEhXsh8kLKs0+ftppT0CQOxLitSdu1Mf+sbWxC/EG2qGeAIfn8ExVMPxQZS+xqF1Vk/CAwdsvrgpwYZOb+AzZFz6yWGdc6stLqixOL3SHHJW5mAREuKepM2WbI17bOzyeCHmsibmsjchaHN6bUg7zM0L6Ro/PjHKtVODh061Nuby4RfjK84cZ17+7QXRVj/W4TMaDCrGkTEa1cDb6WU0QCVTvXFCgFlRg1u2Jrmv0Sbh9rOakHl9b0Jwz540v9+XZmJI56Ryk6UVJovKDE4oMai0NEpMjUiRjIktIOFJ4p6kOS3ZnfTYHvfY1i3YFvfYnvBoSUs63SyGYgTGqga8tT7AVZMCR5zuYFqytds7pdLSzr9xY+KPw98SnwLp+XMd18tfgxoCpz3Zwcqzy98M3APkrF7rdiV/O2Dz4x0pVnW4uCLPM/a65BFTo9zSmBDUmRLRmRDUqQ3q1AY1qgIapaZOqan0L/Q+9R62kKQ96HKVAYi5klZb0pxWaelNaUFDStBqC5KeMiSMdAFdDi6tC/DjxVGmhI+cu31ra5IvbExwQqnxt1sXRt92SV0gOXqt9EEJUy0CFgNTgCjqzkkCDcALmZ+m0W5oMSnY45BS8udGO5ry5NUhQ+u35LXE1HhHfZDzqi3+2mhz7940L8Rc0gMFEXu9l/AkCU/SmBSs6Tj8uqEfrjnpSSXv7bXLjA0QEjzAkxJPcrhEP8f5RjXZVIKlw5snBbl5XuQoo9HpSh5rcfAkHEzLs//YkF4spFypj73pylnANeTOE4qjAupbBzjOFcAlo9D+DuA2YG8/n5kEvBV4MzAfKCH73dMNbAR+B/yW/AxIFfAZlFc/0vwX5RD0S8GG4/vbkzzR6i4bH9Bee1aVldd3JoZ0PjI9xJsnBHik2eEP+2yebXdoTWce7/nc930+4x0qXivQIxxzYyyDhPEhnQ/PCPGh6SHGZSmc+W+Lw8o2tdzd4YhxOxPiMg1WjnbT+2AC1wLvGeBzu4DvDfCZU/M4znDQDPya7IZDQ6n0fw04k4GTKEsy/VgKXAx8HliVx3feBtSPQt8FeRiOgtcw6sO6tqXLu+jZdrdghZnxIZ13TQ7yh1NK+PtpZXx+bpjTxvUSvTmuZ4U5kFBmalw1KcDvl5Vw4+xwVqPRlBb8YEeKTkddJE+i7Ut5F/xkZ2qsLa1MQw2sgbgYGGgn7tGqUXDIfTe+Dvg5cDaFjR8TeC1wF5kNuQbAHaW+53XNC/Y4VnV445psce7L3R5CZTQWTImpceY4kzPHmdwwQ/Bip8cTLQ6rOlw2dnkcSIvDy5wwdr2EwZJZSaoL6rym2uTt9UHOrbYoyZENlxZw+44UT7Q4h66FBNpsuWBlu7tESvnvMbS68mpgah6fOwkVF3hqtBtcADOAbwIzh3CMJShv5RqgZbQ7NFgKMhxSSi5d2XWiLZi3ocuj3ZFUBYZ2w9YEdc6v0Tm/xiLuSfYkBC/EXFbHPF7qVII9TWml/OX1jU+MmbEy0IU7/GvU1JhbYvC6WovLJwRYUm70ZIVmxZFw1+4UP9qRwu3zDOz2ZKTZFucD/x7tLmaIoDyJfOaw44CLgBUcG76mAbwbNfD7w830p79rcAFwGWp/oWOSgj2Odke8KunJ0p78hvNr8otz5EPU0JhXajCv1OCt9Wo1pNVWS6Uvd3lsjwt2Jz12JQSNKUG3K0l6kBIy96030salTztChlr9mVdqsKzC5Owqi5MqDMYHB/Zy0wLu3JXiKy8n1BSlT19cgbY/KZa91OWVA7ER7mk25gJnFPD516HygMbaikO2u6YOuJzc05O9wN+A9aipzhzgysy/fQmgAr9/AHLtwjVaj8W8zluQ4eh2ZUBDe5WUELMlv99nc1aVRR5jYFCUmhqlpsa0iM6rM4HYlJDEXYi5ksaUoCEp2J8SHEyrn6a04GBaJXAlPUlSqFUZZ5hny4aupmAlhkZtUGdmVGdeqcGiMpOFpQaTwnpBQkZtjuS27Ulu256iK4fgj1QrRgufb3enoG7Y0URDGYLaAr6zABU4fDDH+w65B1Y2LLI/6QWQJj/Ppmcpta9/Ox8Vv8lGM/BR4IE+3/s3Ksg6Kct3FqKCn1uyvCcz/U7m2WYdCJJ90DuZn3zQADufDxZkODQYb2rMEJn//L0xzVsmBYrqdQxESNcIBaAqoDEjcqTFcgTYUmILiLuSFlvSYgtabEGbncnhyEgLdjoqt6PLzUgMCnCkxJXZtUsNDayMzGDE0KiwlCcxIaQzMaQf+ndSSOWZRA3lbQyG9Z0e/7c5wd8bbZyeYrkcpDwqyi1toZRy/SjHOcpRU49sj5Fu1I3d90aJoJZb/0n2oNwfgLV5nl+ilkffkuW9PcD/AW15HiuV+U5vJpM7mPtQ5qevsfkvagn201m+U0luw9GCqoTOtxipFvgy2Q3Ub1CeUD5owM58PliQ4Qga2vSpEX0KLeoUzWnJzVuTzC81DtVSjCaWDhYaUQMqLY36MKip6WGEVMlhQspMfgekPUlKQNKTpAXILEY+oGvKaBlKwNjSD8sNDiZAnI1OV4n+fHdbko35pOsDZaYWmBU1lgC/Z3RjBUtRAc++eMAvUUHTRVnePxeVOJXtht2U+cmXE3O83okyTgeG0L8w2f8iHvAI2Z/qAvgPyhvpK1UfILdhSFBY3Koe+DjZDccG4O9D6HdW8jYcmTTzBadVmtF796bp8TqeaHb45pYkN8+P5FwVGEvoGqh4bq+2jnK7XQkr2xxu25HioQOFCf5MDutMi+jzUDdhfJS6oKO8jWxL9C3Ar1BP8WyGYwZqaTOvJ90Q2jdU7Zl0jtcFcLCf7+WaJLvkOS3Is3+5GBZ5/ELdhPkX1lra3FLj0LPNA362O8XXtyTpco+F4PjYQUhY3eHy0RfjXPV8N3/ZZ5MU+RsNTYMl5QZlpjYDKBvFrtShchSysQp4CfXEzxbAtVDTlWJsHpPrBtQZerAxRvaBbgCz+vnePDhaThM1fWsuQp9BGa/++l50CjloGJg5I2rw3inBI8rfU0JllH755YSqHvXpF1eqKtcbNyZ403Nd3LEzxYF0fjIEvSm3tJ74Uh2FBSWLzRmoFZW+COBfKG9jTeYnG2cCs4vQjly6lMWQVNpDdsOno+IqdVneOxGV+Zrt3Ps4Oo4yWCRj2HBUAHUa8O4pIS6sDRzRVFvAj3akuO6F7lekKHE+JDzJ8laHD63r5rKVXdy6LcneROEGAwAJZ42zWFJugjLqkwZxlGLQ4zFkq1tqRAUIQQ26B8nuuo9H5TYMlVyGoxgex2ZUvCAbZwEf43CluI6K3fyM7HEfULGPjiL0GTJlWf30vegUctByMkU3VQGNr84Ls7DMOMJ4OBL+uN/mHau7efCAjfPK0CUekIak4J69ad62ups3PdfFXbvS7OsRbR7k7Rw2Nd45OUipqZEWMrSy3c0nW3M4mIYKfGbjOQ6vGkhUEHF/ls8ZqBjJUKdbw+lxdAJ/JHsQ1AQ+hMrbqEMVqN0DLMtxrPWoZdpiPWFHfKpSSOCkDLWEBMDScpPvLYpy3bo427uPXAF4vt3l3Wu6efvkIB+eHjouhYkHIuZIVnW4/KvJ4ZEmh03dxREuBkDC62stLqpTq5vb48K4ZWuyLiEkkWIt8eTPa1CrIn3xgIdR05QetgJPonRc+nIKKni6YghtGU6PQ6LU7q4mu6GsAG5GTUFOJffY2g18FlUxWyxGfKpSiOGooM86/GtrLH6wKMr16+Ns6208NGh1JD/YkeLRZof3TA1x9aQAk8bAku1wEvckW7o9Hm12+GeTw+oOl5jdqwK4GGNawpSIzqdmhQ8llD3V6vBsmzsupDaoG0k/LwxcSvb7qAFY3ue1NCpJ6kqODoZWoryOpxn8snJ/+cPFuPoHgFuAE8ge05hK/3U661FG4+EitKVvv8es4ajM1oiL6ywiRpRPvpRgTcfRCucbOj0+syHO7xrSvL0+yOUTLKZHjh8PpMuVbO72+G+Ly2MtNms6PA6mhUoiK9bt2ouoqfG52WFOy2xCnfQkDx100DRqV7d7AY58wg83C8jozWZhJbA9y+tPoeIFi/u83pN5+gMGv9ownB5HD0+jvIW6Ar7johLEvgS8WKR29O33mDUc0VyNeE21xT0nl/ClTQkeOGAfWYylqSSrVe1Kt/Onuw3eNCHApXUBFpUZx0TuR2+UiI5gQ5fHilaHFW0uL3Z6NPc2FjAslQaWBh+eEeLdU4KHks7WxjxWtLlEDMpXxdyR3tL+tWRfzXFRy6/Zli8bUSstJ2a5SvNRbv4/Btme4Yxx9PAqVLp4vhwEfgz8P6C1SG3oy9j1OJrSIloTzK01taDU4K4lJdyxK8WPd6Ro7Ktyrqm8hU2dHpu6kvx0V4qlFSavrw1w5jiTuaXGiG1KXQieVBmd2+IeL8Y8VrSpKciOhCqyY5iNRQ+WBh+YFuLG2eFDIs4pIbl7T4qWtGBaVA82pcVIzgUrUZWw2Xq9m9yxCoFaXXk/vWJmGUqA16MMy2D0KIbT4wijYjM3ouQC82U5SrCov+S8bHUmWqY/NgNP3cau4bi3IV37jvqgXttPRVtVQLnRZ44zuX1HikeanKOFijO/t9iSRw6qwGFtUOeEEoNXjTM5rdJkYZnBhKB+lI7ocONJNRjbbMmOuMembo+1MY91MZedCXHYq+jVj2GvYZQQNuBDM0J8cU6Eil4iP/886PCX/XZPM4wRaE1vlpI7xXsFynjkYh3wPGpq0pfzUEvL/X2/n6uVlaF6HJUog/EhlOddCK8D3gXcSXbDthRVZ1KSpc0vomIiafpnIMOhUeRyhLwNx0MHHX121OCyAXacNzQ1dVlaYfLgAZuf7U7zTJtLKlsadeb/TWlBU0rwZItDyNAYH9KYHjFYVGYwt8RgWkRnWsSgKqDqRYIGBLTBGZWeQri0p4KZB9OCPQnBrqRge9xjc7fHnoQqjGvPthXCSA5NCXUhnU/NCnHd9BDRXkVz2+IeX9+SpMOWPdNBGfdGLPlOR+VuZFs+TaOCf/1VZHaigqQXcPQTsScFfTCGo2eu3/evNBSPoxK1WvJeBpe+XYaKbexGxTl6EwA+ALwhx3e3kp/nJRjhPI68L8TBtLAfOODw+rpAXqUdZabG2+qDXFgb4OEmJVT8dJt7SPoulxFJCcmuuGRXXPB4s1K8KsmU15ebGnUhnbqgRpWlUxXQKLNUKXuJqR3RLg9whTpetyuJe9DhqCrZNlsZjGZbEHeh25Mk+6bLj4ah6CGjrPaqKpMvzInwulqL3oW2bbbkpk1J1vYKRnsS1xUjVuQ2ETg/x3s7UQHEgfgPKnNyWp/Xgyij9CcGftL2JZfhGKzHEUZ5Gv0ZjRZUwPfUzHXJxgTUakwjR1b7LiC30WhGCRznk+sxdqcqpkb838223NAV1BaX5W94qwIab68Pctn4AM+0udzXaPNYi8OuuHc4QSyHEemh25V0O5JG4OWuo6+jnlE813p9USJ79CoQ/V3W0TQQfcm0cWpU592Tg7xvWoj6PkvYcU/yrW1J/rw/fUSXBHRPCGkjpVOZK8Uc4AnyS6XeDDxGdjHiM1H1HxvyOE5vih3jeBNwHbnHyUvAF1BG8ApULCNX/GMR8K1Mfxsyr12Eyprti4fSNc3HAMNYNhwBXduzJ+m59+61rYXzTQqVmigzNS6stTi/xmJvUvB4i8M/Dtisjrk0JMVhWcABNm7KhpBgD6R4PhYMQy4yzR4f0nnDhAD/Oy3I4jLzqKlYypN8d1uKH25P0bckKOnJfcsqzZFYig2gcjeyFW45KKOxkPz28NuMcsX73oeTULGOQg1HrgE0GI9jMvAJjo499LAWZVSezfz/d6j4x80cHfTt4Xzgq6gS+HJUPku2dq1AbR+Rb/Xs2F2OnR4x9u+IC/c3DWnryokBTq8c3MqfqcH0iM70KUHeXh9kR1ztxfpYi8MLMY/dCXGkFOBYHvBDJeNUT4noXFwX4JopQU4uN7Pun9vlSm7ZmuT27SlVQdsLS4fqgN68LuaORPLXdFQMIhsmKt36E3key6SvYIqiJ4byC1QVab7kGkCD8Tgu5+hckx52ATdw2GiA8hLuRhmPr5Ld4OjAO1Bp92Vk1y9NAneQPTU/F2M3OPrxmaFYY0p0PdnihL+7LcnPTyoZ8vJpUOeQxui1U0M0JAWbulye7/BY1eGyucujISWUPsXxYkgyxqLM1FhcbnJxncWldQHmlRo5vbiDacHXNif52e4U6SymIaRr4txqs/VjM8JcP/w9OI/c+31oqAzjYnAyyr1/poDvFCuPowS11JxtfLiovIzlWd5zUPkapcDnyC4VEOCwIlg2o7kJeLzAazV2pyqnVZqxyycEmp9td2ofPODw891pPjYjVPCUJRdWjycSCXBxnRLqbUh6bI0L1sVcNnR57Ih77E4q6b+UJ4+W+BuLRiXTRkOHSktnQanB2VUm59VYLC4zGTeASvyGLo8vbkrwQKOdPUomoT6kpy4dH9g1AtKB/Q2oYlMNXEjhhiOXx1EItSgdjWw0oVZHcg3UFPAdlOdxPX32Vs4QzPHdNCq2Uah489idqgAdb54YaL6/0ea/zQ63bk0yp0TnkrpAAYfIn6AOM6MGM6MGF9VaCAntjtIM3ZUQbOry2JXwaEwJ9qWUYHGrrfRD7VyXcTjHVZ/zBQyosHRmZ0SLT64wWVZhMiOqNtAeCEfAPw7afOXlBOtiuWUEdQ1eV2slLqix9g540KEzn9wp5sPBhcCPyH//kWLlcZSTO07RRP+KX6CSvb6BUmX7IPmPs3+gYiWFTjlHvKy+EMPRNSWs7/7YzBBrYy4HUoLPbEgwztJ51bjhfwDpmlqhqQqo3esvqlX1drZQmZ2drlI835sUHEgppfOmzJJrU1qJFic9JUjsCCWm4wglTlzw7C+zV62pKy3SoK4EjCeGdKZFdGZGDeaXGiwoNZkc1hkX0Aq6a3cmPH68M8Uvdqdps/tRBJMwOapz9aRgU8TQBrqZh4qGGsgjuZ/pIlTVbL5FYcWKcVj0e9XzIsbhxK53MvAAPgB8F2gf5LUaiTqdQxQy4iWw+ZI6i/dPC/H9jKDuR9fHuWNxlFMqRrpMQhHQoTqgUR0wmNGneM6VaiUiJSQpT+VrxDLq5j0q5zFHbZ9gS4ntKU0RL4vMuaFphA2lsh42lGhxmalRFdAZZ2lUB3XKTY0SE4KDTHeNOUqs+Ec7k6yLeeoO7edQmgZXTwxySoW5A5VUNZz0bKCUrUVp8pfgz9oV1NO577GjqCDpI+T3FO7P1yzkj5Ikd/5EBdlFi7LRisr8DKFWUPobJLsYeBPugfqejdH1ODRNQ0r5UlDX7E/NDAU2dXk8dMBmdbvL/66Lc9vCKGdVjY7xyNm5TPJYyZgMfhwm7kmebHH4ya40/25ysmfZ9kXCnFKDa5WM4yYK239kMJxC9uIuG7Ut4vMM/skWROVDnJzlvXNRwdh8ckP6C44WMoC6Uepc2aYrFaiktYY8j3UQ+CkqqNxfjcti4COo5dzBLKuPTcORYSvQOD6kT/32gggxR7Ci1WV1u8t71nbztXkRrpyYX2apj0pse7zF4Zd70jza4ijtjjyfjRFT45OzQswtNWzgBYZ3awQDVXyWLcV8F0rFfDAp4r05EVW30bf3s1HSfL/N4xjFyuNoz/Rnepb3ylGJYc+RX57FKcBXgKoBPhdGLWN3A7dRuAc3ZqUDQVnZ7QDzSw1uXxTl5Ew+x9Zujw+t6+abW5JqXu6Tk/0pwa8zUoLvXN3NX/fbxJw8vIwMGvCW+gBvqw8CtKcFw70Z00Rya4I+g1K9GipPkn26FUBNV4J5HKNYqwud5N4ISkeloL+H/h+8Zqbdd5P/zvYlwOdRe9QWIlozpjVHQVnDQ8tjJ1eY3LWkhFdXW6CpGoqvb05wzdpunm5zEb79OETCkzzX7vLVlxNc9mwX73uhmwcabWJu/gYDAKmKCL80J0JY13iyxdl/w/p4sWT2c3EW2Xdod1Dp1sVIdV8PvFzg+fvSXxykkHtdoAKyXTneL0dNzz6BynLtPciDqCnXt1EJbIsojArg68BVFHZnjNngaA9PoebTEYCTyg3uOinKjRszWxYKeLDR5oWYy3unBHn3lBDTIsNi9MY8CU+yMyF4qtXhHwcdnm13aVJbxQ0uCVrCSRUm310YYVpEZ1WHy81bk+v+tTmV73LlYOh54mdLZtrDkdmTQ6EN5XVkW+7tSUEfSKezv+BooTfhSlQtzeU53q8EvobKBH0eZfQqUbKCp5G74I1MG7ei0tqzBVprgVtRD+oHyY+xG+PIBEjXoZSrl/S8PjtqcOfiEuaVJPnRzhQdtqQhobId/9po8+4pQa6aGGRy+Pg3IDFHif482ery72aHlzpd9qcytThDKaiTsLDc4EcnRjmp3KQ5Lbh5S9Le0OU9EqwLuIWWkRbATNQTPxvPoWIcxUCgMiav4+h07Z4Yy6/I7QX0HCMXhd58ncD3UTGKXFtPBFAeRaFexUvA+1Cxkk+QPUlscub8CZQBy+f6FaPfeTEYj+Mgaq+MJb1frApo3DQ3wsIyg1u3plgTU1OV9TGPz25IcO9emysnBrhsfIB5JUbWeoxjkbgn2Z8UrImpNPnn2l1e7vaOFv0ZirMo4eRKk9sWRjljnIkj4Ac7UjzR6uycV2o83XB2xXB2MVeKuYfa33Qoy7B9WQtsI3sNx6moMvSV/V+pomZQLkd5FbdQvFT6nagVpOdQRX4VKDW0bDGNWcDtqJjKcwP0e8wbjp7dud5LnyeDpcPVk4KcXGFy2/YUv21I026rJKu1HS5rYy4/3ZXi3BqLi2pVoVx9WD+mVmE6XaXlsbHTY3XMZW2Hx0tdLo0pSbq3kE6RVC414Nwai+8sjHBSuYmQ8Mu9aX60M0W5pT16UXVw71D2ExiAKKoSNttNvZfC0sHzoRk1FV6S5b1xKDWtZ8ltHIo5Vek53t2ZY97E0Da9kqjB/3kO16LEUCI/JcDbcrRxIapS9n2oOFB/bc3G2DAcmenKs6inQ9YqyVlRg+8ujHJxXYAf7kjyeItDOpNOsych+NXuNL9vsJkW0TljnKrbOKXCZEpYyQWOFWwBLbbKSN3QpSQEN3UrlbCmdB/xn2IrmksIGWrTpS/ODTMlrKuNPRptbtqUICXoPiGk/21n0hvOitglwOk53lsN7Cjy+TyUW/4Bjnbfeypmf0JuFXRJdiNnUNgqRW8c4C7U9PwzqH1k8k0A62E/aoOmn3L05totqIK4EuCNOb5/Kqqw7v0oL6UQ+suCHTSDzdhq73bl/WFDO9PQslu0oK62Tji90uS+Rpu796RY1XF4U6K0kGzu8tjc5XFvQ5rxQZ0Ty0xOrTQ5vdJkdonB+KB2SJh3OJFApyNpslW6+ta4qoXZFvfYmRDsSXh0uZIjitaHYeuD3g2aEVV7p7xzcpASU0MCf2+0+eRLcQ6kBOND+qolZdbzdywpVAKzIKaSe6XjTxRvt/XePIcKCGYLLnZlXs9lONpQXlCkz+tphpZZK1ECRS+i0u6vQsU+xtNnr6FeJFCKX4+jCteeJ3c26j7gk6iM1Z7ckd5ygE6mDZeg8kv6JohJVFVttmncywxDjs+gbn0pJbdsSS4+s8p86Kwqa2I+BzmYFjx00OHXe9M81+4S73la9/5yZrUhYmhMDuvMiOrMLzWYX2oyI6JTG9SpDmiUWxpmRnN0oHMLUEpgUq1yxBxJW0ZCsCEl2BH32BEX7EkKGlKCgymlB+L1NRIjgVSJXZeNt/jkrDDLMmn8noQ/7U/z6ZcSNCQFloE3t8T4yEuNyTt4+8QhnrRfguQeGP2lZQ8FDbWCk8tDSJF7+dfIfLfvX0xmvles9oZQ8Yc5KI3U8ahSeoHyIPagPIvdqOBxvnGg3tfbI/v0I5fqeYjcMgBFF3ga9JCI3t8SvGJS8Ccfnxm69qTy/B2XNlvydJvDn/crCcF9SaHyPbL9qXsaqamNiKosjXEBncqARnVAoyagU2YqvdHenokjJEkhibtk6lFU5WwsU6PS4ajfU57kKOGwUdIYNXU4rdLkuukhLh8fOLTfTMKT3Lkrzc1bEjSnVc5HpaWtP63SvOT2RaV755YeJ1HmY5+eO+cVkb00+GFy135OnxM5a0bU+MvXTgjXzogWNoV0BGzu9ni0xeGxZofnO1TF7VHbD/RmIN3QfD47tF4XF6nK70+uMHlHfZArJwao67X9xL6U4Ftbk/xsd1rFUzSwdLy5UeNzvz+57DsLK46fHfF8ji2GNITu3Jm07tmb/t7EkP6R7y6MDjpPI+FJNnV5PN7i8Eyby+qYy/6kyC1mfCyTMWhllsaZ40yumhTk4jrrCIMhJDze4vDVzUlWtDpH+KuTQvraC2oCb6gL6g23LowUdm4fnyIxpCF5yTMxrpgYXHTXrtR99WF95m0Lo0waYpJX0pPsTgqebXd5ts1lVYfL9oSn6l+OVfnATLutjDjR+TUWl45XO9iV9lmLbkwJ7t6T5ic7U+xLHrkbXoWlpS+osT72p2WlPx0BtS8fn5wM+e6TUmq/3pv+1Pe2p745Oayb318YYWaB05ZcCAltjlp9WRVzWdXusr7TY19K0GqLI6UDx9I46tWusKkCvadVmpxfbXF2tcnU8NH6oklP8kizw/e2pVjR5hyZaYrSAXldrfXgh6eH3vly3O24fobvbfiMHkMebq6QGBoT/rjP/sPnNyXOnhTSuW2RSlYqNraAmCPYFld5FS9ktEj3JQVNtlAVpiNtTPqcL2JoTMgogZ1WqeQCl5SbTAzpBLI4Y46AZ9odfrorzT8O2od2ZuuNDlwxMdD8iZnht57x345HuaKQrUt9fIpPUYbWj3cm+dC00KV/3Gff8/GX4pXVAY1b5ke4sDYwrHu/isxer01pya6E2utV5V8I9ic9mjK7ttkiy+rJEK+anjES1QGNuqCSC1xYarC43GRuic6EUP/JbLaAtTGXe/am+ct+m4N9N+nOoANvmhjwbpwdvvXkCvPLgONPU3xGm6LcgVLNGQKe5Na/N9ofveGluJ7y4OMzQ7xvapCa4MgtGUrUU7zNOaw9ui8l2J3w2JPRI+12JUkBtpBZS/91DSxdI9Dzb0ZTtNzUqA4qQzElrDMprFMbUEai1NTyUnzvdiXPdbjcuzfNPw86HMhhMHr+OFdODPCNeZGn55QYb5GwV/eNhs8YoGh3YcZ4TJbwm4ebnLM/+VKcLV0e59ZYfGJmmPNrrKyu+kjSY1SSGR1SR2TPsOkRIrY0DUtXWzcE9PwSzrIhJOxNCh5tcfjrfptn2pz+RYhRm3e/tT7IN+ZFmqaE9WuE5GFjON03H58CKOqdmDEe5wG/Xt3hTvzcxgT/aXKoDGhcOTHA+6eGWFphHlNFbUOh2Zas7nB5+KDNv5sdtnZn9svtr/+Z7NEPTAvyhTlhpzqgfwP4hqaN2L6wPj4DMhyGQ0cVKX27ISlKbt2W5O7daeKOZGJE500TAry1PsjJFQah4+wJKiQ02YJ1MY8nWx0ebXbY2OXR5WRJr896AWFCSOezc8J8YGqQsKH9Fvgo0ObHNXzGEkW/GzPGI4ySP7s+5Unjj/ttvrMtyfqYKhWoCemcX23x5okBzqoyj0h+OtbodlUMZU2Hy1NtLk+3uWyPF2AsenFqpcn/nRDhtTUWmsYzmtqPY7tvNHzGGsNyR2aMRxVKhORtgLa52+OHO1L8fl+a1rQaVGFTY1GpwWtrLc6ttlhUZlA7xo1IzJEcSAu2dHs835HJLelSwj090gGFaoiWWRrvmBzkU7PCTIvo7E6IXZ2ueNeJZeZy32j4jEWG7a7MGI+pqJ23LwQ0W8CTrQ4/3ZXikSZH5V1kWlFqapxQYnBKhcmrxqnch0lhnUqrsF3QikmXq3aD259SZfYvdqrl3q1xj+bM/rWDzmaVavVmWaXJJ2aGuXyChY7GYy1O2+Mtzg3fumnXvfLP86VvOHzGIsNtOECVH98BnN/zQtyTPNXq8puGNI80OSqHoRemDjVBnRkRnRNKDRaXmcwtMRgf0qkNaoyzdEx96NJGErXbW7crabMFzbakISnYHle5IDsSHnsSgsa0IOX1KrUf6lWTMDWic+3UEO+ZorRYW23Jr/amuh466Hzu0fWpO9+9IOj9cnglAX18Bs2wPs56GY95KPmz83u/nxbwQszlj/tUTsO2hIfT293vcUgyy6FVmWSr2qDap7U6oFNhqbL6qKERMVS+RTCHupArJUlP5Xg0ppSR2J8StNhKn6PZFnS5Eq+vcmWxrpKE2pDOFRMCfGBa8FB27eoOl9t3pGKrO9ybtnaJn9RHDGfn6yqG80/j4zMkht0P7uN53A5cfNRngN0JwdNtDvc12qxoU9sIZH3C903Y0o78VdNU/kXfBRuJ2hPW65270c+xincBVJsmhnQuHR/gXZODLKswsXQVL/ndvjS/2JNubk6LL0wKa7+IpTV3/QUVw/K38PEpFiM2gc4YkCmo1Za3kkO2MOlJtsUFK1od/tXs8Hy7y8G0OCzbdyxM+TMGKWhozCs1eNOEAG8Yb7GgVBkMV8LTbQ7f357iuXZ32+SwfuMPFkf/+vEXu8XT51QO7dw+PiPAiA7DjPEYB3xWwHW6klvLSc+GRk+3uSxvdVjV4bI3oVLGR6cH/XVO/WPoMCmkc8Y4i8vGW7y62mJS6PDEaVOXx527Uvxxv40j5PMLy8xPPn5m2fIbXopz+6KSQZ7cx2dkGfFhJ6Uk4cnQupj3fk9y04Iyo7rSGrgZjlC6pes6XVa2uazucNkSFzSnBZ3u6FbFllqqIvbkCpNXV5mcXWUxI6ofSnCTqL11/7DP5t69afYkPbcupP9lbtS46ZGNiS3fObeCT80qVDjbx2f0GJXntSMk1p2N5gUnRi+dXWJ86dVV5tLzqq2CiuHinqTVlmzp9lgbUzodW7o9DqQELY5UYsi5dtjojwEqaDWl+UlNUGdOZvn41EqThaUGNUGd3l1IC8mLnR5/2mfzt0ab7XGPkKG1zIzqt79hQuD/PdbktN04O8QbJobw8TmWGDVH/9KVncyMaDzc5M60dD5bH9LfcnFdoPSiOouZEaPgcnxHqKlNY1qwOyHYm1QVsbuT6vd2R9Ltqp90piq2x0bomlraNTRVCRvQVVVsMFMVW2oqj2JmRJXPT4voTIsY1AS1o9LmJdCQFDzT5nL/ASXI3JgU6BqyOqivnB7Rv/G3ZSX//MLmpLj7pNLCOunjM0YY1QjBOU910pj0uKDGDD3a4l7W5crPVFraKa+psrh4vMXJFSodfSiN9KQqn+92JR0ZlfOUUEuzPQs+hga6pmFqaj+YoK6WdMO6UlcP6sqo5CrO8yQcSAtejHk83KSMxdZuoXZ206DE1JprgvrP5kb1Hz+8Pbnvo4tL+OGJfjzD59hl1EOLUkres6abX+xIcuXU0ORn2933tdry3YbGlDlRg7OqTM6qsjixzGBKWB+RDZoGQkg1VdqVEKyNufy3Ram0b48LEr32iwkbWrzS0v45Oaz/6OdLS5766Lq4d2qFxbd8kWGfY5zRH4UZ3vp8FwlP8rfTSrXTnoydtDsh3t9qiytcSa2lQ31IZ26JwbJKkxPLTKZHdCaHlYBOQM9PRGcwOEKpjLU5kt0Jj5e7PdbFPF6MuezOJJD1zjfRgJChpSstbfnUiH7XKZXmQw802t03zApz/fQQfgq5z/HAmLuLr9/QzQP7Hc6uMq2Vbe7p7Y54R6fDJSkhJ/UEJQIGjLN0qgIaUyMG0yNK43NCSCly1QQ1yjIGxeonNV2gJPxSQpL2VIxEbeCkpjX7kmqnt+0Jj8aUSkvvcGRWkWQdCBlavNzSnpoS1n89r9T4x1/22x1XTArwKz+W4XOcMeYMRw9nLu9gS7fHOyYHzYcOOItabXlFSshL00LOcwTBbKsflg5hQ+3qFtBV7MLsJzbhSBXr8DJbRLpCrYTYmbiI6CsPluU4GVnBhgpLe3xqxPjz7Kj+xIMHnM4zq0z+cmrZaF9GH59hYcwajh5e/VQH2+OChguf4pQnzpnQ5ohXdzjy9SmPM1wpp9oiy96mgxUlzvNqBFQA9WCJqa2psLR/zY7qj15dH9zy9c1Je3ZU5++nlflTEp/jmmPm7j5neSfNtkeXC5fWBaw1Mbu+xZanJ1zOTgq51BZM9aSsdYSamRRR0BxDBTq7TJ09tQF9o6nxxLSI8Vx9SN9457Z44uzxQWZGDX651J+S+LwyOGYMRw/jH9jH1LIoaaG2PvjdyaXGDRsSEUtjzr6kNytsaEsTnlzQbMvagMYENCpTHkFbSKOnv7n2t5YgLA0R0LUEcCBssH9CSN8LPDcxpG8aH9I3XjUx2HrpEx326yar2dIZ5QG+utDP+vR5ZXHMGY7enL68i1Jd0JiWVFoaqztc4peO47MbEta6Lq+kxNDqW21RtS3uhbtdWV1uaVODulZqaRi9Ku/TmqZ1t9ui5UBatpQYxKdFjXh9SG8I6TT+YVmpo922z3v96aWMD+lIqXFulck1U/1sT59XLse04ejLHTuSbOwSrIo5TI4YmEBTWvByt8fedhfWxeHmBmAb8CJQAcZ58I4aOKMcakyqQio7dGZER5OSoKlzTrXFtVN8Q+Hj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+Pj4+PzSuP/AzE1e5ONHe7vAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE1LTEyLTIzVDIwOjA0OjMxKzAwOjAwHarZDQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNS0xMi0yM1QyMDowNDozMSswMDowMGz3YbEAAABNdEVYdHNvZnR3YXJlAEltYWdlTWFnaWNrIDYuOS4yLTcgUTE2IHg4Nl82NCAyMDE1LTEyLTAyIGh0dHA6Ly93d3cuaW1hZ2VtYWdpY2sub3Jnbo4WPwAAAEp0RVh0c3ZnOmJhc2UtdXJpAGZpbGU6Ly8vdG1wL3ZpZ25ldHRlL2MxZDQ0ZGY2LWM1ZDYtNDkwMC04ZDBhLWQ0OWVmMzBiZGE3MS5zdmd90CehAAAAGHRFWHRUaHVtYjo6RG9jdW1lbnQ6OlBhZ2VzADGn/7svAAAAGHRFWHRUaHVtYjo6SW1hZ2U6OkhlaWdodAAyNjLFg9PDAAAAF3RFWHRUaHVtYjo6SW1hZ2U6OldpZHRoADU3Mz0hlMwAAAAZdEVYdFRodW1iOjpNaW1ldHlwZQBpbWFnZS9zdme/73BOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTQ1MDkwMTA3McPsyX0AAAAPdEVYdFRodW1iOjpTaXplADBCQpSiPuwAAABIdEVYdFRodW1iOjpVUkkAZmlsZTovLy90bXAvdmlnbmV0dGUvYzFkNDRkZjYtYzVkNi00OTAwLThkMGEtZDQ5ZWYzMGJkYTcxLnN2Z4N+SbEAAAAASUVORK5CYII=' style='display: block; margin-left: auto; margin-right: auto; margin-top: 7px; width: 70%; height: 70%;'/></span>");
+                    $('.logo-content' ).remove();
+                    $('.charts div:nth-child(2)').remove();  
+                });
+            ]]>
+        </scripts>
+        
+        <!-- custom styles -->
+        <styles>
+            <![CDATA[
+                .report-name {padding-top: 1px; font-size: 15px; font-weight: bold;}
+            ]]>
+        </styles>
+    </configuration>
+</extentreports>
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/conf/log4j.properties b/ui-ci/src/main/resources/ci/conf/log4j.properties
new file mode 100644
index 0000000..3e159ec
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/log4j.properties
@@ -0,0 +1,34 @@
+# Define the root logger with appender file
+log4j.rootLogger = DEBUG, FILE, stdout
+
+# Define the file appender
+log4j.appender.FILE=org.apache.log4j.RollingFileAppender
+log4j.appender.FILE.File=${targetlog}logs/ci-log.out
+
+# Define the layout for file appender
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n
+
+# Set the maximum file size before rollover
+log4j.appender.FILE.maxFileSize=5MB
+
+# Set the the backup index
+log4j.appender.FILE.maxBackupIndex=10
+
+
+#############################################################
+
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n
+
+log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
+log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
+
+log4j.logger.org.openecomp.sdc.ci.tests.utils=TRACE, FILE, stdout
+log4j.additivity.org.openecomp.sdc.ci.tests.utils=false
+
+
diff --git a/ui-ci/src/main/resources/ci/conf/titan.properties b/ui-ci/src/main/resources/ci/conf/titan.properties
new file mode 100644
index 0000000..94d12cf
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/conf/titan.properties
@@ -0,0 +1,7 @@
+storage.backend=cassandra
+storage.hostname=cassandrahost
+storage.port=9160
+
+cache.db-cache-clean-wait = 20
+cache.db-cache-time = 180000
+cache.db-cache-size = 0.5
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/drivers/chromedriver.exe b/ui-ci/src/main/resources/ci/drivers/chromedriver.exe
new file mode 100644
index 0000000..9746454
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/drivers/chromedriver.exe
Binary files differ
diff --git a/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh
new file mode 100644
index 0000000..0d494d9
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/scripts/addUsersFromList_new.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+function help_usage ()
+{
+	echo "$0 -ip <ip> -f <userToAdd_file>"
+	echo "for example: -ip 127.0.0.1 -f /var/tmp/userToAdd.txt"
+	exit
+}
+
+function check_file_existance ()
+{
+echo "check_file_existance $1"
+if [ $1 == "" ]; then
+        echo "Please provide full path to user file"
+        exit;
+elif [ -f $1 ]; then
+        source $1
+	USERS=("${USER_LIST[@]}")
+        echo "file exist" $1
+else
+        echo "Provided user file does not exist"
+        exit
+fi
+}
+
+function check_ip_existance ()
+{
+if [ $1 == "" ]; then
+        echo "Please provide ip address"
+        exit;
+fi
+}
+
+function addUser ()
+{
+	#for user in "${USER_LIST[@]}"; do
+	for user in "${USERS[@]}"; do
+		PING=`ping -c 1 $IP  > /var/tmp/ping.log`
+		pattern1='100% packet loss'
+		pattern2='Host Unreachable'
+		COUNT=`egrep -c "$pattern1|$pattern2" /var/tmp/ping.log`
+		if [ $COUNT -eq 0 ]; then
+		#	curl -i -X post -d '{ "userId" : "kk1123", "role" : "ADMIN" }'  -H "Content-Type: application/json" -H "USER_ID: jh0003" http://192.168.111.9:8080/sdc2/rest/v1/user
+			userId=`echo $user|awk '{print $1}'`
+			role=`echo $user|awk '{print $2}'`
+			curl -i -X post -d '{ "userId" : "'${userId}'", "role" : "'${role}'" }'  -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user
+		else
+			echo "Host" $IP "Is Unreachable"
+		fi
+	done
+}
+
+#main
+[ $# -eq 0 ] && help_usage
+while [ $# -ne 0 ]; do
+	case $1 in
+		"-f")
+			USER_FILE=$2
+			shift 1
+			shift 1
+		;;	
+		-ip)
+			IP=$2
+			shift 1
+			shift 1
+		;;
+		*)
+#			help_usage
+		;;
+	esac
+done
+
+check_file_existance $USER_FILE
+check_ip_existance $IP
+addUser
diff --git a/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh b/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh
new file mode 100644
index 0000000..396c1aa
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/scripts/copyToStorage.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+REPORT_NAME=$1
+VERSION=$2
+ENV=$3
+IP=$3
+
+if [ -z "$REPORT_NAME" ]
+ then
+	source ExtentReport/versions.info
+	now=$(date +'%Y-%m-%d_%H_%M')
+	REPORT_NAME="${now}"
+	VERSION="${osVersion}"
+		if [[ $env == *"DEV20"* ]]
+			then
+        			ENV="Nightly"
+			else
+        			ENV=""
+			fi	
+
+ fi
+
+/usr/bin/expect  << EOF
+spawn ssh admin@${IP} mkdir -p -m 775 /home/admin/reports/${ENV}/${VERSION}/UI/
+
+expect {
+  -re ".*es.*o.*" {
+    exp_send "yes\r"
+    exp_continue
+  }
+  -re ".*sword.*" {
+    exp_send "Aa123456\r"
+  }
+}
+
+expect eof
+
+spawn scp -pr ExtentReport admin@{IP}:/home/admin/reports/${ENV}/${VERSION}/UI/${REPORT_NAME}/
+
+expect {
+  -re ".*es.*o.*" {
+    exp_send "yes\r"
+    exp_continue
+  }
+  -re ".*sword.*" {
+    exp_send "Aa123456\r"
+  }
+}
+
+expect eof
+EOF
diff --git a/ui-ci/src/main/resources/ci/scripts/sendMail.sh b/ui-ci/src/main/resources/ci/scripts/sendMail.sh
new file mode 100644
index 0000000..794534f
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/scripts/sendMail.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+now=$(date +'%Y%-m%d%H%M')
+
+REPORT_NAME=$1
+VERSION=$2
+ENV=$3
+
+RECIPIENTS1="dl-sdcqa@intl.att.com,ml636r@intl.att.com,bl5783intl.att.com,ak314p@intl.att.com,el489u@intl.att.com,hk096q@intl.att.com,bs5719@intl.att.com"
+RECIPIENTS2="dl-asdcqa@intl.att.com"
+
+source ExtentReport/versions.info
+if [ -z "$REPORT_NAME" ]
+ then
+        source ExtentReport/versions.info
+        now=$(date +'%Y-%m-%d_%H_%M')
+        REPORT_NAME="${now}"
+        VERSION="${osVersion}"
+               
+
+fi
+
+if [[ $env == *"DEV20"* ]]
+    then
+         ENV="Nightly"
+         RECIPIENTS=$RECIPIENTS1
+    else
+         ENV=""
+         RECIPIENTS=$RECIPIENTS2
+fi
+
+#REPORT_ZIP_FILE=ExtentReport_${now}.zip
+REPORT_FOLDER='ExtentReport'
+REPORT_HTML_FILE=${REPORT_FOLDER}/*Report.html
+BODY_MESSAGE='Hello, \n\n Please find automation results on following link: \n\n http://asdc-srv-210-45.tlv.intl.att.com/'${ENV}'/'${VERSION}'/UI/'${REPORT_NAME}'/SDC_UI_Extent_Report.html \n\nThanks, \nASDC QA Team\n\n '
+
+#OLD_FILE=$(find ./ -type f -name ${REPORT_ZIP_FILE} -print)
+#if [ ! -z ${OLD_FILE} ]
+#then
+#        rm -f ${REPORT_ZIP_FILE}
+#        echo "Removing old zip file............"
+#fi
+
+#echo "Creating new zip file"
+#zip -r ${REPORT_ZIP_FILE} ./${REPORT_FOLDER}
+
+
+
+echo -e ${BODY_MESSAGE} | mail -s 'E2E Automation '$ENV' results - SDC '$VERSION -r 'ASDC@Automation.team' $RECIPIENTS
diff --git a/ui-ci/src/main/resources/ci/scripts/startTest.sh b/ui-ci/src/main/resources/ci/scripts/startTest.sh
new file mode 100644
index 0000000..737b538
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/scripts/startTest.sh
@@ -0,0 +1,155 @@
+#!/bin/bash
+REMOTE_DEBUG=false
+RERUN=true
+JAVA_OPTION=""
+debug_port=8000
+TEST_SUITES=testSuites
+fileName=testng-failed.xml
+
+function help_usage ()
+{
+	echo
+	echo "$0 (<jar_file_name> <suite file name>) [-r/rerun <true/false> -d/debug <true/false>]"
+	echo "nohup ./startTest.sh ui-ci-1707.0.5-SNAPSHOT-jar-with-dependencies.jar extendedSanity.xml -r false -d true &"
+	echo "by default rerun is true and remote debug is false."
+	echo
+	exit 2
+}
+
+function isBoolean ()
+{
+	PARAM_NAME=$1
+	VALUE=$2
+	if [[ ${VALUE} != "true" ]] && [[ ${VALUE} != "false" ]]; then
+		echo "Valid parameter" ${PARAM_NAME} "values are: true/false"
+	        help_usage
+	fi	
+}
+
+function prepareFailedXmlFile ()
+{	
+	echo "1="$1 "2="$2 "fileName="${fileName}
+	PATTERN=`grep -w "test name=" ${FULL_PATH}/${TEST_SUITES}/$2 | awk -F'"' '{print $2}'`
+	sed '/<test name="'${PATTERN}'"/,/<!-- '${PATTERN}' --/d' $1 > ${FULL_PATH}/${TEST_SUITES}/${fileName}
+    sed -i 's/thread-count="[0-9]\+"/thread-count="1"/g' ${FULL_PATH}/${TEST_SUITES}/${fileName}
+}
+
+#main
+[ $# -lt 2 ] && help_usage
+
+JAR_FILE=$1
+SUITE_FILE=$2
+
+while [ $# -ne 0 ]; do
+	case $1 in
+		-r|rerun)
+			RERUN=$2
+            		isBoolean $1 ${RERUN}
+			shift 1
+			shift 1
+		;;
+		-d|debug)
+			REMOTE_DEBUG=$2
+           		isBoolean $1 ${REMOTE_DEBUG}
+			shift 1
+			shift 1
+		;;		
+		*)
+			shift 1
+		;;
+	esac
+done
+
+CURRENT_DIR=`pwd`
+BASEDIR=$(dirname $0)
+
+if [ ${BASEDIR:0:1} = "/" ]
+then
+        FULL_PATH=$BASEDIR
+else
+        FULL_PATH=$CURRENT_DIR/$BASEDIR
+fi
+LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties
+#############################################
+TARGET_DIR=${FULL_PATH}/target
+CONF_FILE=${FULL_PATH}/conf/attsdc.yaml
+
+DEBUG=true
+MainClass=org.openecomp.sdc.ci.tests.run.StartTest
+
+TESTS_DIR=/opt/app/sdc/ci/resources/tests
+COMPONENTS_DIR=/opt/app/sdc/ci/resources/components
+
+
+TARGET_LOG_DIR="${TARGET_DIR}/"
+
+
+######ADD USERS################
+
+BE_IP=`cat conf/attsdc.yaml | grep catalogBeHost| awk '{print $2}'`
+
+ADD_USERS_SCRIPT="addUsersFromList_new.sh"
+USER_LIST="userList.txt"
+chmod +x ${ADD_USERS_SCRIPT}
+echo "add users..."
+`./${ADD_USERS_SCRIPT} -ip ${BE_IP} -f ${USER_LIST}`
+
+
+
+
+if [ ${REMOTE_DEBUG} == "true" ]; then
+    echo "Debug mode, Listen on port $debug_port";
+    JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;
+fi  
+
+cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &" 
+
+
+if [ $DEBUG == "true" ]
+then
+	$cmd
+else
+	$cmd >> /dev/null
+fi
+
+if [ ${RERUN} == "true" ]; then
+    if [ -f ${TARGET_DIR}/${fileName} ]; then
+        echo "Prepare" ${TARGET_DIR}/${fileName} "file to rerun all failed tests ...";
+        prepareFailedXmlFile ${TARGET_DIR}/${fileName} $SUITE_FILE;
+        SUITE_FILE=${fileName};
+	cmd="java -Xmx2048m -Xms1024m $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dfilepath=${FILES_TEST} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass} $SUITE_FILE &"
+        $cmd;
+    fi
+fi
+
+status=`echo $?`
+
+source ExtentReport/versions.info
+now=$(date +'%Y-%m-%d_%H_%M')
+REPORT_NAME=${now}
+VERSION=${osVersion}
+
+if [[ $env == *"DEV20"* ]]
+then
+        MYENV="Nightly"
+else
+	MYENV=""
+fi
+
+COPY_REPORT_SCRIPT="copyToStorage.sh"
+chmod +x ${COPY_REPORT_SCRIPT}
+echo "copy report to storage..."
+sh ./${COPY_REPORT_SCRIPT} ${REPORT_NAME} ${VERSION} ${MYENV}
+
+
+MAILING_SCRIPT_NAME="sendMail.sh"
+chmod +x ${MAILING_SCRIPT_NAME}
+echo "Sending report via mail..."
+`./${MAILING_SCRIPT_NAME} ${REPORT_NAME} ${VERSION} ${MYENV}`
+
+
+echo "##################################################"
+echo "################# status is ${status} #################" 
+echo "##################################################"
+
+exit $status
diff --git a/ui-ci/src/main/resources/ci/scripts/userList.txt b/ui-ci/src/main/resources/ci/scripts/userList.txt
new file mode 100644
index 0000000..a132659
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/scripts/userList.txt
@@ -0,0 +1 @@
+export USER_LIST=( "m99121 DESIGNER" "cs0008 DESIGNER" "kb0004 TESTER" "af0006 OPS" "ah0002 GOVERNOR" "m08740 DESIGNER" "m99124 TESTER" "m08743 TESTER" "m99123 OPS" "m08742 OPS" "m99125 GOVERNOR" "m08744 GOVERNOR" "m99122 ADMIN" "m08741 ADMIN" "m99126 PRODUCT_STRATEGIST" "m08745 PRODUCT_STRATEGIST" "m99127 PRODUCT_MANAGER" "m08746 PRODUCT_MANAGER" "md9897 DESIGNER" "m08748 DESIGNER" "m08749 TESTER" "be0695 DESIGNER" "er434w DESIGNER" "ya107f DESIGNER" "ds200p DESIGNER" "ak0333 ADMIN" "th0695 DESIGNER" "al714h DESIGNER" "ys9693 DESIGNER" "ss8214 DESIGNER" "bt750h DESIGNER" "rp955r DESIGNER" "ez6451 DESIGNER" "ia901h DESIGNER" "ah7840 DESIGNER" "ea394r DESIGNER" "ms656r DESIGNER" "ml636r DESIGNER" "it1721 DESIGNER" "sg473v DESIGNER" "sa997j DESIGNER" "az2497 DESIGNER" "ys189e DESIGNER" "ig642y DESIGNER" )
diff --git a/ui-ci/src/main/resources/ci/testSuites/andreyPara.xml b/ui-ci/src/main/resources/ci/testSuites/andreyPara.xml
new file mode 100644
index 0000000..f4f99db
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/andreyPara.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2">
+  <test name="uiSanity">
+    <classes>
+   	 	<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/>
+		<!-- <class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/> -->
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/devOnboardSanity.xml b/ui-ci/src/main/resources/ci/testSuites/devOnboardSanity.xml
new file mode 100644
index 0000000..5b44e68
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/devOnboardSanity.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue">
+  <test name="uitests">
+    <classes>
+    	<!--onboard-->
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+   			  <methods>
+				<include name="onboardVNFTestSanity"/>
+			  </methods>
+		</class>
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/devSanity.xml b/ui-ci/src/main/resources/ci/testSuites/devSanity.xml
new file mode 100644
index 0000000..6c4ba54
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/devSanity.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="4" data-provider-thread-count="2">
+  <test name="uiSanity">
+    <classes>
+    	
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+   			  <methods>
+				<include name="onboardVNFTestSanity"/>
+			  </methods>
+		</class>
+   		
+		
+			
+		
+		
+		
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml
new file mode 100644
index 0000000..a8dcf84
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/extendedSanity.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2">
+  <test name="uiSanity">
+    <classes>
+    	
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+   			  <methods>
+				<exclude name="onboardVNFTestSanity"/>
+			  </methods>
+		</class>
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportVFCAsset"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportDCAE"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.DeploymentViewTests"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VFCArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.AdminUserManagment"/>
+		<!--  <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> -->
+		
+		<class name="org.openecomp.sdc.ci.tests.US.ImportUpdateInformationalDeploymentArtifacts"/>
+        <class name="org.openecomp.sdc.ci.tests.US.MIBsArtifactsOnResourceInstance"/>
+        <class name="org.openecomp.sdc.ci.tests.US.NewArtifactTypeGuide"/>
+        <class name="org.openecomp.sdc.ci.tests.US.RemoveRestrictionOfDeploymentArtifacts"/>
+        
+        <!--  <class name="org.openecomp.sdc.ci.tests.US.AddComponentInstancesArtifactsInCsar"/> -->
+						
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/fullCI.xml b/ui-ci/src/main/resources/ci/testSuites/fullCI.xml
new file mode 100644
index 0000000..940026d
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/fullCI.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2">
+  <test name="uiSanity">
+    <classes>
+    	
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+   			  <methods>
+				<exclude name="onboardVNFTestSanity"/>
+			  </methods>
+		</class>
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportVFCAsset"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportDCAE"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.DeploymentViewTests"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VFCArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/>
+		
+	    <class name="org.openecomp.sdc.ci.tests.US.ImportUpdateInformationalDeploymentArtifacts"/>
+        <class name="org.openecomp.sdc.ci.tests.US.MIBsArtifactsOnResourceInstance"/>
+        <class name="org.openecomp.sdc.ci.tests.US.NewArtifactTypeGuide"/>
+        <class name="org.openecomp.sdc.ci.tests.US.RemoveRestrictionOfDeploymentArtifacts"/>
+		
+			
+		
+		
+		
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/onboardingVNFs.xml b/ui-ci/src/main/resources/ci/testSuites/onboardingVNFs.xml
new file mode 100644
index 0000000..e263a4a
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/onboardingVNFs.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="2" data-provider-thread-count="2">
+  <test name="Onboarding">
+    <classes>
+    	
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+   			  <methods>
+				<include name="onboardVNFTest"/>
+			  </methods>
+		</class>
+
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/ci/testSuites/sanity.xml b/ui-ci/src/main/resources/ci/testSuites/sanity.xml
new file mode 100644
index 0000000..c8fd8f1
--- /dev/null
+++ b/ui-ci/src/main/resources/ci/testSuites/sanity.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="uitests" configfailurepolicy="continue" parallel="methods" thread-count="4" data-provider-thread-count="2">
+  <test name="uiSanity">
+    <classes>
+    	
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Onboard">
+   			  <methods>
+				<include name="onboardVNFTestSanity"/>
+			  </methods>
+		</class>
+   		<class name="org.openecomp.sdc.ci.tests.execute.sanity.CatalogLeftPanelTest"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Vf"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.Service"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportVFCAsset"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.ImportDCAE"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.DeploymentViewTests"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VFCArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.VfDeploymentInformationalArtifacts"/>
+		<class name="org.openecomp.sdc.ci.tests.execute.sanity.AdminUserManagment"/>
+		<!--  <class name="org.openecomp.sdc.ci.tests.execute.sanity.Product"/> -->
+		
+			
+		
+		
+		
+    </classes>
+  </test> <!-- uitests -->
+</suite> <!-- uisuite -->
\ No newline at end of file
diff --git a/ui-ci/src/main/resources/images/gizmorambo.jpg b/ui-ci/src/main/resources/images/gizmorambo.jpg
new file mode 100644
index 0000000..c9a8fe8
--- /dev/null
+++ b/ui-ci/src/main/resources/images/gizmorambo.jpg
Binary files differ
diff --git a/ui-ci/src/test/Completetheform.js b/ui-ci/src/test/Completetheform.js
new file mode 100644
index 0000000..7e8b757
--- /dev/null
+++ b/ui-ci/src/test/Completetheform.js
@@ -0,0 +1,3 @@
+/**
+ * New node file
+ */
diff --git a/ui-ci/tarball.xml b/ui-ci/tarball.xml
new file mode 100644
index 0000000..9d7d4c1
--- /dev/null
+++ b/ui-ci/tarball.xml
@@ -0,0 +1,70 @@
+<assembly
+	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+	<id>bin</id>
+	<formats>
+		<format>tar</format>
+	</formats>
+	<files>
+		<file>
+			<source>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</source>
+			<outputDirectory>./</outputDirectory>
+			<destName>${project.artifactId}-${project.version}-jar-with-dependencies.jar</destName>
+		</file>
+ 		<file>
+			<source>src/main/resources/ci/scripts/startTest.sh</source>
+			<outputDirectory>./</outputDirectory>
+			<destName>startTest.sh</destName>
+		</file>
+		<!--file> <source>src/main/resources/ci/scripts/postinstall</source> <outputDirectory>./</outputDirectory> 
+			<destName>postinstall</destName> </file -->
+		<file>
+			<source>src/main/resources/ci/conf/attsdc.yaml</source>
+			<outputDirectory>conf</outputDirectory>
+			<destName>attsdc.yaml</destName>
+		</file>
+		<file>
+			<source>src/main/resources/ci/conf/attsdc-packages.yaml</source>
+			<outputDirectory>conf</outputDirectory>
+			<destName>attsdc-packages.yaml</destName>
+		</file>
+				<file>
+			<source>../catalog-be/src/main/resources/config/error-configuration.yaml</source>
+			<outputDirectory>conf</outputDirectory>
+			<destName>error-configuration.yaml</destName>
+		</file>
+		<file>
+			<source>../asdc-tests/src/main/resources/ci/conf/log4j.properties</source>
+			<outputDirectory>conf</outputDirectory>
+			<destName>log4j.properties</destName>
+		</file>
+		<file>
+			<source>src/main/resources/ci/conf/credentials.yaml</source>
+			<outputDirectory>conf</outputDirectory>
+			<destName>credentials.yaml</destName>
+		</file>
+		<file>
+			<source>src/main/resources/ci/drivers/chromedriver.exe/</source>
+			<outputDirectory>drivers</outputDirectory>
+			<destName>chromedriver.exe</destName>
+		</file>
+
+	</files>
+
+	<fileSets>
+		<fileSet>
+			<directory>src/test/resources</directory>
+			<outputDirectory>./</outputDirectory>
+		</fileSet>
+		<fileSet>
+			<directory>src/main/resources/ci/testSuites</directory>
+	        <outputDirectory>./testSuites</outputDirectory>
+		</fileSet>
+		<fileSet>
+			<directory>src/main/resources/Files</directory>
+	        <outputDirectory>./Files</outputDirectory>
+		</fileSet>
+	</fileSets>
+
+</assembly>
