From 29dbb3106d28d6e53f0263eb34020cedd1fbd390 Mon Sep 17 00:00:00 2001 From: mrichomme Date: Tue, 16 Jun 2020 18:32:13 +0200 Subject: Initiate check certificate validity test Issue-ID: INT-1570 Signed-off-by: mrichomme Change-Id: I9794ec17a254ac21e87e3a251b6cad849a763742 Signed-off-by: mrichomme --- .../check_certificates/templates/base.html.j2 | 231 +++++++++++++++++++++ .../templates/cert-nodeports.html.j2 | 129 ++++++++++++ 2 files changed, 360 insertions(+) create mode 100644 test/security/check_certificates/check_certificates/templates/base.html.j2 create mode 100644 test/security/check_certificates/check_certificates/templates/cert-nodeports.html.j2 (limited to 'test/security/check_certificates/check_certificates/templates') diff --git a/test/security/check_certificates/check_certificates/templates/base.html.j2 b/test/security/check_certificates/check_certificates/templates/base.html.j2 new file mode 100644 index 000000000..cbb4e4428 --- /dev/null +++ b/test/security/check_certificates/check_certificates/templates/base.html.j2 @@ -0,0 +1,231 @@ +{% macro color(failing, total) %} +{% if failing == 0 %} +is-success +{% else %} +{% if (failing / total) <= 0.1 %} +is-warning +{% else %} +is-danger +{% endif %} +{% endif %} +{% endmacro %} + +{% macro percentage(failing, total) %} +{{ ((total - failing) / total) | round }} +{% endmacro %} + +{% macro statistic(resource_name, failing, total) %} +{% set success = total - failing %} +
+
+

{{ resource_name | capitalize }}

+

{{ success }}/{{ total }}

+ {{ percentage(failing, total) }} +
+
+{% endmacro %} + +{% macro pods_table(pods) %} +
+ + + + + + + + + + + + {% for pod in pods %} + + + {% if pod.init_done %} + + {% else %} + + {% endif %} + + + {% if pod.init_done %} + + {% else %} + + {% endif %} + + {% endfor %} + +
NameReadyStatusReasonRestarts
{{ pod.k8s.metadata.name }}{{ pod.running_containers }}/{{ (pod.containers | length) }}Init:{{ pod.runned_init_containers }}/{{ (pod.init_containers | length) }}{{ pod.k8s.status.phase }}{{ pod.k8s.status.reason }}{{ pod.restart_count }}{{ pod.init_restart_count }}
+
+{% endmacro %} + +{% macro key_value_description_list(title, dict) %} +
{{ title | capitalize }}:
+
+ {% if dict %} + {% for key, value in dict.items() %} + {% if loop.first %} +
+ {% endif %} +
{{ key }}:
+
{{ value }}
+ {% if loop.last %} +
+ {% endif %} + {% endfor %} + {% endif %} +
+{% endmacro %} + +{% macro description(k8s) %} +
+

Description

+
+
+ {% if k8s.spec.type %} +
Type:
+
{{ k8s.spec.type }}
+ {% if (k8s.spec.type | lower) == "clusterip" %} +
Headless:
+
{% if (k8s.spec.cluster_ip | lower) == "none" %}Yes{% else %}No{% endif %}
+ {% endif %} + {% endif %} + {{ key_value_description_list('Labels', k8s.metadata.labels) | indent(width=6) }} + {{ key_value_description_list('Annotations', k8s.metadata.annotations) | indent(width=6) }} + {% if k8s.spec.selector %} + {% if k8s.spec.selector.match_labels %} + {{ key_value_description_list('Selector', k8s.spec.selector.match_labels) | indent(width=6) }} + {% else %} + {{ key_value_description_list('Selector', k8s.spec.selector) | indent(width=6) }} + {% endif %} + {% endif %} + {% if k8s.phase %} +
Status:
+
{{ k8s.phase }}
+ {% endif %} + {% if k8s.metadata.owner_references %} +
Controlled By:
+
{{ k8s.metadata.owner_references[0].kind }}/{{ k8s.metadata.owner_references[0].name }}
+ {% endif %} +
+
+
+{% endmacro %} + +{% macro pods_container(pods, parent, has_title=True) %} +
+ {% if has_title %} +

