Fix: Allow test state machine users to override next state.
And fail the tls state machine gracefully while supporting negative test cases.
Change-Id: I4f5dcd6dfd81ec9e3e36d2929b3b10ae40acb851
diff --git a/src/test/utils/CordTestBase.py b/src/test/utils/CordTestBase.py
index 038751f..1402ffc 100644
--- a/src/test/utils/CordTestBase.py
+++ b/src/test/utils/CordTestBase.py
@@ -1,12 +1,12 @@
-#
+#
# Copyright 2016-present Ciena Corporation
#
# 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.
@@ -35,5 +35,5 @@
if actions:
for a in actions:
a()
- self.currentState = nextState
+ self.currentState = nextState if self.nextState is None else self.nextState
self.currentEvent = self.nextEvent
diff --git a/src/test/utils/EapTLS.py b/src/test/utils/EapTLS.py
index 04c2918..cf8c673 100644
--- a/src/test/utils/EapTLS.py
+++ b/src/test/utils/EapTLS.py
@@ -161,6 +161,7 @@
def tlsFail(self):
##Force a failure
self.nextEvent = self.tlsEventTable.EVT_EAP_TLS_FINISHED
+ self.nextState = self.tlsStateTable.ST_EAP_TLS_FINISHED
self.failTest = True
def eapol_server_hello_cb(self, pkt):
@@ -372,7 +373,7 @@
return r
def _eapTlsFinished(self):
-
+ self.nextEvent = None
def eapol_cb(pkt):
log.info('Server authentication successfull')
@@ -388,4 +389,3 @@
lambda pkt: EAP in pkt and pkt[EAP].code == EAP.SUCCESS,
timeout = timeout)
self.eapol_logoff()
- self.nextEvent = None