Merge "Retries when doing UP4 flow verification"
diff --git a/TestON/docker/Dockerfile b/TestON/docker/Dockerfile
index 5ad5d52..2c43893 100644
--- a/TestON/docker/Dockerfile
+++ b/TestON/docker/Dockerfile
@@ -51,9 +51,14 @@
mkdir -p /var/run/sshd && \
mkdir -p /var/log/supervisor && \
useradd -m jenkins && \
+ chmod 777 /tmp && \
chsh -s /bin/bash jenkins && \
echo jenkins:jenkins | chpasswd
+RUN curl -sS --fail "https://repo1.maven.org/maven2/org/onosproject/onos-releases/2.5.4/onos-admin-2.5.4.tar.gz" | tar zx && \
+ mv onos-admin-2.5.4/* /usr/local/bin/ && \
+ rm -r onos-admin-2.5.4
+
ENV PYTHONPATH=${TREX_EXT_LIBS}:${TREX_LIBS}
# TODO: should we parametrize those?
ENV OC1=localhost
diff --git a/TestON/drivers/common/cli/p4runtimeclidriver.py b/TestON/drivers/common/cli/p4runtimeclidriver.py
index e2ef0c8..4de91be 100644
--- a/TestON/drivers/common/cli/p4runtimeclidriver.py
+++ b/TestON/drivers/common/cli/p4runtimeclidriver.py
@@ -108,7 +108,7 @@
try:
main.log.debug(self.name + ": Starting P4Runtime Shell CLI")
grpcAddr = "%s:%s" % (self.p4rtAddress, self.p4rtPort)
- startP4RtShLine = "python3 -m p4runtime_sh --grpc-addr " + grpcAddr + \
+ startP4RtShLine = "python3 -m p4runtime_sh -v --grpc-addr " + grpcAddr + \
" --device-id " + self.p4rtDeviceId + \
" --election-id " + self.p4rtElectionId
if pushConfig:
@@ -119,6 +119,9 @@
"You should provide a P4 Runtime config to push!")
main.cleanAndExit()
response = self.__clearSendAndExpect(startP4RtShLine)
+ if "CRITICAL" in response:
+ main.log.exception(self.name + ": Connection error.")
+ main.cleanAndExit()
self.preDisconnect = self.stopP4RtClient
except pexpect.TIMEOUT:
main.log.exception(self.name + ": Command timed out")
diff --git a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py
index 9f35639..37629da 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py
+++ b/TestON/tests/USECASE/SegmentRouting/QOS/QOS.py
@@ -86,4 +86,5 @@
main.step("Teardown")
trex.teardown()
up4.teardown()
+ run.saveOnosDiagsIfFailure(main)
run.cleanup(main)
diff --git a/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/dependencies/QOSNonMobileTest.py b/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/dependencies/QOSNonMobileTest.py
index 9a52313..45e9d8c 100644
--- a/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/dependencies/QOSNonMobileTest.py
+++ b/TestON/tests/USECASE/SegmentRouting/QOSNonMobile/dependencies/QOSNonMobileTest.py
@@ -175,6 +175,7 @@
main.step("Teardown")
trex.teardown()
+ run.saveOnosDiagsIfFailure(main)
run.cleanup(main)
def __cleanupTrafficSelector(self, traffic_selector):
diff --git a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
index a2838d2..d569ee5 100644
--- a/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
+++ b/TestON/tests/USECASE/SegmentRouting/UP4/UP4.py
@@ -65,6 +65,8 @@
main.step("Stop scapy and p4rt client")
up4.teardown()
+
+ run.saveOnosDiagsIfFailure(main)
run.cleanup(main)
def CASE2(self, main):
@@ -262,6 +264,8 @@
main.step("Stop scapy and p4rt client")
up4.teardown()
bess_host.stopScapy()
+
+ run.saveOnosDiagsIfFailure(main)
run.cleanup(main)
def CASE3(self, main):
@@ -388,6 +392,8 @@
onfail="ONOS instances have different number of flows: (%d, %d, %d)" % (
onos_0_flow_count, onos_1_flow_count, onos_2_flow_count)
)
+
+ run.saveOnosDiagsIfFailure(main)
run.cleanup(main)
def CASE4(self, main):
@@ -443,6 +449,14 @@
)
onosPod = main.params["UP4_delete_pod"]
+
+ # Save ONOS diags of the POD we are killing otherwise we lose ONOS logs
+ main.ONOSbench.onosDiagnosticsK8s(
+ [onosPod],
+ main.logdir,
+ "-CASE%d-%s_BeforeKill" % (main.CurrentTestCaseNumber, onosPod)
+ )
+
# Exit from previous port forwarding, because we need to restore
# port-forwarding after ONOS reboot.
kubectl_0.clearBuffer()
@@ -588,4 +602,5 @@
run.checkFlows(main, minFlowCount=initial_flow_count)
+ run.saveOnosDiagsIfFailure(main)
run.cleanup(main)
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 3aba8fc..59466be 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -2005,3 +2005,9 @@
utilities.assert_equals( expect=True, actual=logging,
onpass="Reset log levels",
onfail="Failed to reset log levels" )
+
+ @staticmethod
+ def saveOnosDiagsIfFailure( main ):
+ if main.FALSE in main.stepResultsList:
+ # Some step has failed
+ Testcaselib.saveOnosDiagnostics( main )