Pods

+ {% endif %} + {% if (pods | length) > 0 %} + {{ pods_table(pods) | indent(width=2) }} + {% else %} +
{{ parent }} has no pods!
+ {% endif %} +
+{% endmacro %} + +{% macro two_level_breadcrumb(title, name) %} +
+ +
+{% endmacro %} + +{% macro pod_parent_summary(title, name, failed_pods, pods) %} +{{ summary(title, name, [{'title': 'Pod', 'failing': failed_pods, 'total': (pods | length)}]) }} +{% endmacro %} + +{% macro number_ok(number, none_value, total=None) %} +{% if number %} +{% if total and number < total %} +{{ number }} +{% else %} +{{ number }} +{% endif %} +{% else %} +{{ none_value }} +{% endif %} +{% endmacro %} + +{% macro summary(title, name, statistics) %} +
+
+
+

+ {{ title | capitalize }} {{ name }} Summary +

+ +
+
+
+{% endmacro %} + + + + + + + Tests results - {% block title %}{% endblock %} + + + {% block more_head %}{% endblock %} + + + + + {% block content %}{% endblock %} + + + + diff --git a/test/security/check_certificates/check_certificates/templates/cert-nodeports.html.j2 b/test/security/check_certificates/check_certificates/templates/cert-nodeports.html.j2 new file mode 100644 index 000000000..df37c3da9 --- /dev/null +++ b/test/security/check_certificates/check_certificates/templates/cert-nodeports.html.j2 @@ -0,0 +1,129 @@ +{% extends "base.html.j2" %} +{% block title %}ONAP Certificates expiration page{% endblock %} + +{% block content %} +

ONAP Certificates

+
+
+

Node ports

+ + + + + + + + + + + + + + {% for cert in node_ports_list %} + 389 %} class="has-background-warning-light" {%elif cert.remaining_days == 364 and cert.validity %} class="has-background-success-light" {% endif %}> + + + + + + + + {% endfor %} + +
ComponentPortExpected Expiration DateRemaining DaysRoot CARoot CA Validity
{{ cert.pod_name }}{{ cert.pod_port }}{{ cert.expiration_date }}{{ cert.remaining_days }}{{ cert.issuer }}{% if cert.validity %} + + + + {% else %} + + + + {% endif %}
+ + {% if node_ports_ssl_error_list|length > 0 %} +

Node ports SSL errors

+ + + + + + + + + + {% for cert in node_ports_ssl_error_list %} + + + + + {% endfor %} + +
ComponentPortError Details
{{ cert.pod_name }}{{ cert.pod_port }}{{ cert.error_details }}
+{% endif %} + +{% if node_ports_connection_error_list|length > 0 %} +

Node ports Connection errors

+ + + + + + + + + + {% for cert in node_ports_connection_error_list %} + + + + + {% endfor %} + +
ComponentPortError Details
{{ cert.pod_name }}{{ cert.pod_port }}{{ cert.error_details }}
+{% endif %} + +{% if node_ports_list_type_error_list|length > 0 %} +

Node ports Type Error

+ + + + + + + + + + {% for cert in node_ports_list_type_error_list %} + + + + + {% endfor %} + +
ComponentPortError Details
{{ cert.pod_name }}{{ cert.pod_port }}{{ cert.error_details }}
+{% endif %} + +{% if node_ports_reset_error_list|length > 0 %} +

Node ports Connections Error

+ + + + + + + + + + {% for cert in node_ports_reset_error_list %} + + + + + {% endfor %} + +
ComponentPortError Details
{{ cert.pod_name }}{{ cert.pod_port }}{{ cert.error_details }}
+{% endif %} + +{% endblock %} +
+
-- cgit 1.2.3-korg