Merge "Add Daisy for reporting"
authorMorgan Richomme <morgan.richomme@orange.com>
Thu, 12 Jan 2017 08:59:03 +0000 (08:59 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Thu, 12 Jan 2017 08:59:03 +0000 (08:59 +0000)
13 files changed:
jjb/apex/apex.yml
jjb/compass4nfv/compass-deploy.sh
jjb/dovetail/dovetail-artifacts-upload.sh
jjb/dovetail/dovetail-run.sh
jjb/qtip/qtip-ci-jobs.yml
utils/fetch_os_creds.sh
utils/jenkins-jnlp-connect.sh
utils/test/testapi/htmlize/finish.sh
utils/test/testapi/htmlize/prepare.sh
utils/test/testapi/opnfv_testapi/resources/handlers.py
utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py [new file with mode: 0644]
utils/test/testapi/opnfv_testapi/resources/scenario_models.py [new file with mode: 0644]
utils/test/testapi/opnfv_testapi/router/url_mappings.py

index 064b89c..5c1bded 100644 (file)
 
     builders:
         - trigger-builds:
-          - project: 'apex-deploy-baremetal-os-odl_l2-nofeature-ha-{stream}'
+          - project: 'apex-deploy-baremetal-os-odl_l3-nofeature-ha-{stream}'
             predefined-parameters:
               OPNFV_CLEAN=yes
             git-revision: false
         - trigger-builds:
           - project: 'cperf-apex-intel-pod2-daily-{stream}'
             predefined-parameters:
-              DEPLOY_SCENARIO=os-odl_l2-nofeature-ha
+              DEPLOY_SCENARIO=os-odl_l3-nofeature-ha
             block: true
             same-node: true
 
index c8d6159..f89d04e 100644 (file)
@@ -38,6 +38,10 @@ else
     export NETWORK_CONF_FILE=network.yml
 fi
 
+if [[ "$NODE_NAME" =~ "intel-pod8" ]]; then
+    export OS_MGMT_NIC=em4
+fi
+
 if [[ "$NODE_NAME" =~ "-virtual" ]]; then
     export NETWORK_CONF=$CONFDIR/vm_environment/$NODE_NAME/${NETWORK_CONF_FILE}
     export DHA_CONF=$CONFDIR/vm_environment/${DEPLOY_SCENARIO}.yml
index b5d8fcf..b23deca 100755 (executable)
@@ -16,6 +16,7 @@ echo "dovetail: pull and save the images"
 cd ${CACHE_DIR}
 sudo docker pull ${DOCKER_REPO_NAME}:${DOCKER_TAG}
 sudo docker save -o ${STORE_FILE_NAME} ${DOCKER_REPO_NAME}:${DOCKER_TAG}
+sudo chmod og+rw ${STORE_FILE_NAME}
 
 OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
 GS_UPLOAD_LOCATION="${STORE_URL}/${OPNFV_ARTIFACT_VERSION}"
index 4082c34..4cc03f7 100755 (executable)
@@ -57,7 +57,7 @@ if [ -z ${container_id} ]; then
     docker ps -a
     exit 1
 fi
-echo "COntainer Start: docker start ${container_id}"
+echo "Container Start: docker start ${container_id}"
 docker start ${container_id}
 sleep 5
 docker ps >${redirect}
index b83014e..69cb32b 100644 (file)
@@ -39,7 +39,7 @@
 - job-template:
     name: 'qtip-{installer}-{pod}-daily-{stream}'
 
-    disabled: false
+    disabled: true
 
     parameters:
         - project-parameter:
index ecc571d..3667dbe 100755 (executable)
@@ -104,18 +104,13 @@ if [ "$installer_type" == "fuel" ]; then
     #This file contains the mgmt keystone API, we need the public one for our rc file
     admin_ip=$(cat $dest_path | grep "OS_AUTH_URL" | sed 's/^.*\=//' | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" | sed s'/\/$//')
     public_ip=$(sshpass -p r00tme ssh $ssh_options root@${installer_ip} \
-        "ssh ${controller_ip} 'source openrc; openstack endpoint list --long'" \
-        | grep $admin_ip | sed 's/ /\n/g' | grep ^http | head -1) &> /dev/null
+        "ssh ${controller_ip} 'source openrc; openstack endpoint list'" \
+        | grep keystone | grep public | sed 's/ /\n/g' | grep ^http | head -1) &> /dev/null
         #| grep http | head -1 | cut -d '|' -f 4 | sed 's/v1\/.*/v1\//' | sed 's/ //g') &> /dev/null
     #NOTE: this is super ugly sed 's/v1\/.*/v1\//'OS_AUTH_URL
     # but sometimes the output of endpoint-list is like this: http://172.30.9.70:8004/v1/%(tenant_id)s
     # Fuel virtual need a fix
 
-    if [ "$DEPLOY_TYPE" == "virt" ]; then
-        echo "INFO: Changing: internalURL -> publicURL in openrc"
-        sed -i 's/internalURL/publicURL/' $dest_path
-    fi
-
 elif [ "$installer_type" == "apex" ]; then
     verify_connectivity $installer_ip
 
@@ -196,13 +191,6 @@ if [ ! -f $dest_path ]; then
     error "There has been an error retrieving the credentials"
 fi
 
-if [ "$public_ip" != "" ]; then
-    info "Exchanging keystone public IP in rc file to $public_ip"
-    sed -i  "/OS_AUTH_URL/c\export OS_AUTH_URL=\'$public_ip'" $dest_path
-fi
-
-
-
 echo "-------- Credentials: --------"
 cat $dest_path
 
index 9751a90..be9fe18 100755 (executable)
@@ -95,18 +95,30 @@ main () {
         makemonit () {
             echo "Writing the following as monit config:"
         cat << EOF | tee $monitconfdir/jenkins
+check directory jenkins_piddir path /var/run/$jenkinsuser
+if does not exist then exec "/usr/bin/mkdir -p /var/run/$jenkinsuser"
+if failed uid $jenkinsuser then exec "/usr/bin/chown $jenkinsuser /var/run/$jenkinsuser"
+if failed gid $jenkinsuser then exec "/usr/bin/chown :$jenkinsuser /var/run/$jenkinsuser"
+
 check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid
 start program = "/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds"
 stop program = "/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'"
+depends on jenkins_piddir
 EOF
         }
 
         if [[ -f $monitconfdir/jenkins ]]; then
             #test for diff
             if [[ "$(diff $monitconfdir/jenkins <(echo "\
+check directory jenkins_piddir path /var/run/$jenkinsuser
+if does not exist then exec \"/usr/bin/mkdir -p /var/run/$jenkinsuser\"
+if failed uid $jenkinsuser then exec \"/usr/bin/chown $jenkinsuser /var/run/$jenkinsuser\"
+if failed gid $jenkinsuser then exec \"/usr/bin/chown :$jenkinsuser /var/run/$jenkinsuser\"
+
 check process jenkins with pidfile /var/run/$jenkinsuser/jenkins_jnlp_pid
 start program = \"/usr/bin/sudo -u $jenkinsuser /bin/bash -c 'cd $jenkinshome; export started_monit=true; $0 $@' with timeout 60 seconds\"
-stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"\
+stop program = \"/bin/bash -c '/bin/kill \$(/bin/cat /var/run/$jenkinsuser/jenkins_jnlp_pid)'\"
+depends on jenkins_piddir\
 ") )" ]]; then
                 echo "Updating monit config..."
                 makemonit $@
index dc3aa86..d24ae05 100644 (file)
@@ -13,3 +13,5 @@ if [ $proc_number -gt 0 ]; then
     echo "Kill opnfv-testapi server $procs"
     ps -ef | grep opnfv-testapi | grep -v grep | awk '{print $2}' | xargs kill -kill &>/dev/null
 fi
+
+deactivate
index 3c265aa..67158f2 100644 (file)
@@ -26,5 +26,3 @@ cd utils/test/testapi/
 pip install -r requirements.txt
 ./install.sh
 opnfv-testapi -c ../../../testapi_venv/etc/opnfv_testapi/config.ini &
-
-deactivate
index f1ad15e..9fc5d6b 100644 (file)
@@ -43,6 +43,7 @@ class GenericApiHandler(RequestHandler):
         self.db_pods = 'pods'
         self.db_testcases = 'testcases'
         self.db_results = 'results'
+        self.db_scenarios = 'scenarios'
 
     def prepare(self):
         if self.request.method != "GET" and self.request.method != "DELETE":
diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py b/utils/test/testapi/opnfv_testapi/resources/scenario_handlers.py
new file mode 100644 (file)
index 0000000..75754d8
--- /dev/null
@@ -0,0 +1,61 @@
+from opnfv_testapi.resources.handlers import GenericApiHandler
+from opnfv_testapi.resources.scenario_models import Scenario
+from opnfv_testapi.tornado_swagger import swagger
+
+
+class GenericScenarioHandler(GenericApiHandler):
+    def __init__(self, application, request, **kwargs):
+        super(GenericScenarioHandler, self).__init__(application,
+                                                     request,
+                                                     **kwargs)
+        self.table = self.db_scenarios
+        self.table_cls = Scenario
+
+
+class ScenariosCLHandler(GenericScenarioHandler):
+    @swagger.operation(nickname="List scenarios by queries")
+    def get(self):
+        """
+            @description: Retrieve scenario(s).
+            @notes: Retrieve scenario(s)
+            @return 200: all scenarios consist with query,
+                         empty list if no scenario is found
+            @rtype: L{Scenarios}
+        """
+        self._list()
+
+    @swagger.operation(nickname="Create a new scenario")
+    def post(self):
+        """
+            @description: create a new scenario by name
+            @param body: scenario to be created
+            @type body: L{string}
+            @rtype: L{CreateResponse}
+        """
+        pass
+
+
+class ScenarioGURHandler(GenericScenarioHandler):
+    @swagger.operation(nickname='Get the scenario by name')
+    def get(self, name):
+        """
+            @description: get a single scenario by name
+            @rtype: L{Scenario}
+            @return 200: scenario exist
+            @raise 404: scenario not exist
+        """
+        pass
+
+    @swagger.operation(nickname="Update the scenario by name")
+    def put(self, name):
+        """
+            @description: update a single scenario by name
+            @param body: fields to be updated
+            @type body: L{string}
+            @in body: body
+            @rtype: L{Scenario}
+            @return 200: update success
+            @raise 404: scenario not exist
+            @raise 403: nothing to update
+        """
+        pass
diff --git a/utils/test/testapi/opnfv_testapi/resources/scenario_models.py b/utils/test/testapi/opnfv_testapi/resources/scenario_models.py
new file mode 100644 (file)
index 0000000..0748a37
--- /dev/null
@@ -0,0 +1,87 @@
+import models
+from opnfv_testapi.tornado_swagger import swagger
+
+
+@swagger.model()
+class ScenarioTI(models.ModelBase):
+    def __init__(self, date=None, status='silver'):
+        self.date = date
+        self.status = status
+
+
+@swagger.model()
+class ScenarioScore(models.ModelBase):
+    def __init__(self, date=None, score=''):
+        self.date = date
+        self.score = score
+
+
+@swagger.model()
+class ScenarioProject(models.ModelBase):
+    """
+        @property customs:
+        @ptype customs: C{list} of L{string}
+        @property scores:
+        @ptype scores: C{list} of L{ScenarioScore}
+        @property trust_indicators:
+        @ptype trust_indicators: C{list} of L{ScenarioTI}
+    """
+    def __init__(self,
+                 name='',
+                 customs=None,
+                 scores=None,
+                 trust_indicators=None):
+        self.name = name
+        self.customs = customs
+        self.scores = scores
+        self.trust_indicator = trust_indicators
+
+
+@swagger.model()
+class ScenarioVersion(models.ModelBase):
+    """
+        @property projects:
+        @ptype projects: C{list} of L{ScenarioProject}
+    """
+    def __init__(self, version, projects=None):
+        self.version = version
+        self.projects = projects
+
+
+@swagger.model()
+class ScenarioInstaller(models.ModelBase):
+    """
+        @property versions:
+        @ptype versions: C{list} of L{ScenarioVersion}
+    """
+    def __init__(self, installer=None, owner=None, versions=None):
+        self.installer = installer
+        self.owner = owner
+        self.versions = versions if versions else list()
+
+
+@swagger.model()
+class Scenario(models.ModelBase):
+    """
+        @property installers:
+        @ptype installers: C{list} of L{ScenarioInstaller}
+    """
+    def __init__(self, name='', create_date='', _id='', installers=None):
+        self.name = name
+        self._id = _id
+        self.create_date = create_date
+        self.installers = installers if installers else list()
+
+
+@swagger.model()
+class Scenarios(models.ModelBase):
+    """
+        @property scenarios:
+        @ptype scenarios: C{list} of L{Scenario}
+    """
+    def __init__(self):
+        self.scenarios = list()
+
+    @staticmethod
+    def attr_parser():
+        return {'scenarios': Scenario}
index eb648ec..0ae3c31 100644 (file)
@@ -14,7 +14,8 @@ from opnfv_testapi.resources.project_handlers import ProjectCLHandler, \
     ProjectGURHandler
 from opnfv_testapi.resources.result_handlers import ResultsCLHandler, \
     ResultsGURHandler
-
+from opnfv_testapi.resources.scenario_handlers import ScenariosCLHandler
+from opnfv_testapi.resources.scenario_handlers import ScenarioGURHandler
 
 mappings = [
     # GET /versions => GET API version
@@ -45,4 +46,8 @@ mappings = [
     # (project, case, and pod)
     (r"/api/v1/results", ResultsCLHandler),
     (r"/api/v1/results/([^/]+)", ResultsGURHandler),
+
+    # scenarios
+    (r"/api/v1/scenarios", ScenariosCLHandler),
+    (r"/api/v1/scenarios/([^/]+)", ScenarioGURHandler),
 ]