Add reporting for k8s virtlet conformance tests

- rename the report name 'report.xml' to
  'conformance_virtlet_result.xml'
- report to the testrail suite '[k8s] Virtlet'

Related-Bug:#PROD-22726
Change-Id: I3e41c85188dd0169f2f8ebbc61f1514ab952c532
diff --git a/jobs/pipelines/swarm-testrail-report.groovy b/jobs/pipelines/swarm-testrail-report.groovy
index 9399510..da238ff 100644
--- a/jobs/pipelines/swarm-testrail-report.groovy
+++ b/jobs/pipelines/swarm-testrail-report.groovy
@@ -56,12 +56,15 @@
             def tempest_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"report_*.xml\"", returnStdout: true)
             // k8s_conformance_report_name =~ conformance_result.xml
             def k8s_conformance_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_result.xml\"", returnStdout: true)
+            // k8s_conformance_report_name =~ conformance_virtlet_result.xml
+            def k8s_conformance_virtlet_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"conformance_virtlet_result.xml\"", returnStdout: true)
             // stacklight_report_name =~ "stacklight_report.xml" or "report.xml"
             def stacklight_report_name = sh(script: "find ${PARENT_WORKSPACE} -name \"*report.xml\"", returnStdout: true)
             common.printMsg(deployment_report_name ? "Found deployment report: ${deployment_report_name}" : "Deployment report not found", deployment_report_name ? "blue" : "red")
             common.printMsg(tcpqa_report_name ? "Found tcp-qa report: ${tcpqa_report_name}" : "tcp-qa report not found", tcpqa_report_name ? "blue" : "red")
             common.printMsg(tempest_report_name ? "Found tempest report: ${tempest_report_name}" : "tempest report not found", tempest_report_name ? "blue" : "red")
             common.printMsg(k8s_conformance_report_name ? "Found k8s conformance report: ${k8s_conformance_report_name}" : "k8s conformance report not found", k8s_conformance_report_name ? "blue" : "red")
+            common.printMsg(k8s_conformance_virtlet_report_name ? "Found k8s conformance virtlet report: ${k8s_conformance_virtlet_report_name}" : "k8s conformance virtlet report not found", k8s_conformance_virtlet_report_name ? "blue" : "red")
             common.printMsg(stacklight_report_name ? "Found stacklight-pytest report: ${stacklight_report_name}" : "stacklight-pytest report not found", stacklight_report_name ? "blue" : "red")
 
 
@@ -149,6 +152,28 @@
                 }
             }
 
+            if ('k8s' in stacks && k8s_conformance_virtlet_report_name) {
+                stage("K8s conformance virtlet report") {
+                    testSuiteName = "[k8s] Virtlet"
+                    methodname = "{methodname}"
+                    testrail_name_template = "{title}"
+                    reporter_extra_options = [
+                      "--send-duplicates",
+                      "--testrail-add-missing-cases",
+                      "--testrail-case-custom-fields {\\\"custom_qa_team\\\":\\\"9\\\"}",
+                      "--testrail-case-section-name \'Conformance\'",
+                    ]
+                    report_result = shared.upload_results_to_testrail(k8s_conformance_virtlet_report_name, testSuiteName, methodname, testrail_name_template, reporter_extra_options)
+                    common.printMsg(report_result, "blue")
+                    report_url = report_result.split("\n").each {
+                        if (it.contains("[TestRun URL]")) {
+                            common.printMsg("Found report URL: " + it.trim().split().last(), "blue")
+                            description += "\n<a href=" + it.trim().split().last() + ">${testSuiteName}</a>"
+                        }
+                    }
+                }
+            }
+
             if ('stacklight' in stacks && stacklight_report_name) {
                 stage("stacklight-pytest report") {
                     testSuiteName = "LMA2.0_Automated"
diff --git a/tcp_tests/managers/k8smanager.py b/tcp_tests/managers/k8smanager.py
index 7ca518e..5e8ea56 100644
--- a/tcp_tests/managers/k8smanager.py
+++ b/tcp_tests/managers/k8smanager.py
@@ -230,28 +230,29 @@
                raise_on_err=raise_on_err, verbose=True)
 
     def run_virtlet_conformance(self, timeout=60 * 120,
-                                log_file='virtlet_conformance.log'):
+                                log_file='virtlet_conformance.log',
+                                report_name="report.xml"):
         if self.__config.k8s.run_extended_virtlet_conformance:
             ci_image = "cloud-images.ubuntu.com/xenial/current/" \
                        "xenial-server-cloudimg-amd64-disk1.img"
             cmd = ("set -o pipefail; "
                    "docker run --net=host {0} /virtlet-e2e-tests "
-                   "-include-cloud-init-tests -junitOutput report.xml "
+                   "-include-cloud-init-tests -junitOutput {3} "
                    "-image {2} -sshuser ubuntu -memoryLimit 1024 "
                    "-alsologtostderr -cluster-url http://127.0.0.1:8080 "
                    "-ginkgo.focus '\[Conformance\]' "
                    "| tee {1}".format(
                     self.__config.k8s_deploy.kubernetes_virtlet_image,
-                    log_file, ci_image))
+                    log_file, ci_image, report_name))
         else:
             cmd = ("set -o pipefail; "
                    "docker run --net=host {0} /virtlet-e2e-tests "
-                   "-junitOutput report.xml "
+                   "-junitOutput {2} "
                    "-alsologtostderr -cluster-url http://127.0.0.1:8080 "
                    "-ginkgo.focus '\[Conformance\]' "
                    "| tee {1}".format(
                     self.__config.k8s_deploy.kubernetes_virtlet_image,
-                    log_file))
+                    log_file, report_name))
         LOG.info("Executing: {}".format(cmd))
         with self.__underlay.remote(
                 node_name=self.controller_name) as remote:
diff --git a/tcp_tests/tests/system/test_3rdparty_suites.py b/tcp_tests/tests/system/test_3rdparty_suites.py
index d545532..01a5c73 100644
--- a/tcp_tests/tests/system/test_3rdparty_suites.py
+++ b/tcp_tests/tests/system/test_3rdparty_suites.py
@@ -83,11 +83,16 @@
         k8s_actions.run_conformance()
 
     @pytest.mark.grab_versions
+    @pytest.mark.extract(container_system='docker',
+                         extract_from='mirantis/virtlet',
+                         files_to_extract=['conformance_virtlet_result.xml'])
     @pytest.mark.grab_k8s_results(name=['virtlet_conformance.log',
-                                        'report.xml'])
+                                        'conformance_virtlet_result.xml'])
     @pytest.mark.parametrize("_", [settings.ENV_NAME])
     @pytest.mark.k8s_conformance_virtlet
     def test_run_k8s_conformance_virtlet(self, show_step, config, k8s_actions,
                                          k8s_logs, _):
         """Test run of k8s virtlet conformance tests"""
-        k8s_actions.run_virtlet_conformance()
+        config.k8s.run_extended_virtlet_conformance = True
+        k8s_actions.run_virtlet_conformance(
+            report_name="conformance_virtlet_result.xml")