Ignore Exception between expected marker logs.

Change-Id: I3b7f155e3e9598a2c1de6484605e3f09c70e14dd
diff --git a/tools/test/bin/onos-check-logs b/tools/test/bin/onos-check-logs
index b98fe1bd..f54fad2 100755
--- a/tools/test/bin/onos-check-logs
+++ b/tools/test/bin/onos-check-logs
@@ -49,16 +49,30 @@
     ssh $remote "
         [ "'`uname`'" != "'"Linux"'" ] && alias tac='tail -r'
         tac $LOG | tr -d '\000' | awk -v ignoreStoreExceptions=${ise:-0} '
-            BEGIN { off = 0; fail = 0; exclusion = 0; trace = \"\";}
+            BEGIN { off = 0; fail = 0; exclusion = 0; expected = 0; trace = \"\";}
             / org.apache.karaf.main.lock.SimpleFileLock lock/ {
                 exit fail;
             }
 
+            # note: we are parsing log in reverse from the end
+            / EXPECTING_EXCEPTION_BEGIN/ {
+                print \$0;
+                expected = 0;
+            }
+
+            / EXPECTING_EXCEPTION_END/ {
+                print \$0;
+                expected = 1;
+            }
+
             / ERROR / {
                 if (exception && !exclusion) {
                     print \$0;
                     exception = 0;
-                    fail = 1;
+
+                    if (!expected) {
+                        fail = 1;
+                    }
                 }
                 exclusion = 0;
             }
@@ -82,7 +96,9 @@
                     print trace;
                     print \$0;
                     exception = 1;
-                    fail = 1;
+                    if (!expected) {
+                        fail = 1;
+                    }
                     trace = \"\";
                 }
             }
diff --git a/tools/test/scenarios/log-mark.xml b/tools/test/scenarios/log-mark.xml
new file mode 100644
index 0000000..384a8468
--- /dev/null
+++ b/tools/test/scenarios/log-mark.xml
@@ -0,0 +1,31 @@
+<!--
+  ~ Copyright 2017-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="log-mark" description="leave a mark on ONOS log">
+
+    <group name="ExpectExceptionMarkBegin">
+        <parallel var="${OC#}">
+            <step name="EXPECTING_EXCEPTION_BEGIN-${#}"
+                  exec="onos ${OC#} mark EXPECTING_EXCEPTION_BEGIN"/>
+        </parallel>
+    </group>
+
+    <group name="ExpectExceptionMarkEnd">
+        <parallel var="${OC#}">
+            <step name="EXPECTING_EXCEPTION_END-${#}"
+                  exec="onos ${OC#} mark EXPECTING_EXCEPTION_END"/>
+        </parallel>
+    </group>
+</scenario>
diff --git a/tools/test/scenarios/net-host-intent.xml b/tools/test/scenarios/net-host-intent.xml
index 6a1b704..5dc6cee 100644
--- a/tools/test/scenarios/net-host-intent.xml
+++ b/tools/test/scenarios/net-host-intent.xml
@@ -34,14 +34,21 @@
         <step name="Host-Intent.Validate-Intent-Installed-Still" requires="Host-Intent.Link-1-Down"
               exec="onos-check-intent ${OC1} h2h INSTALLED"/>
 
+        <import file="${ONOS_SCENARIOS}/log-mark.xml" namespace="Host-Intent"/>
+        <dependency name="Host-Intent.ExpectExceptionMarkBegin"
+                    requires="~Host-Intent.Validate-Intent-Installed-Still"/>
+
         <dependency name="Host-Intent.Link-2-Down"
-                    requires="~Host-Intent.Validate-Intent-Installed-Still" />
+                    requires="Host-Intent.ExpectExceptionMarkBegin" />
 
         <step name="Host-Intent.Validate-Intent-Failed" requires="Host-Intent.Link-2-Down"
               exec="onos-check-intent ${OC1} h2h FAILED"/>
 
+        <dependency name="Host-Intent.ExpectExceptionMarkEnd"
+                    requires="~Host-Intent.Validate-Intent-Failed"/>
+
         <dependency name="Host-Intent.Link-1-Up"
-                    requires="~Host-Intent.Validate-Intent-Failed" />
+                    requires="~Host-Intent.ExpectExceptionMarkEnd" />
 
         <step name="Host-Intent.Validate-Intent-Installed-Again" requires="Host-Intent.Link-1-Up"
               exec="onos-check-intent ${OC1} h2h INSTALLED"/>
diff --git a/tools/test/scenarios/net-point-intent.xml b/tools/test/scenarios/net-point-intent.xml
index 7626287..3b3134d 100644
--- a/tools/test/scenarios/net-point-intent.xml
+++ b/tools/test/scenarios/net-point-intent.xml
@@ -33,6 +33,7 @@
               exec="onos-check-intent ${OC1} xy INSTALLED"/>
 
         <import file="${ONOS_SCENARIOS}/net-link-down-up.xml" namespace="P2P-Intent"/>
+        <import file="${ONOS_SCENARIOS}/log-mark.xml" namespace="P2P-Intent"/>
         <dependency name="P2P-Intent.Net-Link-Down-Up"
                     requires="P2P-Intent.Validate-Intent-XY-Installed,
                               P2P-Intent.Validate-Intent-YX-Installed"/>
@@ -42,18 +43,24 @@
         <step name="P2P-Intent.Validate-Intent-YX-Installed-Still" requires="P2P-Intent.Link-1-Down"
               exec="onos-check-intent ${OC1} yx INSTALLED"/>
 
-        <dependency name="P2P-Intent.Link-2-Down"
+        <dependency name="P2P-Intent.ExpectExceptionMarkBegin"
                     requires="~P2P-Intent.Validate-Intent-XY-Installed-Still,
                               ~P2P-Intent.Validate-Intent-YX-Installed-Still"/>
 
+        <dependency name="P2P-Intent.Link-2-Down"
+                    requires="P2P-Intent.ExpectExceptionMarkBegin"/>
+
         <step name="P2P-Intent.Validate-Intent-XY-Failed" requires="P2P-Intent.Link-2-Down"
               exec="onos-check-intent ${OC1} xy FAILED"/>
         <step name="P2P-Intent.Validate-Intent-YX-Failed" requires="P2P-Intent.Link-2-Down"
               exec="onos-check-intent ${OC1} yx FAILED"/>
 
-        <dependency name="P2P-Intent.Link-1-Up"
+        <dependency name="P2P-Intent.ExpectExceptionMarkEnd"
                     requires="~P2P-Intent.Validate-Intent-XY-Failed,
-                              ~P2P-Intent.Validate-Intent-YX-Failed" />
+                              ~P2P-Intent.Validate-Intent-YX-Failed"/>
+
+        <dependency name="P2P-Intent.Link-1-Up"
+                    requires="~P2P-Intent.ExpectExceptionMarkEnd" />
 
         <step name="P2P-Intent.Validate-Intent-XY-Installed-Again" requires="P2P-Intent.Link-1-Up"
               exec="onos-check-intent ${OC1} xy INSTALLED"/>