summaryrefslogtreecommitdiffstats
path: root/cvp/docker/db/init_dovetail.py
diff options
context:
space:
mode:
authorhongbo tian <hongbo.tianhongbo@huawei.com>2017-09-28 09:28:41 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-09-28 09:28:41 +0000
commit61820ee85c967d90021e4089c6a7907046685639 (patch)
tree0c3f23e2146f0855fb5be0ff55343d59e3a9c9ab /cvp/docker/db/init_dovetail.py
parent0cc2fdefa9e6e959e7c69beede736738f339f636 (diff)
parent0cf6b232ac9cf128ee9183a27c08f4f74ab2e2e6 (diff)
Merge "add api&web services for cvp"
Diffstat (limited to 'cvp/docker/db/init_dovetail.py')
-rw-r--r--cvp/docker/db/init_dovetail.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/cvp/docker/db/init_dovetail.py b/cvp/docker/db/init_dovetail.py
new file mode 100644
index 00000000..6d066cbb
--- /dev/null
+++ b/cvp/docker/db/init_dovetail.py
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+import requests
+import datetime
+import json
+import yaml
+import sys
+
+base_url = sys.argv[1]
+headers = {'Content-Type': 'application/json'}
+
+
+def create_project():
+
+ name = 'dovetail'
+ s = '2015-10-14 06:56:09'
+ time = datetime.datetime.strptime(s, '%Y-%m-%d %H:%M:%S')
+
+ data = {
+ 'name': name,
+ 'creation_date': str(time),
+ 'description': ''
+ }
+
+ url = '{}/projects'.format(base_url)
+ requests.post(url, data=json.dumps(data), headers=headers)
+
+
+def dovetail():
+ with open('../../compliance/proposed_tests.yml') as f:
+ data = yaml.safe_load(f)['proposed_tests']['testcases_list']
+
+ url = '{}/projects/dovetail/cases'.format(base_url)
+ for case in data:
+ c = {
+ 'ci_loop': 'daily',
+ 'description': 'dovetail',
+ 'name': case,
+ 'project_name': 'dovetail',
+ 'trust': 'gold',
+ 'url': '',
+ 'version': 'master',
+ 'domains': 'master',
+ 'tags': 'dovetail'
+ }
+ requests.post(url, data=json.dumps(c), headers=headers)
+
+
+if __name__ == '__main__':
+ create_project()
+ dovetail()