From 75be95687987969bebc088565f01783e614983c4 Mon Sep 17 00:00:00 2001
From: Boris Djalal <boris.djalal@eurecom.fr>
Date: Tue, 16 Apr 2019 14:33:33 +0200
Subject: [PATCH] Adding gnb_usrp_build.xml

Signed-off-by: Boris Djalal <boris.djalal@eurecom.fr>
---
 ci-scripts/test-boris-Jenkinsfile       | 89 +++++++++++++++++++++++--
 ci-scripts/xml_files/gnb_usrp_build.xml | 38 +++++++++++
 2 files changed, 123 insertions(+), 4 deletions(-)
 create mode 100644 ci-scripts/xml_files/gnb_usrp_build.xml

diff --git a/ci-scripts/test-boris-Jenkinsfile b/ci-scripts/test-boris-Jenkinsfile
index 149f61660e..b4c9ecc78b 100644
--- a/ci-scripts/test-boris-Jenkinsfile
+++ b/ci-scripts/test-boris-Jenkinsfile
@@ -1,6 +1,24 @@
 #!/bin/groovy
-
-// for dummy commit
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (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.openairinterface.org/?page_id=698
+ *
+ * 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.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
 
 pipeline {
     agent {
@@ -21,14 +39,77 @@ pipeline {
                 }
             }
         }
-        stage ("Build") {
+        stage ("Print latest commit info") {
             steps {
-                echo "Building on ${GIT_URL}"
+                echo "Building on: "
+                echo "  Repository -- ${GIT_URL}"
                 echo "  Branch -- ${GIT_BRANCH}"
                 echo "  Commit -- ${GIT_COMMIT}"
                 sh "git log -n1"
             }
         }
+        stage ("Verify Parameters") {
+            steps {
+                script {
+                    echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
+                    def allParametersPresent = true
+
+                    // It is already too late to check it
+                    if (params.pythonExecutor != null) {
+                       echo "eNB CI executor node  :   ${pythonExecutor}"
+                    }
+                    // If not present picking a default XML file
+                    if (params.pythonTestXmlFile == null) {
+                        // picking default
+                        testXMLFile = 'xml_files/gnb_usrp_build.xml'
+                        echo "Test XML file(default):   ${testXMLFile}"
+                        mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
+                    } else {
+                        String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
+                        for (xmlFile in myXmlTestSuite) {
+                            if (fileExists("ci-scripts/" + xmlFile)) {
+                                mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
+                                echo "Test XML file         :   ${xmlFile}"
+                            }
+                        }
+                    }
+                    // If not present picking a default Stage Name
+                    if (params.pipelineTestStageName == null) {
+                        // picking default
+                        testStageName = 'Template Test Stage'
+                    }
+                    if (params.eNB_IPAddress == null) {
+                        allParametersPresent = false
+                    }
+                    if (params.UE_IPAddress == null) {
+                        allParametersPresent = false
+                    }
+                    if (params.eNB_SourceCodePath == null) {
+                        allParametersPresent = false
+                    }
+                    if (params.eNB_Credentials == null) {
+                        allParametersPresent = false
+                    }                   
+                    if (params.UE_Credentials == null) {
+                        allParametersPresent = false
+                    }
+                    if (params.eNB_Repository == null) {
+                        eNB_Repository = env.GIT_URL
+                    } else {
+                        eNB_Repository = params.eNB_Repository
+                    }
+
+                    if (allParametersPresent) {
+                        echo "All parameters are present"
+                        sh "git fetch"
+                        sh "git checkout -f ${eNB_CommitID}"
+                    } else {
+                        echo "Some parameters are missing"
+                        sh "./ci-scripts/fail.sh"
+                    }
+                }
+            }
+        }
     }
 }
 
diff --git a/ci-scripts/xml_files/gnb_usrp_build.xml b/ci-scripts/xml_files/gnb_usrp_build.xml
new file mode 100644
index 0000000000..f947d41c90
--- /dev/null
+++ b/ci-scripts/xml_files/gnb_usrp_build.xml
@@ -0,0 +1,38 @@
+<!--
+
+ Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The OpenAirInterface Software Alliance licenses this file to You under
+ the OAI Public License, Version 1.1  (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.openairinterface.org/?page_id=698
+
+ 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.
+
+ For more information about the OpenAirInterface (OAI) Software Alliance:
+      contact@openairinterface.org
+
+-->
+<testCaseList>
+	<htmlTabRef>build-tab</htmlTabRef>
+	<htmlTabName>Build</htmlTabName>
+	<htmlTabIcon>wrench</htmlTabIcon>
+	<TestCaseRequestedList>
+090101
+	</TestCaseRequestedList>
+	<TestCaseExclusionList></TestCaseExclusionList>
+
+	<testCase id="090101">
+		<class>Build_eNB</class>
+		<desc>Build gNB (USRP)</desc>
+		<Build_eNB_args>--gNB -w USRP</Build_eNB_args>
+	</testCase>
+
+</testCaseList>
-- 
2.26.2