aboutsummaryrefslogtreecommitdiffstats
path: root/iceci
diff options
context:
space:
mode:
Diffstat (limited to 'iceci')
-rw-r--r--iceci/__init__.py38
-rw-r--r--iceci/__init__.pycbin0 -> 137 bytes
-rw-r--r--iceci/__pycache__/__init__.cpython-36.pycbin0 -> 133 bytes
-rw-r--r--iceci/__pycache__/admin.cpython-36.pycbin0 -> 1942 bytes
-rw-r--r--iceci/__pycache__/apps.cpython-36.pycbin0 -> 347 bytes
-rw-r--r--iceci/__pycache__/mail.cpython-36.pycbin0 -> 4890 bytes
-rw-r--r--iceci/__pycache__/models.cpython-36.pycbin0 -> 1002 bytes
-rw-r--r--iceci/__pycache__/serializers.cpython-36.pycbin0 -> 1557 bytes
-rw-r--r--iceci/__pycache__/urls.cpython-36.pycbin0 -> 510 bytes
-rw-r--r--iceci/__pycache__/views.cpython-36.pycbin0 -> 6513 bytes
-rw-r--r--iceci/admin.py123
-rw-r--r--iceci/admin.pycbin0 -> 2637 bytes
-rw-r--r--iceci/apps.py43
-rw-r--r--iceci/apps.pycbin0 -> 414 bytes
-rw-r--r--iceci/decorator/__init__.py38
-rw-r--r--iceci/decorator/__init__.pycbin0 -> 147 bytes
-rw-r--r--iceci/decorator/__pycache__/__init__.cpython-36.pycbin0 -> 143 bytes
-rw-r--r--iceci/decorator/__pycache__/exception_decor.cpython-36.pycbin0 -> 995 bytes
-rw-r--r--iceci/decorator/__pycache__/logFuncEntry.cpython-36.pycbin0 -> 1402 bytes
-rw-r--r--iceci/decorator/exception_decor.py70
-rw-r--r--iceci/decorator/logFuncEntry.py75
-rw-r--r--iceci/decorator/logFuncEntry.pycbin0 -> 1760 bytes
-rw-r--r--iceci/decorator/repeat.py49
-rw-r--r--iceci/mail.py173
-rwxr-xr-xiceci/mail.pycbin0 -> 5239 bytes
-rw-r--r--iceci/migrations/0001_initial.py73
-rwxr-xr-xiceci/migrations/0001_initial.pycbin0 -> 1379 bytes
-rw-r--r--iceci/migrations/0002_auto_20160728_1111.py64
-rwxr-xr-xiceci/migrations/0002_auto_20160728_1111.pycbin0 -> 1006 bytes
-rw-r--r--iceci/migrations/0003_auto_20160914_1004.py57
-rwxr-xr-xiceci/migrations/0003_auto_20160914_1004.pycbin0 -> 843 bytes
-rw-r--r--iceci/migrations/0004_testresults_build_id.py58
-rwxr-xr-xiceci/migrations/0004_testresults_build_id.pycbin0 -> 887 bytes
-rw-r--r--iceci/migrations/0005_auto_20161219_0619.py64
-rw-r--r--iceci/migrations/__init__.py38
-rwxr-xr-xiceci/migrations/__init__.pycbin0 -> 148 bytes
-rw-r--r--iceci/migrations/__pycache__/0001_initial.cpython-36.pycbin0 -> 1070 bytes
-rw-r--r--iceci/migrations/__pycache__/0002_auto_20160728_1111.cpython-36.pycbin0 -> 781 bytes
-rw-r--r--iceci/migrations/__pycache__/0003_auto_20160914_1004.cpython-36.pycbin0 -> 635 bytes
-rw-r--r--iceci/migrations/__pycache__/0004_testresults_build_id.cpython-36.pycbin0 -> 670 bytes
-rw-r--r--iceci/migrations/__pycache__/0005_auto_20161219_0619.cpython-36.pycbin0 -> 779 bytes
-rw-r--r--iceci/migrations/__pycache__/__init__.cpython-36.pycbin0 -> 144 bytes
-rw-r--r--iceci/models.py55
-rw-r--r--iceci/models.pycbin0 -> 1282 bytes
-rw-r--r--iceci/serializers.py63
-rwxr-xr-xiceci/serializers.pycbin0 -> 2052 bytes
-rw-r--r--iceci/urls.py48
-rwxr-xr-xiceci/urls.pycbin0 -> 631 bytes
-rw-r--r--iceci/views.py245
-rwxr-xr-xiceci/views.pycbin0 -> 8136 bytes
50 files changed, 1374 insertions, 0 deletions
diff --git a/iceci/__init__.py b/iceci/__init__.py
new file mode 100644
index 0000000..30d7152
--- /dev/null
+++ b/iceci/__init__.py
@@ -0,0 +1,38 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
diff --git a/iceci/__init__.pyc b/iceci/__init__.pyc
new file mode 100644
index 0000000..fba9dad
--- /dev/null
+++ b/iceci/__init__.pyc
Binary files differ
diff --git a/iceci/__pycache__/__init__.cpython-36.pyc b/iceci/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..9858793
--- /dev/null
+++ b/iceci/__pycache__/__init__.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/admin.cpython-36.pyc b/iceci/__pycache__/admin.cpython-36.pyc
new file mode 100644
index 0000000..3a59b92
--- /dev/null
+++ b/iceci/__pycache__/admin.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/apps.cpython-36.pyc b/iceci/__pycache__/apps.cpython-36.pyc
new file mode 100644
index 0000000..c7a5706
--- /dev/null
+++ b/iceci/__pycache__/apps.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/mail.cpython-36.pyc b/iceci/__pycache__/mail.cpython-36.pyc
new file mode 100644
index 0000000..3804d3d
--- /dev/null
+++ b/iceci/__pycache__/mail.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/models.cpython-36.pyc b/iceci/__pycache__/models.cpython-36.pyc
new file mode 100644
index 0000000..7c18f6a
--- /dev/null
+++ b/iceci/__pycache__/models.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/serializers.cpython-36.pyc b/iceci/__pycache__/serializers.cpython-36.pyc
new file mode 100644
index 0000000..48dc607
--- /dev/null
+++ b/iceci/__pycache__/serializers.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/urls.cpython-36.pyc b/iceci/__pycache__/urls.cpython-36.pyc
new file mode 100644
index 0000000..ce7e0b3
--- /dev/null
+++ b/iceci/__pycache__/urls.cpython-36.pyc
Binary files differ
diff --git a/iceci/__pycache__/views.cpython-36.pyc b/iceci/__pycache__/views.cpython-36.pyc
new file mode 100644
index 0000000..3713997
--- /dev/null
+++ b/iceci/__pycache__/views.cpython-36.pyc
Binary files differ
diff --git a/iceci/admin.py b/iceci/admin.py
new file mode 100644
index 0000000..21d8f3a
--- /dev/null
+++ b/iceci/admin.py
@@ -0,0 +1,123 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from django.contrib import admin
+from .models import TestResults
+from django.conf import settings
+
+
+def export_csv(modeladmin, request, queryset):
+ import csv
+# import xlwt
+ from django.utils.encoding import smart_str
+ from django.http import HttpResponse
+ response = HttpResponse(content_type='text/csv')
+ response['Content-Disposition'] = 'attachment; filename=ci_Test_Results.csv'
+ writer = csv.writer(response, csv.excel)
+ # BOM (optional...Excel needs it to open UTF-8 file properly)
+ response.write(u'\ufeff'.encode('utf8'))
+ writer.writerow([
+ smart_str(u"testType"),
+ smart_str(u"testFeature"),
+ smart_str(u"testName"),
+ smart_str(u"testResult"),
+ smart_str(u"notes"),
+ smart_str(u"duration"),
+ smart_str(u"build_id"),
+ smart_str(u"create_time"),
+ ])
+
+ total_counter = 0
+ fail_counter = 0
+ pass_counter = 0
+ for obj in queryset:
+ total_counter += 1
+ if obj.testResult == 'FAIL':
+ fail_counter += 1
+ elif obj.testResult == 'PASS':
+ pass_counter += 1
+
+ writer.writerow([
+ smart_str(obj.testType),
+ smart_str(obj.testFeature),
+ smart_str(obj.testName),
+ smart_str(obj.testResult),
+ smart_str(obj.notes),
+ smart_str(obj.duration),
+ smart_str(obj.build_id),
+ smart_str(obj.create_time),
+ ])
+ # calsl evaluation
+ evaultaion = as_percentage_of(pass_counter, total_counter)
+ # title
+ writer.writerow([
+ smart_str(u"total_counter"),
+ smart_str(u"fail_counter"),
+ smart_str(u"pass_counter"),
+ smart_str(u"evaultaion"),
+ ])
+ # values
+ writer.writerow([
+ smart_str(total_counter),
+ smart_str(fail_counter),
+ smart_str(pass_counter),
+ smart_str(evaultaion),
+ ])
+
+ return response
+# export_csv.short_description = u"Export CSV" ### Check this action meaning.
+
+
+def as_percentage_of(part, whole):
+ try:
+ return "%d%%" % (float(part) / whole * 100)
+ except (ValueError, ZeroDivisionError):
+ return ""
+
+
+@admin.register(TestResults)
+class TestResultsModelAdmin(admin.ModelAdmin):
+
+ list_display = ["testType", "testFeature", "testName",
+ "testResult", "notes", "duration", "build_id", "create_time"]
+ list_filter = ["testResult", "testType", "testFeature",
+ "testName", "notes", "duration", "build_id", "create_time"]
+ search_fields = ["testResult", "testType", "testFeature", "testName",
+ "notes", "duration", "build_id", "create_time"]
+ actions = [export_csv]
+ list_per_page = settings.NUMBER_OF_TEST_RESULTS
diff --git a/iceci/admin.pyc b/iceci/admin.pyc
new file mode 100644
index 0000000..c047436
--- /dev/null
+++ b/iceci/admin.pyc
Binary files differ
diff --git a/iceci/apps.py b/iceci/apps.py
new file mode 100644
index 0000000..1e33154
--- /dev/null
+++ b/iceci/apps.py
@@ -0,0 +1,43 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from django.apps import AppConfig
+
+
+class IceCiConfig(AppConfig):
+ name = 'iceci'
diff --git a/iceci/apps.pyc b/iceci/apps.pyc
new file mode 100644
index 0000000..40ff960
--- /dev/null
+++ b/iceci/apps.pyc
Binary files differ
diff --git a/iceci/decorator/__init__.py b/iceci/decorator/__init__.py
new file mode 100644
index 0000000..30d7152
--- /dev/null
+++ b/iceci/decorator/__init__.py
@@ -0,0 +1,38 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
diff --git a/iceci/decorator/__init__.pyc b/iceci/decorator/__init__.pyc
new file mode 100644
index 0000000..46251cd
--- /dev/null
+++ b/iceci/decorator/__init__.pyc
Binary files differ
diff --git a/iceci/decorator/__pycache__/__init__.cpython-36.pyc b/iceci/decorator/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..1c87097
--- /dev/null
+++ b/iceci/decorator/__pycache__/__init__.cpython-36.pyc
Binary files differ
diff --git a/iceci/decorator/__pycache__/exception_decor.cpython-36.pyc b/iceci/decorator/__pycache__/exception_decor.cpython-36.pyc
new file mode 100644
index 0000000..582fb86
--- /dev/null
+++ b/iceci/decorator/__pycache__/exception_decor.cpython-36.pyc
Binary files differ
diff --git a/iceci/decorator/__pycache__/logFuncEntry.cpython-36.pyc b/iceci/decorator/__pycache__/logFuncEntry.cpython-36.pyc
new file mode 100644
index 0000000..ce3d14f
--- /dev/null
+++ b/iceci/decorator/__pycache__/logFuncEntry.cpython-36.pyc
Binary files differ
diff --git a/iceci/decorator/exception_decor.py b/iceci/decorator/exception_decor.py
new file mode 100644
index 0000000..467f2ce
--- /dev/null
+++ b/iceci/decorator/exception_decor.py
@@ -0,0 +1,70 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import logging
+import traceback
+
+from services.logging_service import LoggingServiceFactory
+from services.session import session
+
+
+logger = LoggingServiceFactory.get_logger()
+
+
+def exception():
+ """
+ A decorator that wraps the passed in function and logs
+ exceptions should one occur
+
+ @param logger: The logging object
+ """
+
+ def decorator(func):
+
+ def wrapper(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except:
+ err = "There was an exception in %s" % func.__name__
+ logger.error(err)
+ session.errorCounter += 1
+ session.errorList = traceback.format_exc()
+ raise
+
+ return wrapper
+ return decorator
diff --git a/iceci/decorator/logFuncEntry.py b/iceci/decorator/logFuncEntry.py
new file mode 100644
index 0000000..0995f3b
--- /dev/null
+++ b/iceci/decorator/logFuncEntry.py
@@ -0,0 +1,75 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from services.logging_service import LoggingServiceFactory
+logger = LoggingServiceFactory.get_logger()
+
+def _aop(decorator):
+ '''This decorator can be used to turn simple functions
+ into well-behaved decorators, so long as the decorators
+ are fairly simple. If a decorator expects a function and
+ returns a function (no descriptors), and if it doesn't
+ modify function attributes or docstring, then it is
+ eligible to use this. Simply apply @_aop to
+ your decorator and it will automatically preserve the
+ docstring and function attributes of functions to which
+ it is applied.'''
+ def new_decorator(f):
+ g = decorator(f)
+ g.__name__ = f.__name__
+ g.__doc__ = f.__doc__
+ g.__dict__.update(f.__dict__)
+ return g
+
+ # Now a few lines needed to make _aop itself
+ # be a well-behaved decorator.
+ new_decorator.__name__ = decorator.__name__
+ new_decorator.__doc__ = decorator.__doc__
+ new_decorator.__dict__.update(decorator.__dict__)
+ return new_decorator
+
+#
+# Sample Use:
+#
+@_aop
+def logFuncEntry(func):
+ def foo(*args, **kwargs):
+ logger.debug('calling {}'.format(func.__name__)+" | "+str(args)+" | "+str(kwargs))
+ return func(*args, **kwargs)
+ return foo
+
diff --git a/iceci/decorator/logFuncEntry.pyc b/iceci/decorator/logFuncEntry.pyc
new file mode 100644
index 0000000..541fede
--- /dev/null
+++ b/iceci/decorator/logFuncEntry.pyc
Binary files differ
diff --git a/iceci/decorator/repeat.py b/iceci/decorator/repeat.py
new file mode 100644
index 0000000..38eac03
--- /dev/null
+++ b/iceci/decorator/repeat.py
@@ -0,0 +1,49 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import unittest,time
+def repeat(times):
+ def repeatHelper(f):
+ def callHelper(*args):
+ for i in range(0, times):
+ f(*args)
+ time.sleep(3)
+ return callHelper
+ time.sleep(3)
+ return repeatHelper
+
diff --git a/iceci/mail.py b/iceci/mail.py
new file mode 100644
index 0000000..9f23b90
--- /dev/null
+++ b/iceci/mail.py
@@ -0,0 +1,173 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+##################################################################################################
+'''
+Created on Apr 20, 2016
+
+@author: ya107f
+'''
+import socket
+from string import Template
+import traceback
+
+from django.conf import settings
+from django.core.mail import send_mail
+from django.utils import timezone
+
+from services.constants import Constants
+from services.logging_service import LoggingServiceFactory
+
+
+admin_mail_from = settings.ICE_CONTACT_FROM_ADDRESS
+# lastBuild = ""
+param = "1"
+logger = LoggingServiceFactory.get_logger()
+
+def sendMail(param,email, data, mail_body, mail_subject, mail_from=admin_mail_from):
+ logger.debug("about to send mail to " + email)
+
+ try:
+# lastBuild = param
+ html_msg = mail_body.substitute(data)
+ mail_subject = mail_subject.substitute(data)
+ #send mail with template
+ send_mail(mail_subject, '', Constants.FEGeneral.ProgramName.name +"-CI Report Test Team <" + mail_from + ">",settings.ICE_CONTACT_EMAILS , fail_silently=False, html_message=html_msg)
+ logger.debug("Looks like email delivery to "+email+" has succeeded")
+ except Exception:
+ traceback.print_exc()
+ raise
+
+##########################
+# For Contact Request #
+##########################
+lastBuild= param
+dt = timezone.now().strftime("%Y-%m-%d %H:%M:%S")
+#envIP = str(socket.gethostbyname(socket.gethostname()))
+envIP = str(socket.gethostname())
+testsResults_mail_subject = Template("""CI Testing results """+ str(dt))
+testsResults_mail_to = settings.ICE_CONTACT_EMAILS
+testsResults_mail_body = Template("""
+<html>
+ <head>
+ <title>CI Test Report</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+ </head>
+ <body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
+ <a href="http://172.20.31.59:9090/">Jenkins Link for Build</a>
+ <h3>Environment name : """+ settings.ICE_CI_ENVIRONMENT_NAME + """</h3>
+ <h3>Environment IP : """ + envIP + """</h3>
+ <h2>Tests summary</h2>
+
+ <table id="versions" style="border:1px solid black">
+ <tr>
+ <th scope="col" class="sortable column-testVersion">
+ <div class="text"><a href="#">Last Build Version</a></div>
+ <div class="clear"></div>
+ </th>
+ </tr>
+ <tbody>
+ $paramData
+ </tbody>
+ </table>
+
+ <table id="statistics" style="border:1px solid black">
+ <tr>
+ <th scope="col" class="sortable column-testTotal">
+ <div class="text"><a href="#">Total</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-testPass">
+ <div class="text"><a href="#">Pass</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-tesFail">
+ <div class="text"><a href="#">Fail</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-testEvaultaion">
+ <div class="text"><a href="#">Successful</a></div>
+ <div class="clear"></div>
+ </th>
+ </tr>
+ <tbody>
+ $statisticData
+ </tbody>
+ </table>
+
+ <table id="result_list" style="border:1px solid blue">
+ <tr>
+ <th scope="col" class="sortable column-testType">
+ <div class="text"><a href="#">TestType</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-testFeature">
+ <div class="text"><a href="#">TestFeature</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-testName">
+ <div class="text"><a href="#">TestName</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-testResult">
+ <div class="text"><a href="#">TestResult</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-notes">
+ <div class="text"><a href="#">Notes</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-duration">
+ <div class="text"><a href="#">Duration</a></div>
+ <div class="clear"></div>
+ </th>
+ <th scope="col" class="sortable column-create_time">
+ <div class="text"><a href="#">Creation time</a></div>
+ <div class="clear"></div>
+ </th>
+ </tr>
+ <tbody>
+ $allData
+ </tbody>
+ </table>
+
+ </body>
+</html>
+
+""")
+
diff --git a/iceci/mail.pyc b/iceci/mail.pyc
new file mode 100755
index 0000000..025ee39
--- /dev/null
+++ b/iceci/mail.pyc
Binary files differ
diff --git a/iceci/migrations/0001_initial.py b/iceci/migrations/0001_initial.py
new file mode 100644
index 0000000..5441f12
--- /dev/null
+++ b/iceci/migrations/0001_initial.py
@@ -0,0 +1,73 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# Generated by Django 1.9.7 on 2016-06-06 13:51
+from __future__ import unicode_literals
+
+import datetime
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='TestResults',
+ fields=[
+ ('id', models.AutoField(
+ auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('testType', models.CharField(max_length=64)),
+ ('testCaseName', models.CharField(max_length=64)),
+ ('testResult', models.CharField(max_length=64)),
+ ('testName', models.CharField(max_length=64)),
+ ('notes', models.TextField(
+ blank=True, max_length=1024, null=True)),
+ ('create_time', models.DateTimeField(default=datetime.datetime(
+ 2016, 6, 6, 16, 50, 59, 963000), verbose_name='creation time')),
+ ],
+ options={
+ 'db_table': 'ice_test_results',
+ 'verbose_name_plural': 'Tests Results',
+ },
+ ),
+ ]
diff --git a/iceci/migrations/0001_initial.pyc b/iceci/migrations/0001_initial.pyc
new file mode 100755
index 0000000..090a1ae
--- /dev/null
+++ b/iceci/migrations/0001_initial.pyc
Binary files differ
diff --git a/iceci/migrations/0002_auto_20160728_1111.py b/iceci/migrations/0002_auto_20160728_1111.py
new file mode 100644
index 0000000..e8cdb00
--- /dev/null
+++ b/iceci/migrations/0002_auto_20160728_1111.py
@@ -0,0 +1,64 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# Generated by Django 1.9.7 on 2016-07-28 08:11
+from __future__ import unicode_literals
+
+import datetime
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('iceci', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='testresults',
+ old_name='testCaseName',
+ new_name='testFeature',
+ ),
+ migrations.AlterField(
+ model_name='testresults',
+ name='create_time',
+ field=models.DateTimeField(
+ default=datetime.datetime.now, verbose_name='creation time'),
+ ),
+ ]
diff --git a/iceci/migrations/0002_auto_20160728_1111.pyc b/iceci/migrations/0002_auto_20160728_1111.pyc
new file mode 100755
index 0000000..47ac6fd
--- /dev/null
+++ b/iceci/migrations/0002_auto_20160728_1111.pyc
Binary files differ
diff --git a/iceci/migrations/0003_auto_20160914_1004.py b/iceci/migrations/0003_auto_20160914_1004.py
new file mode 100644
index 0000000..88a27df
--- /dev/null
+++ b/iceci/migrations/0003_auto_20160914_1004.py
@@ -0,0 +1,57 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# Generated by Django 1.9.7 on 2016-09-14 10:04
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('iceci', '0002_auto_20160728_1111'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='testresults',
+ name='notes',
+ field=models.TextField(blank=True, null=True),
+ ),
+ ]
diff --git a/iceci/migrations/0003_auto_20160914_1004.pyc b/iceci/migrations/0003_auto_20160914_1004.pyc
new file mode 100755
index 0000000..308df71
--- /dev/null
+++ b/iceci/migrations/0003_auto_20160914_1004.pyc
Binary files differ
diff --git a/iceci/migrations/0004_testresults_build_id.py b/iceci/migrations/0004_testresults_build_id.py
new file mode 100644
index 0000000..d4ba634
--- /dev/null
+++ b/iceci/migrations/0004_testresults_build_id.py
@@ -0,0 +1,58 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# Generated by Django 1.9.7 on 2016-09-26 13:25
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('iceci', '0003_auto_20160914_1004'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='testresults',
+ name='build_id',
+ field=models.TextField(
+ blank=True, default=b'2016,09,26,25,41', null=True),
+ ),
+ ]
diff --git a/iceci/migrations/0004_testresults_build_id.pyc b/iceci/migrations/0004_testresults_build_id.pyc
new file mode 100755
index 0000000..bd87590
--- /dev/null
+++ b/iceci/migrations/0004_testresults_build_id.pyc
Binary files differ
diff --git a/iceci/migrations/0005_auto_20161219_0619.py b/iceci/migrations/0005_auto_20161219_0619.py
new file mode 100644
index 0000000..ad12901
--- /dev/null
+++ b/iceci/migrations/0005_auto_20161219_0619.py
@@ -0,0 +1,64 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# Generated by Django 1.9.7 on 2016-12-19 06:19
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('iceci', '0004_testresults_build_id'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='testresults',
+ name='duration',
+ field=models.CharField(default='000', max_length=64),
+ preserve_default=False,
+ ),
+ migrations.AlterField(
+ model_name='testresults',
+ name='build_id',
+ field=models.TextField(
+ blank=True, default=b'2016-12-19-14-18-40', null=True),
+ ),
+ ]
diff --git a/iceci/migrations/__init__.py b/iceci/migrations/__init__.py
new file mode 100644
index 0000000..30d7152
--- /dev/null
+++ b/iceci/migrations/__init__.py
@@ -0,0 +1,38 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
diff --git a/iceci/migrations/__init__.pyc b/iceci/migrations/__init__.pyc
new file mode 100755
index 0000000..3c41b4c
--- /dev/null
+++ b/iceci/migrations/__init__.pyc
Binary files differ
diff --git a/iceci/migrations/__pycache__/0001_initial.cpython-36.pyc b/iceci/migrations/__pycache__/0001_initial.cpython-36.pyc
new file mode 100644
index 0000000..a1976ee
--- /dev/null
+++ b/iceci/migrations/__pycache__/0001_initial.cpython-36.pyc
Binary files differ
diff --git a/iceci/migrations/__pycache__/0002_auto_20160728_1111.cpython-36.pyc b/iceci/migrations/__pycache__/0002_auto_20160728_1111.cpython-36.pyc
new file mode 100644
index 0000000..f147368
--- /dev/null
+++ b/iceci/migrations/__pycache__/0002_auto_20160728_1111.cpython-36.pyc
Binary files differ
diff --git a/iceci/migrations/__pycache__/0003_auto_20160914_1004.cpython-36.pyc b/iceci/migrations/__pycache__/0003_auto_20160914_1004.cpython-36.pyc
new file mode 100644
index 0000000..ed2d2ee
--- /dev/null
+++ b/iceci/migrations/__pycache__/0003_auto_20160914_1004.cpython-36.pyc
Binary files differ
diff --git a/iceci/migrations/__pycache__/0004_testresults_build_id.cpython-36.pyc b/iceci/migrations/__pycache__/0004_testresults_build_id.cpython-36.pyc
new file mode 100644
index 0000000..9a9c0a8
--- /dev/null
+++ b/iceci/migrations/__pycache__/0004_testresults_build_id.cpython-36.pyc
Binary files differ
diff --git a/iceci/migrations/__pycache__/0005_auto_20161219_0619.cpython-36.pyc b/iceci/migrations/__pycache__/0005_auto_20161219_0619.cpython-36.pyc
new file mode 100644
index 0000000..fcdb7b6
--- /dev/null
+++ b/iceci/migrations/__pycache__/0005_auto_20161219_0619.cpython-36.pyc
Binary files differ
diff --git a/iceci/migrations/__pycache__/__init__.cpython-36.pyc b/iceci/migrations/__pycache__/__init__.cpython-36.pyc
new file mode 100644
index 0000000..dfabfb8
--- /dev/null
+++ b/iceci/migrations/__pycache__/__init__.cpython-36.pyc
Binary files differ
diff --git a/iceci/models.py b/iceci/models.py
new file mode 100644
index 0000000..a448eb4
--- /dev/null
+++ b/iceci/models.py
@@ -0,0 +1,55 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from __future__ import unicode_literals
+from django.db import models
+import datetime
+from django.conf import settings
+
+class TestResults(models.Model):
+ testType = models.CharField(max_length=64)
+ testFeature = models.CharField(max_length=64)
+ testName = models.CharField(max_length=64)
+ testResult = models.CharField(max_length=64)
+ notes = models.TextField(null=True, blank=True)
+ duration = models.CharField(max_length=64)
+ build_id = models.TextField(null=True, blank=True,default=settings.ICE_BUILD_REPORT_NUM)
+ create_time = models.DateTimeField('creation time', default=datetime.datetime.now)
+ class Meta:
+ db_table = "ice_test_results"
+ verbose_name_plural = 'Tests Results'
diff --git a/iceci/models.pyc b/iceci/models.pyc
new file mode 100644
index 0000000..b61dae6
--- /dev/null
+++ b/iceci/models.pyc
Binary files differ
diff --git a/iceci/serializers.py b/iceci/serializers.py
new file mode 100644
index 0000000..b597c10
--- /dev/null
+++ b/iceci/serializers.py
@@ -0,0 +1,63 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from rest_framework import serializers
+from .models import TestResults
+
+class TestResultsModelSerializer(serializers.ModelSerializer):
+ class Meta:
+ model = TestResults
+ fields = ('testType', 'testFeature', 'testName', 'testResult', 'notes', 'create_time',)
+
+class TestResultsSerializer(serializers.Serializer):
+ class Meta:
+ model = TestResults
+ fields = ('testType', 'testFeature', 'testName', 'testResult', 'notes', 'create_time',)
+
+ def create(self, validated_data):
+ return TestResults(**validated_data)
+
+ def update(self, instance, validated_data):
+ instance.testType = validated_data.get('testType', instance.testType)
+ instance.testFeature = validated_data.get('testFeature', instance.testFeature)
+ instance.testName = validated_data.get('testName', instance.testName)
+ instance.testResult = validated_data.get('testResult', instance.testResult)
+ instance.notes = validated_data.get('notes', instance.notes)
+ instance.duration = validated_data.get('duration', instance.duration)
+ instance.create_time = validated_data.get('create_time', instance.create_time)
+ return instance
diff --git a/iceci/serializers.pyc b/iceci/serializers.pyc
new file mode 100755
index 0000000..de41aa6
--- /dev/null
+++ b/iceci/serializers.pyc
Binary files differ
diff --git a/iceci/urls.py b/iceci/urls.py
new file mode 100644
index 0000000..baf47d2
--- /dev/null
+++ b/iceci/urls.py
@@ -0,0 +1,48 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+from django.conf.urls import url
+from . import views
+
+urlpatterns = [
+ url(r'^testresults/?$', views.testResult_list),
+ url(r'^testresults/(?P<param>.*)$', views.testResult_detail),
+ url(r'^testresultstomail/(?P<param>.*)$', views.testResult_list_to_mail),
+ url(r'^testresultstohtml/(?P<param>.*)$', views.testResult_list_to_html_file),
+ url(r'^testresultstr/(?P<param>.*)$', views.testResultStr)
+]
diff --git a/iceci/urls.pyc b/iceci/urls.pyc
new file mode 100755
index 0000000..fae3472
--- /dev/null
+++ b/iceci/urls.pyc
Binary files differ
diff --git a/iceci/views.py b/iceci/views.py
new file mode 100644
index 0000000..7e0505d
--- /dev/null
+++ b/iceci/views.py
@@ -0,0 +1,245 @@
+
+# ============LICENSE_START==========================================
+# org.onap.vvp/test-engine
+# ===================================================================
+# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the “License”);
+# you may not use this software except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+#
+#
+# Unless otherwise specified, all documentation contained herein is licensed
+# under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+# you may not use this documentation except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://creativecommons.org/licenses/by/4.0/
+#
+# Unless required by applicable law or agreed to in writing, documentation
+# 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.
+#
+# ============LICENSE_END============================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+import logging
+from string import Template
+
+from django.conf import settings
+from django.http import HttpResponse
+from django.views.decorators.csrf import csrf_exempt
+from rest_framework.parsers import JSONParser
+from rest_framework.renderers import JSONRenderer
+
+from iceci import mail
+from iceci.mail import testsResults_mail_body
+from services.constants import Constants
+from services.logging_service import LoggingServiceFactory
+
+from .models import TestResults
+from .serializers import TestResultsModelSerializer
+
+
+LAST_BUILD_REPORT_NUM = None
+# from django.core.mail import send_mail
+# from . import mail
+logger = LoggingServiceFactory.get_logger()
+
+def index(request):
+ return HttpResponse("Hello, world. You're at the "+Constants.FEGeneral.ProgramName.name+" ci index.")
+
+@csrf_exempt
+def testResult_list(request): # List all tests, or create a new test.
+ if (request.method == 'DELETE' or request.method == 'PUT'):
+ return HttpResponse(status=405)
+
+ if request.method == 'GET':
+ testResult = TestResults.objects.all()
+ serializer = TestResultsModelSerializer(testResult, many=True)
+ return JSONResponse(serializer.data)
+
+ elif request.method == 'POST':
+ data = JSONParser().parse(request)
+ serializer = TestResultsModelSerializer(data=data)
+ if serializer.is_valid():
+ serializer.save()
+ return JSONResponse(serializer.data, status=201)
+ return JSONResponse(serializer.errors, status=400)
+@csrf_exempt
+def testResultStr(request,param): # List all tests, or create a new test.
+ try:
+ testResults = TestResults.objects.filter(build_id=param)
+ pass_counter, total_counter, statisticData, fail_counter = strReportForTestResults(testResults)
+ evaultaion = as_percentage_of(pass_counter, total_counter)
+ except Exception as e:
+ msg = "Something went wrong while trying to send Test Results " + str(e)
+ return HttpResponse(msg, status=500)
+
+ msg = "Total Tests: " + str(total_counter) +" Pass Tests: " + str(pass_counter)+" Fail Tests: "+ str(fail_counter) + " Statistics : " + str(evaultaion) + " BUILD_REPORT_NUM : "+str(param)
+ return HttpResponse(msg, status=200)
+
+@csrf_exempt
+def testResult_detail(request, param): # Retrieve, update or delete a test.
+ if request.method == 'POST':
+ return HttpResponse(status=405)
+
+ param = param.strip("/")
+
+ try:
+ testResult = TestResults.objects.get(name=param)
+ except TestResults.DoesNotExist:
+ return HttpResponse(status=404)
+
+ if request.method == 'GET':
+ serializer = TestResultsModelSerializer(testResult)
+ return JSONResponse(serializer.data)
+
+ elif request.method == 'PUT':
+ data = JSONParser().parse(request)
+ serializer = TestResultsModelSerializer(testResult, data=data)
+ if serializer.is_valid():
+ serializer.save()
+ return JSONResponse(serializer.data)
+ return JSONResponse(serializer.errors, status=400)
+
+ elif request.method == 'DELETE':
+ testResult.delete()
+ return HttpResponse(status=204)
+
+#===============================================================================
+# def testResult_post_action(request, data):
+#
+# logger.debug("about to send mail to " + data['email'])
+#
+# html_msg = mail.mail_body.substitute(data)
+# #send mail with template
+# send_mail(mail.mail_subject,
+# '',
+# mail.mail_from,
+# mail.mail_to,
+# fail_silently=False,
+# html_message=html_msg)
+#===============================================================================
+def createHtmlStrReportForTestResults(testResults):
+ total_counter = 0
+ fail_counter = 0
+ pass_counter = 0
+ statisticData = ""
+ str2 = "<tr class='row1'>" + "<th class='field-testTotal'>@Total</th>" + "<td class='field-testPass'>@Pass</td>" + "<td class='field-tesFail'>@Fail</td>" + "<td class='field-testEvaultaion'>@Evaultaion</td>" + "</tr>"
+ paramData = ""
+ str3 = "<tr class='row2'>" + "<th class='field-testTotal'>@Version</th>" + "</tr>"
+ allData = ""
+ str = "<tr class='row1'>" + "<th class='field-testType'>@TestType</th>" + "<td class='field-testFeature'>@TestFeature</td>" + "<td class='field-testName'>@TestName</td>" + "<td class='field-testResult'>@TestResult</td>" + "<td class='field-notes'>@Notes</td>" + "<td class='field-create_time nowrap'>@Creation_time</td>" + "</tr>"
+ for res in testResults: # testResults
+ allData += str.replace("@TestType", str(res.testType)).replace("@TestFeature", str(res.testFeature)).replace("@TestName", str(res.testName)).replace("@TestResult", str(res.testResult)).replace("@Notes", str(res.notes)).replace("@Creation_time", str(res.create_time))
+ total_counter += 1
+ if (res.testResult == "PASS"):
+ pass_counter += 1
+ else:
+ fail_counter += 1
+
+ return pass_counter, total_counter, statisticData, str2, fail_counter, paramData, str3, allData
+
+def strReportForTestResults(testResults):
+ total_counter = 0
+ fail_counter = 0
+ pass_counter = 0
+ statisticData = ""
+ for res in testResults: # testResults
+ total_counter += 1
+ if (res.testResult == "PASS"):
+ pass_counter += 1
+ else:
+ fail_counter += 1
+
+ return pass_counter, total_counter, statisticData, fail_counter
+
+@csrf_exempt
+def testResult_list_to_mail(request,param): # List all tests, or create a new test.
+ if (request.method == 'DELETE' or request.method == 'PUT' or request.method == 'POST'):
+ return HttpResponse(status=405)
+
+ data = dict()
+
+ print("BUILD_REPORT_NUM = "+settings.ICE_BUILD_REPORT_NUM)
+
+ testResults = TestResults.objects.filter(build_id=param)
+
+ pass_counter, total_counter, statisticData, str2, fail_counter, paramData, str3, allData = createHtmlStrReportForTestResults(testResults)
+
+ evaultaion = as_percentage_of(pass_counter, total_counter)
+ statisticData += str2.replace("@Total", str(total_counter)).replace("@Pass", str(pass_counter)).replace("@Fail", str(fail_counter)).replace("@Evaultaion", str(evaultaion))
+ paramData += str3.replace("@Version", str(param))
+ data['email'] = "rgafiulin@interwise.com"
+ data['allData'] = str(allData)
+ data['statisticData'] = str(statisticData)
+ data['paramData'] = str(paramData)
+
+ mail.testsResults_mail_to = data['email']
+ try:
+ mail.sendMail(param,data['email'], data, mail.testsResults_mail_body, mail.testsResults_mail_subject)
+ except Exception as e:
+ msg = "Something went wrong while trying to send Test Report mail to " + data['email'] + str(e)
+ return HttpResponse(msg, status=500)
+
+ serializer = TestResultsModelSerializer(testResults, many=True)
+ return JSONResponse(serializer.data)
+
+@csrf_exempt
+def testResult_list_to_html_file(request,param):
+ if (request.method == 'DELETE' or request.method == 'PUT' or request.method == 'POST'):
+ return HttpResponse(status=405)
+
+ data = dict()
+
+ print("BUILD_REPORT_NUM = "+settings.ICE_BUILD_REPORT_NUM)
+
+ testResults = TestResults.objects.filter(build_id=settings.ICE_BUILD_REPORT_NUM)
+
+ pass_counter, total_counter, statisticData, str2, fail_counter, paramData, str3, allData = createHtmlStrReportForTestResults(testResults)
+
+ evaultaion = as_percentage_of(pass_counter, total_counter)
+ statisticData += str2.replace("@Total", str(total_counter)).replace("@Pass", str(pass_counter)).replace("@Fail", str(fail_counter)).replace("@Evaultaion", str(evaultaion))
+ paramData += str3.replace("@Version", str(param))
+
+ data['allData'] = str(allData)
+ data['statisticData'] = str(statisticData)
+ data['paramData'] = str(paramData)
+
+ html_msg = testsResults_mail_body.substitute(data)
+ fileName = settings.LOGS_PATH+"Test_Results_"+settings.ICE_BUILD_REPORT_NUM+".html"
+ try:
+ with open(fileName, "w") as text_file:
+ text_file.write(html_msg)
+ except Exception as e:
+ msg = "Something went wrong while trying to write the tet results to html file " +fileName +" "+ str(e)
+ return HttpResponse(msg, status=500)
+
+ serializer = TestResultsModelSerializer(testResults, many=True)
+ return JSONResponse(serializer.data)
+
+def as_percentage_of(part, whole):
+ try:
+ return "%d%%" % (float(part) / whole * 100)
+ except (ValueError, ZeroDivisionError):
+ return ""
+
+class JSONResponse(HttpResponse): # An HttpResponse that renders its content into JSON.
+ def __init__(self, data, **kwargs):
+ content = JSONRenderer().render(data)
+ kwargs['content_type'] = 'application/json'
+ super(JSONResponse, self).__init__(content, **kwargs)
diff --git a/iceci/views.pyc b/iceci/views.pyc
new file mode 100755
index 0000000..2ba7576
--- /dev/null
+++ b/iceci/views.pyc
Binary files differ