Initial stc tests for distributed primitives

Change-Id: I82a2911df9a4852cb851732e220d498f9332e005
diff --git a/tools/test/scenarios/dist-counter.xml b/tools/test/scenarios/dist-counter.xml
new file mode 100644
index 0000000..aae33b5
--- /dev/null
+++ b/tools/test/scenarios/dist-counter.xml
@@ -0,0 +1,74 @@
+<!--
+  ~ Copyright 2016-present Open Networking Laboratory
+  ~
+  ~ 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.
+-->
+
+<scenario name="distributed counter test"
+          description="ONOS AtomicCounter distributed primitive Test">
+    <group name="Distributed-Primitive-Counter">
+
+        <!--<import file="${ONOS_SCENARIOS}/setup.xml"/>
+        <dependency name="Setup" requires="Prerequisites"/>-->
+
+        <step name="Activate-Distributed-Primitives-App"
+            exec="onos ${OCI} app activate org.onosproject.distributedprimitives"/>
+
+        <step name="Test-Counter-Initial-Value" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter get --expect 0"/>
+
+        <step name="Test-Counter-Set" requires="^"
+              exec="onos ${OCI} counter-test test-counter set 1"/>
+
+        <step name="Test-Counter-Get" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter get --expect 1"/>
+
+        <step name="Test-Counter-IncrementAndGet" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter incrementAndGet --expect 2"/>
+
+        <step name="Test-Counter-GetAndIncrement" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter getAndIncrement --expect 2"/>
+
+        <step name="Test-Counter-Incremented" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter get --expect 3"/>
+
+        <step name="Test-Counter-AddAndGet" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter addAndGet 10 --expect 13"/>
+
+        <step name="Test-Counter-GetAndAdd" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter getAndAdd 10 --expect 13"/>
+
+        <step name="Test-Counter-Updated-After-GetAndAdd" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter get --expect 23"/>
+
+        <step name="Test-Counter-CompareAndSet-False" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter compareAndSet 1 2 --expect false"/>
+
+        <step name="Test-Counter-Not-Updated-After-CAS" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter get --expect 23"/>
+
+        <step name="Test-Counter-CompareAndSet-True" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter compareAndSet 23 25 --expect true"/>
+
+        <step name="Test-Counter-Updated-After-CAS" requires="^"
+              exec="onos-execute-expect ${OCI} counter-test test-counter get --expect 25"/>
+
+        <!--Check with check logs-->
+        <step name="Check-Log-Exceptions" requires="^"
+              exec="onos-check-logs ${OCI}"/>
+
+        <step name="Teardown-Distributed-Primitives-Test-App" requires="^"
+              exec="onos ${OCI} app deactivate org.onosproject.distributedprimitives"/>
+    </group>
+</scenario>
+
diff --git a/tools/test/scenarios/dist-leader.xml b/tools/test/scenarios/dist-leader.xml
new file mode 100644
index 0000000..ec774af
--- /dev/null
+++ b/tools/test/scenarios/dist-leader.xml
@@ -0,0 +1,47 @@
+<!--
+  ~ Copyright 2016-present Open Networking Laboratory
+  ~
+  ~ 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.
+-->
+
+<scenario name="distributed leader elector test"
+          description="ONOS LeaderElector distributed primitive Test">
+    <group name="Distributed-Primitive-Value">
+
+        <!--<import file="${ONOS_SCENARIOS}/setup.xml"/>
+        <dependency name="Setup" requires="Prerequisites"/>-->
+
+        <step name="Activate-Distributed-Primitives-App"
+            exec="onos ${OCI} app activate org.onosproject.distributedprimitives"/>
+
+        <step name="Test-Initial-No-Leader" requires="^"
+              exec="onos-execute-expect ${OCI} leader-test test-elector show foo --expect leader=none#candidates=none"/>
+
+        <step name="Test-Leader-Run" requires="^"
+              exec="onos-execute-expect ${OCI} leader-test test-elector run foo --expect leader=${OCI}#term=1#candidates=${OCI}"/>
+
+        <step name="Test-Leader-Withdraw" requires="^"
+              exec="onos ${OCI} leader-test test-elector withdraw foo"/>
+
+        <step name="Test-No-Leader-After-Withdraw" requires="^"
+              exec="onos-execute-expect ${OCI} leader-test test-elector show foo --expect leader=none#candidates=none"/>
+
+        <!--Check with check logs-->
+        <step name="Check-Log-Exceptions" requires="^"
+              exec="onos-check-logs ${OCI}"/>
+
+        <step name="Teardown-Distributed-Primitives-Test-App" requires="^"
+              exec="onos ${OCI} app deactivate org.onosproject.distributedprimitives"/>
+    </group>
+</scenario>
+
diff --git a/tools/test/scenarios/dist-map.xml b/tools/test/scenarios/dist-map.xml
new file mode 100644
index 0000000..576aae0
--- /dev/null
+++ b/tools/test/scenarios/dist-map.xml
@@ -0,0 +1,95 @@
+<!--
+  ~ Copyright 2016-present Open Networking Laboratory
+  ~
+  ~ 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.
+-->
+
+<scenario name="Distributed consistent map test"
+          description="ONOS ConsistentMap distributed primitive Test">
+    <group name="Distributed-Primitive-Map">
+
+        <!--<import file="${ONOS_SCENARIOS}/setup.xml"/>
+        <dependency name="Setup" requires="Prerequisites"/>-->
+
+        <step name="Activate-Distributed-Primitives-App"
+            exec="onos ${OCI} app activate org.onosproject.distributedprimitives"/>
+
+        <step name="Test-Map-Get" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo get a --expect null"/>
+
+        <step name="Test-Map-Put" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo put a b --expect null"/>
+
+        <step name="Test-Map-Updated-After-Put" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo get a --expect b"/>
+
+        <step name="Test-Map-PutIfAbsent-When-Key-Present" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo putIfAbsent a c --expect b"/>
+
+        <step name="Test-Map-PutIfAbsent-When-Key-Absent" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo putIfAbsent b c --expect null"/>
+
+        <step name="Test-Map-Updated-After-PutIfAbsent" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo get b --expect c"/>
+
+        <step name="Test-Map-Updated-After-PutAndGet" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo putAndGet b d --expect d"/>
+
+        <step name="Test-Map-Replace-When-Key-Absent" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo replace c e --expect null"/>
+
+        <step name="Test-Map-Replace-When-Key-Present" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo replace b e --expect d"/>
+
+        <step name="Test-Map-Replace-When-Value-Does-Not-Match" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo replace b x f --expect false"/>
+
+        <step name="Test-Map-Replace-When-Value-Does-Match" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo replace b e f --expect true"/>
+
+        <step name="Test-Map-ContainsValue-False-Case" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo containsValue x --expect false"/>
+
+        <step name="Test-Map-ContainsValue-True-Case" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo containsValue f --expect true"/>
+
+        <step name="Test-Map-Size" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo size --expect 2"/>
+
+        <step name="Test-Map-IsEmpty" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo isEmpty --expect false"/>
+
+        <step name="Test-Map-Remove" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo remove b --expect f"/>
+
+        <step name="Test-Map-Remove-Key-Value-Does-Not-Match" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo remove a c --expect false"/>
+
+        <step name="Test-Map-Remove-Key-Value-Does-Match" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo remove a b --expect true"/>
+
+        <step name="Test-Map-Clear" requires="^"
+              exec="onos ${OCI} map-test foo clear"/>
+
+        <step name="Test-Map-Cleared" requires="^"
+              exec="onos-execute-expect ${OCI} map-test foo isEmpty --expect true"/>
+
+        <!--Check with check logs-->
+        <step name="Check-Log-Exceptions" requires="^"
+              exec="onos-check-logs ${OCI}"/>
+
+        <step name="Teardown-Distributed-Primitives-Test-App" requires="^"
+              exec="onos ${OCI} app deactivate org.onosproject.distributedprimitives"/>
+    </group>
+</scenario>
+
diff --git a/tools/test/scenarios/dist-value.xml b/tools/test/scenarios/dist-value.xml
new file mode 100644
index 0000000..f14eb9f
--- /dev/null
+++ b/tools/test/scenarios/dist-value.xml
@@ -0,0 +1,56 @@
+<!--
+  ~ Copyright 2016-present Open Networking Laboratory
+  ~
+  ~ 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.
+-->
+
+<scenario name="distributed value test"
+          description="ONOS AtomicValue distributed primitive Test">
+    <group name="Distributed-Primitive-Value">
+
+        <!--<import file="${ONOS_SCENARIOS}/setup.xml"/>
+        <dependency name="Setup" requires="Prerequisites"/>-->
+
+        <step name="Activate-Distributed-Primitives-App"
+            exec="onos ${OCI} app activate org.onosproject.distributedprimitives"/>
+
+        <step name="Test-Value-Initial-Value" requires="^"
+              exec="onos-execute-expect ${OCI} value-test test-value get --expect null"/>
+
+        <step name="Test-Value-Set" requires="^"
+              exec="onos ${OCI} value-test test-value set v0"/>
+
+        <step name="Test-Value-Get" requires="^"
+              exec="onos-execute-expect ${OCI} value-test test-value get --expect v0"/>
+
+        <step name="Test-Value-CompareAndSet-False" requires="^"
+              exec="onos-execute-expect ${OCI} value-test test-value compareAndSet v1 v2 --expect false"/>
+
+        <step name="Test-Value-Not-Updated-After-CAS" requires="^"
+              exec="onos-execute-expect ${OCI} value-test test-value get --expect v0"/>
+
+        <step name="Test-Value-CompareAndSet-True" requires="^"
+              exec="onos-execute-expect ${OCI} value-test test-value compareAndSet v0 v1 --expect true"/>
+
+        <step name="Test-Value-Updated-After-CAS" requires="^"
+              exec="onos-execute-expect ${OCI} value-test test-value get --expect v1"/>
+
+        <!--Check with check logs-->
+        <step name="Check-Log-Exceptions" requires="^"
+              exec="onos-check-logs ${OCI}"/>
+
+        <step name="Teardown-Distributed-Primitives-Test-App" requires="^"
+              exec="onos ${OCI} app deactivate org.onosproject.distributedprimitives"/>
+    </group>
+</scenario>
+