From 04804c49eefd80efb0f31b27b56192ee4c77081b Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Thu, 29 Feb 2024 10:14:22 +0100 Subject: Avoid empty newlines in jina templates when if conditions evaluate to false - avoid empty newlines for false if statements - this is useful for the logging of the rendered objects in tests Issue-ID: TEST-417 Change-Id: Iaeec217c87e73e316c4ef468007369facbf9a02f Signed-off-by: Fiete Ostkamp --- .../aai/templates/aai_add_relationship.json.j2 | 8 +- src/onapsdk/aai/templates/aai_bulk.json.j2 | 2 +- .../aai/templates/aai_delete_relationship.json.j2 | 8 +- src/onapsdk/aai/templates/aai_put_pnf.json.j2 | 102 ++++++++++----------- .../templates/aai_service_instance_create.json.j2 | 38 ++++---- .../aai/templates/aai_sp_partner_create.json.j2 | 24 ++--- .../cloud_region_add_availability_zone.json.j2 | 4 +- .../cloud_region_add_esr_system_info.json.j2 | 64 ++++++------- .../aai/templates/customer_create_update.json.j2 | 6 +- .../aai/templates/geo_region_create.json.j2 | 14 +-- .../aai/templates/site_resource_create.json.j2 | 26 +++--- .../cds/templates/data_dictionary_base.json.j2 | 4 +- .../k8s/templates/msb_esr_vim_registration.json.j2 | 24 ++--- .../templates/multicloud_k8s_instantiate.json.j2 | 4 +- .../sdc/templates/component_declare_input.json.j2 | 4 +- src/onapsdk/sdc/templates/pnf_create.json.j2 | 4 +- .../sdc/templates/sdc_element_action.json.j2 | 4 +- .../sdc/templates/sdc_resource_add_input.json.j2 | 4 +- .../sdc_resource_add_nested_input.json.j2 | 4 +- .../templates/sdc_resource_add_property.json.j2 | 8 +- .../sdc/templates/sdc_resource_category.json.j2 | 8 +- src/onapsdk/sdc/templates/vf_create.json.j2 | 4 +- .../templates/sdc2_create_resource_base.json.j2 | 4 +- .../sdnc/templates/create_node_netconf_api.json.j2 | 6 +- .../sdnc/templates/create_service_gr_api.json.j2 | 6 +- ...network_ala_carte_upload_preload_gr_api.json.j2 | 6 +- src/onapsdk/so/templates/deletion_service.json.j2 | 4 +- .../instantiate_multi_vnf_service_macro.json.j2 | 52 +++++------ .../instantiate_network_vnf_macro_base.json.j2 | 34 +++---- .../so/templates/instantiate_pnf_macro.json.j2 | 6 +- .../templates/instantiate_pnf_macro_so_pnf.json.j2 | 6 +- .../instantiate_service_ala_carte.json.j2 | 4 +- .../so/templates/instantiate_service_macro.json.j2 | 60 ++++++------ ...rvice_macro_skip_pnf_registration_event.json.j2 | 44 ++++----- .../instantiate_vf_module_ala_carte.json.j2 | 2 +- .../so/templates/instantiate_vnf_ala_carte.json.j2 | 2 +- .../so/templates/instantiate_vnf_macro.json.j2 | 18 ++-- .../templates/instantiate_vnf_macro_so_vnf.json.j2 | 18 ++-- src/onapsdk/so/templates/modify_pnf.json.j2 | 4 +- src/onapsdk/so/templates/vf_model_info.json.j2 | 2 +- tests/test_pnf.py | 6 +- tests/test_sp_partner.py | 2 +- tests/test_vendor.py | 6 +- tests/test_vf.py | 4 +- tests/test_vsp.py | 10 +- 45 files changed, 337 insertions(+), 337 deletions(-) diff --git a/src/onapsdk/aai/templates/aai_add_relationship.json.j2 b/src/onapsdk/aai/templates/aai_add_relationship.json.j2 index 5d7acb8..72b5fd9 100644 --- a/src/onapsdk/aai/templates/aai_add_relationship.json.j2 +++ b/src/onapsdk/aai/templates/aai_add_relationship.json.j2 @@ -1,11 +1,11 @@ { "related-to": "{{ relationship.related_to }}", "related-link": "{{ relationship.related_link }}", - {% if relationship.relationship_label %} + {%- if relationship.relationship_label %} "relationship-label": "{{ relationship.relationship_label }}", - {% endif %} - {% if relationship.related_to_property %} + {%- endif %} + {%- if relationship.related_to_property %} "related-to-property": {{ relationship.related_to_property | tojson }}, - {% endif %} + {%- endif %} "relationship-data": {{ relationship.relationship_data | tojson }} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/aai_bulk.json.j2 b/src/onapsdk/aai/templates/aai_bulk.json.j2 index 40a97bd..7dcbcb7 100644 --- a/src/onapsdk/aai/templates/aai_bulk.json.j2 +++ b/src/onapsdk/aai/templates/aai_bulk.json.j2 @@ -5,7 +5,7 @@ "action": "{{ operation.action }}", "uri": "{{ operation.uri }}", "body": {{ operation.body }} - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/aai_delete_relationship.json.j2 b/src/onapsdk/aai/templates/aai_delete_relationship.json.j2 index 5d7acb8..72b5fd9 100644 --- a/src/onapsdk/aai/templates/aai_delete_relationship.json.j2 +++ b/src/onapsdk/aai/templates/aai_delete_relationship.json.j2 @@ -1,11 +1,11 @@ { "related-to": "{{ relationship.related_to }}", "related-link": "{{ relationship.related_link }}", - {% if relationship.relationship_label %} + {%- if relationship.relationship_label %} "relationship-label": "{{ relationship.relationship_label }}", - {% endif %} - {% if relationship.related_to_property %} + {%- endif %} + {%- if relationship.related_to_property %} "related-to-property": {{ relationship.related_to_property | tojson }}, - {% endif %} + {%- endif %} "relationship-data": {{ relationship.relationship_data | tojson }} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/aai_put_pnf.json.j2 b/src/onapsdk/aai/templates/aai_put_pnf.json.j2 index 65513c7..4d22058 100644 --- a/src/onapsdk/aai/templates/aai_put_pnf.json.j2 +++ b/src/onapsdk/aai/templates/aai_put_pnf.json.j2 @@ -1,54 +1,54 @@ { -{% if pnf_object.admin_status %}"admin_status": "{{ pnf_object.admin_status }}",{% else %}{%endif %} -{% if pnf_object.equip_model %}"equip_model": "{{ pnf_object.equip_model }}",{% else %}{%endif %} -{% if pnf_object.equip_type %}"equip_type": "{{ pnf_object.equip_type }}",{% else %}{%endif %} -{% if pnf_object.equip_vendor %}"equip_vendor": "{{ pnf_object.equip_vendor }}",{% else %}{%endif %} -{% if pnf_object.frame_id %}"frame_id": "{{ pnf_object.frame_id }}",{% else %}{%endif %} -{% if pnf_object.in_maint != None %}"in_maint": {{ convert_bool_for_json(pnf_object.in_maint) }},{% else %}{%endif %} -{% if pnf_object.inv_status %}"inv_status": "{{ pnf_object.inv_status }}",{% else %}{%endif %} -{% if pnf_object.ipaddress_v4_aim %}"ipaddress_v4_aim": "{{ pnf_object.ipaddress_v4_aim }}",{% else %}{%endif %} -{% if pnf_object.ipaddress_v4_loopback_0 %}"ipaddress_v4_loopback_0": "{{ pnf_object.ipaddress_v4_loopback_0 }}",{% else %}{%endif %} -{% if pnf_object.ipaddress_v4_oam %}"ipaddress_v4_oam": "{{ pnf_object.ipaddress_v4_oam }}",{% else %}{%endif %} -{% if pnf_object.ipaddress_v6_aim %}"ipaddress_v6_aim": "{{ pnf_object.ipaddress_v6_aim }}",{% else %}{%endif %} -{% if pnf_object.ipaddress_v6_loopback_0 %}"ipaddress_v6_loopback_0": "{{ pnf_object.ipaddress_v6_loopback_0 }}",{% else %}{%endif %} -{% if pnf_object.ipaddress_v6_oam %}"ipaddress_v6_oam": "{{ pnf_object.ipaddress_v6_oam }}",{% else %}{%endif %} -{% if pnf_object.management_option %}"management_option": "{{ pnf_object.management_option }}",{% else %}{%endif %} -{% if pnf_object.model_customization_id %}"model_customization_id": "{{ pnf_object.model_customization_id }}",{% else %}{%endif %} -{% if pnf_object.model_invariant_id %}"model_invariant_id": "{{ pnf_object.model_invariant_id }}",{% else %}{%endif %} -{% if pnf_object.model_version_id %}"model_version_id": "{{ pnf_object.model_version_id }}",{% else %}{%endif %} -{% if pnf_object.nf_role %}"nf_role": "{{ pnf_object.nf_role }}",{% else %}{%endif %} -{% if pnf_object.operational_status %}"operational_status": "{{ pnf_object.operational_status }}",{% else %}{%endif %} -{% if pnf_object.orchestration_status %}"orchestration_status": "{{ pnf_object.orchestration_status }}",{% else %}{%endif %} -{% if pnf_object.pnf_id %}"pnf_id": "{{ pnf_object.pnf_id }}",{% else %}{%endif %} -{% if pnf_object.pnf_ipv4_address %}"pnf_ipv4_address": "{{ pnf_object.pnf_ipv4_address }}",{% else %}{%endif %} -{% if pnf_object.pnf_ipv6_address %}"pnf_ipv6_address": "{{ pnf_object.pnf_ipv6_address }}",{% else %}{%endif %} -{% if pnf_object.pnf_name %}"pnf_name": "{{ pnf_object.pnf_name }}",{% else %}{%endif %} -{% if pnf_object.prov_status %}"prov_status": "{{ pnf_object.prov_status }}",{% else %}{%endif %} -{% if pnf_object.selflink %}"selflink": "{{ pnf_object.selflink }}",{% else %}{%endif %} -{% if pnf_object.serial_number %}"serial_number": "{{ pnf_object.serial_number }}",{% else %}{%endif %} -{% if pnf_object.sw_version %}"sw_version": "{{ pnf_object.sw_version }}",{% else %}{%endif %} -{% if pnf_object.service_instance %}"service_instance": { -{% if pnf_object.service_instance.service_subscription %}"service_subscription": "{{ pnf_object.service_instance.service_subscription }}",{% else %}{%endif %} -{% if pnf_object.service_instance.instance_id %}"instance_id": "{{ pnf_object.service_instance.instance_id }}",{% else %}{%endif %} -{% if pnf_object.service_instance.instance_name %}"instance_name": "{{ pnf_object.service_instance.instance_name }}",{% else %}{%endif %} -{% if pnf_object.service_instance.service_type %}"service_type": "{{ pnf_object.service_instance.service_type }}",{% else %}{%endif %} -{% if pnf_object.service_instance.service_role %}"service_role": "{{ pnf_object.service_instance.service_role }}",{% else %}{%endif %} -{% if pnf_object.service_instance.environment_context %}"environment_context": "{{ pnf_object.service_instance.environment_context }}",{% else %}{%endif %} -{% if pnf_object.service_instance.workload_context %}"workload_context": "{{ pnf_object.service_instance.workload_context }}",{% else %}{%endif %} -{% if pnf_object.service_instance.created_at %}"created_at": "{{ pnf_object.service_instance.created_at }}",{% else %}{%endif %} -{% if pnf_object.service_instance.updated_at %}"updated_at": "{{ pnf_object.service_instance.updated_at }}",{% else %}{%endif %} -{% if pnf_object.service_instance.resource_version %}"resource_version": "{{ pnf_object.service_instance.resource_version }}",{% else %}{%endif %} -{% if pnf_object.service_instance.description %}"description": "{{ pnf_object.service_instance.description }}",{% else %}{%endif %} -{% if pnf_object.service_instance.model_invariant_id %}"model_invariant_id": "{{ pnf_object.service_instance.model_invariant_id }}",{% else %}{%endif %} -{% if pnf_object.service_instance.model_version_id %}"model_version_id": "{{ pnf_object.service_instance.model_version_id }}",{% else %}{%endif %} -{% if pnf_object.service_instance.persona_model_version %}"persona_model_version": "{{ pnf_object.service_instance.persona_model_version }}",{% else %}{%endif %} -{% if pnf_object.service_instance.widget_model_id %}"widget_model_id": "{{ pnf_object.service_instance.widget_model_id }}",{% else %}{%endif %} -{% if pnf_object.service_instance.widget_model_version %}"widget_model_version": "{{ pnf_object.service_instance.widget_model_version }}",{% else %}{%endif %} -{% if pnf_object.service_instance.bandwith_total %}"bandwith_total": "{{ pnf_object.service_instance.bandwith_total }}",{% else %}{%endif %} -{% if pnf_object.service_instance.vhn_portal_url %}"vhn_portal_url": "{{ pnf_object.service_instance.vhn_portal_url }}",{% else %}{%endif %} -{% if pnf_object.service_instance.service_instance_location_id %}"service_instance_location_id": "{{ pnf_object.service_instance.service_instance_location_id }}",{% else %}{%endif %} -{% if pnf_object.service_instance.selflink %}"selflink": "{{ pnf_object.service_instance.selflink }}",{% else %}{%endif %} -{% if pnf_object.service_instance.orchestration_status %}"orchestration_status": "{{ pnf_object.service_instance.orchestration_status }}",{% else %}{%endif %} -{% if pnf_object.service_instance.input_parameters %}"input_parameters": "{{ pnf_object.service_instance.input_parameters }}",{% else %}{%endif %} +{%- if pnf_object.admin_status %}"admin_status": "{{ pnf_object.admin_status }}",{% else %}{%endif %} +{%- if pnf_object.equip_model %}"equip_model": "{{ pnf_object.equip_model }}",{% else %}{%endif %} +{%- if pnf_object.equip_type %}"equip_type": "{{ pnf_object.equip_type }}",{% else %}{%endif %} +{%- if pnf_object.equip_vendor %}"equip_vendor": "{{ pnf_object.equip_vendor }}",{% else %}{%endif %} +{%- if pnf_object.frame_id %}"frame_id": "{{ pnf_object.frame_id }}",{% else %}{%endif %} +{%- if pnf_object.in_maint != None %}"in_maint": {{ convert_bool_for_json(pnf_object.in_maint) }},{% else %}{%endif %} +{%- if pnf_object.inv_status %}"inv_status": "{{ pnf_object.inv_status }}",{% else %}{%endif %} +{%- if pnf_object.ipaddress_v4_aim %}"ipaddress_v4_aim": "{{ pnf_object.ipaddress_v4_aim }}",{% else %}{%endif %} +{%- if pnf_object.ipaddress_v4_loopback_0 %}"ipaddress_v4_loopback_0": "{{ pnf_object.ipaddress_v4_loopback_0 }}",{% else %}{%endif %} +{%- if pnf_object.ipaddress_v4_oam %}"ipaddress_v4_oam": "{{ pnf_object.ipaddress_v4_oam }}",{% else %}{%endif %} +{%- if pnf_object.ipaddress_v6_aim %}"ipaddress_v6_aim": "{{ pnf_object.ipaddress_v6_aim }}",{% else %}{%endif %} +{%- if pnf_object.ipaddress_v6_loopback_0 %}"ipaddress_v6_loopback_0": "{{ pnf_object.ipaddress_v6_loopback_0 }}",{% else %}{%endif %} +{%- if pnf_object.ipaddress_v6_oam %}"ipaddress_v6_oam": "{{ pnf_object.ipaddress_v6_oam }}",{% else %}{%endif %} +{%- if pnf_object.management_option %}"management_option": "{{ pnf_object.management_option }}",{% else %}{%endif %} +{%- if pnf_object.model_customization_id %}"model_customization_id": "{{ pnf_object.model_customization_id }}",{% else %}{%endif %} +{%- if pnf_object.model_invariant_id %}"model_invariant_id": "{{ pnf_object.model_invariant_id }}",{% else %}{%endif %} +{%- if pnf_object.model_version_id %}"model_version_id": "{{ pnf_object.model_version_id }}",{% else %}{%endif %} +{%- if pnf_object.nf_role %}"nf_role": "{{ pnf_object.nf_role }}",{% else %}{%endif %} +{%- if pnf_object.operational_status %}"operational_status": "{{ pnf_object.operational_status }}",{% else %}{%endif %} +{%- if pnf_object.orchestration_status %}"orchestration_status": "{{ pnf_object.orchestration_status }}",{% else %}{%endif %} +{%- if pnf_object.pnf_id %}"pnf_id": "{{ pnf_object.pnf_id }}",{% else %}{%endif %} +{%- if pnf_object.pnf_ipv4_address %}"pnf_ipv4_address": "{{ pnf_object.pnf_ipv4_address }}",{% else %}{%endif %} +{%- if pnf_object.pnf_ipv6_address %}"pnf_ipv6_address": "{{ pnf_object.pnf_ipv6_address }}",{% else %}{%endif %} +{%- if pnf_object.pnf_name %}"pnf_name": "{{ pnf_object.pnf_name }}",{% else %}{%endif %} +{%- if pnf_object.prov_status %}"prov_status": "{{ pnf_object.prov_status }}",{% else %}{%endif %} +{%- if pnf_object.selflink %}"selflink": "{{ pnf_object.selflink }}",{% else %}{%endif %} +{%- if pnf_object.serial_number %}"serial_number": "{{ pnf_object.serial_number }}",{% else %}{%endif %} +{%- if pnf_object.sw_version %}"sw_version": "{{ pnf_object.sw_version }}",{% else %}{%endif %} +{%- if pnf_object.service_instance %}"service_instance": { +{%- if pnf_object.service_instance.service_subscription %}"service_subscription": "{{ pnf_object.service_instance.service_subscription }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.instance_id %}"instance_id": "{{ pnf_object.service_instance.instance_id }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.instance_name %}"instance_name": "{{ pnf_object.service_instance.instance_name }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.service_type %}"service_type": "{{ pnf_object.service_instance.service_type }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.service_role %}"service_role": "{{ pnf_object.service_instance.service_role }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.environment_context %}"environment_context": "{{ pnf_object.service_instance.environment_context }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.workload_context %}"workload_context": "{{ pnf_object.service_instance.workload_context }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.created_at %}"created_at": "{{ pnf_object.service_instance.created_at }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.updated_at %}"updated_at": "{{ pnf_object.service_instance.updated_at }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.resource_version %}"resource_version": "{{ pnf_object.service_instance.resource_version }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.description %}"description": "{{ pnf_object.service_instance.description }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.model_invariant_id %}"model_invariant_id": "{{ pnf_object.service_instance.model_invariant_id }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.model_version_id %}"model_version_id": "{{ pnf_object.service_instance.model_version_id }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.persona_model_version %}"persona_model_version": "{{ pnf_object.service_instance.persona_model_version }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.widget_model_id %}"widget_model_id": "{{ pnf_object.service_instance.widget_model_id }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.widget_model_version %}"widget_model_version": "{{ pnf_object.service_instance.widget_model_version }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.bandwith_total %}"bandwith_total": "{{ pnf_object.service_instance.bandwith_total }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.vhn_portal_url %}"vhn_portal_url": "{{ pnf_object.service_instance.vhn_portal_url }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.service_instance_location_id %}"service_instance_location_id": "{{ pnf_object.service_instance.service_instance_location_id }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.selflink %}"selflink": "{{ pnf_object.service_instance.selflink }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.orchestration_status %}"orchestration_status": "{{ pnf_object.service_instance.orchestration_status }}",{% else %}{%endif %} +{%- if pnf_object.service_instance.input_parameters %}"input_parameters": "{{ pnf_object.service_instance.input_parameters }}",{% else %}{%endif %} }{% else %}{%endif %} } diff --git a/src/onapsdk/aai/templates/aai_service_instance_create.json.j2 b/src/onapsdk/aai/templates/aai_service_instance_create.json.j2 index 91f0046..0694b8b 100644 --- a/src/onapsdk/aai/templates/aai_service_instance_create.json.j2 +++ b/src/onapsdk/aai/templates/aai_service_instance_create.json.j2 @@ -1,22 +1,22 @@ { "service-instance-id": "{{ service_instance.instance_id }}" - {% if service_instance.instance_name %}, "service-instance-name": "{{ service_instance.instance_name }}"{% endif %} - {% if service_instance.service_type %}, "service-type": "{{ service_instance.service_type }}"{% endif %} - {% if service_instance.service_role %}, "service-role": "{{ service_instance.service_role }}"{% endif %} - {% if service_instance.environment_context %}, "environment-context": "{{ service_instance.environment_context }}"{% endif %} - {% if service_instance.workload_context %}, "workload-context": "{{ service_instance.workload_context }}"{% endif %} - {% if service_instance.created_at %}, "created-at": "{{ service_instance.created_at }}"{% endif %} - {% if service_instance.updated_at %}, "updated-at": "{{ service_instance.updated_at }}"{% endif %} - {% if service_instance.description %}, "description": "{{ service_instance.description }}"{% endif %} - {% if service_instance.model_invariant_id %}, "model-invariant-id": "{{ service_instance.model_invariant_id }}"{% endif %} - {% if service_instance.model_version_id %}, "model-version-id": "{{ service_instance.model_version_id }}"{% endif %} - {% if service_instance.persona_model_version %}, "persona-model-version": "{{ service_instance.persona_model_version }}"{% endif %} - {% if service_instance.widget_model_id %}, "widget-model-id": "{{ service_instance.widget_model_id }}"{% endif %} - {% if service_instance.widget_model_version %}, "widget-model-version": "{{ service_instance.widget_model_version }}"{% endif %} - {% if service_instance.bandwith_total %}, "bandwidth-total": "{{ service_instance.bandwith_total }}"{% endif %} - {% if service_instance.vhn_portal_url %}, "vhn-portal-url": "{{ service_instance.vhn_portal_url }}"{% endif %} - {% if service_instance.service_instance_location_id %}, "service-instance-location-id": "{{ service_instance.service_instance_location_id }}"{% endif %} - {% if service_instance.selflink %}, "selflink": "{{ service_instance.selflink }}"{% endif %} - {% if service_instance.orchestration_status %}, "orchestration-status": "{{ service_instance.orchestration_status }}"{% endif %} - {% if service_instance.input_parameters %}, "input-parameters": "{{ service_instance.input_parameters }}"{% endif %} + {%- if service_instance.instance_name %}, "service-instance-name": "{{ service_instance.instance_name }}"{%- endif %} + {%- if service_instance.service_type %}, "service-type": "{{ service_instance.service_type }}"{%- endif %} + {%- if service_instance.service_role %}, "service-role": "{{ service_instance.service_role }}"{%- endif %} + {%- if service_instance.environment_context %}, "environment-context": "{{ service_instance.environment_context }}"{%- endif %} + {%- if service_instance.workload_context %}, "workload-context": "{{ service_instance.workload_context }}"{%- endif %} + {%- if service_instance.created_at %}, "created-at": "{{ service_instance.created_at }}"{%- endif %} + {%- if service_instance.updated_at %}, "updated-at": "{{ service_instance.updated_at }}"{%- endif %} + {%- if service_instance.description %}, "description": "{{ service_instance.description }}"{%- endif %} + {%- if service_instance.model_invariant_id %}, "model-invariant-id": "{{ service_instance.model_invariant_id }}"{%- endif %} + {%- if service_instance.model_version_id %}, "model-version-id": "{{ service_instance.model_version_id }}"{%- endif %} + {%- if service_instance.persona_model_version %}, "persona-model-version": "{{ service_instance.persona_model_version }}"{%- endif %} + {%- if service_instance.widget_model_id %}, "widget-model-id": "{{ service_instance.widget_model_id }}"{%- endif %} + {%- if service_instance.widget_model_version %}, "widget-model-version": "{{ service_instance.widget_model_version }}"{%- endif %} + {%- if service_instance.bandwith_total %}, "bandwidth-total": "{{ service_instance.bandwith_total }}"{%- endif %} + {%- if service_instance.vhn_portal_url %}, "vhn-portal-url": "{{ service_instance.vhn_portal_url }}"{%- endif %} + {%- if service_instance.service_instance_location_id %}, "service-instance-location-id": "{{ service_instance.service_instance_location_id }}"{%- endif %} + {%- if service_instance.selflink %}, "selflink": "{{ service_instance.selflink }}"{%- endif %} + {%- if service_instance.orchestration_status %}, "orchestration-status": "{{ service_instance.orchestration_status }}"{%- endif %} + {%- if service_instance.input_parameters %}, "input-parameters": "{{ service_instance.input_parameters }}"{%- endif %} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/aai_sp_partner_create.json.j2 b/src/onapsdk/aai/templates/aai_sp_partner_create.json.j2 index 40ba1d7..fe03415 100644 --- a/src/onapsdk/aai/templates/aai_sp_partner_create.json.j2 +++ b/src/onapsdk/aai/templates/aai_sp_partner_create.json.j2 @@ -1,21 +1,21 @@ { "sp-partner-id": "{{ sp_partner_id }}" - {% if url %} + {%- if url %} , "url": "{{ url }}" - {% endif %} - {% if callsource %} + {%- endif %} + {%- if callsource %} , "callsource": "{{ callsource }}" - {% endif %} - {% if operational_status %} + {%- endif %} + {%- if operational_status %} , "operational-status": "{{ operational_status }}" - {% endif %} - {% if model_customization_id %} + {%- endif %} + {%- if model_customization_id %} , "model-customization-id": "{{ model_customization_id }}" - {% endif %} - {% if model_invariant_id %} + {%- endif %} + {%- if model_invariant_id %} , "model-invariant-id": "{{ model_invariant_id }}" - {% endif %} - {% if model_version_id %} + {%- endif %} + {%- if model_version_id %} , "model-version-id": "{{ model_version_id }}" - {% endif %} + {%- endif %} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/cloud_region_add_availability_zone.json.j2 b/src/onapsdk/aai/templates/cloud_region_add_availability_zone.json.j2 index be6ebc5..5862ec0 100644 --- a/src/onapsdk/aai/templates/cloud_region_add_availability_zone.json.j2 +++ b/src/onapsdk/aai/templates/cloud_region_add_availability_zone.json.j2 @@ -1,7 +1,7 @@ { "availability-zone-name": "{{ availability_zone_name }}", "hypervisor-type": "{{ availability_zone_hypervisor_type }}" - {% if availability_zone_operational_status %} + {%- if availability_zone_operational_status %} , "operational-status": "{{ availability_zone_operational_status }}" - {% endif %} + {%- endif %} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/cloud_region_add_esr_system_info.json.j2 b/src/onapsdk/aai/templates/cloud_region_add_esr_system_info.json.j2 index ab03de3..5af207d 100644 --- a/src/onapsdk/aai/templates/cloud_region_add_esr_system_info.json.j2 +++ b/src/onapsdk/aai/templates/cloud_region_add_esr_system_info.json.j2 @@ -3,52 +3,52 @@ "user-name": "{{ user_name }}", "password": "{{ password }}", "system-type": "{{ system_type }}" - {% if system_name %} + {%- if system_name %} , "system-name": "{{ system_name }}" - {% endif %} - {% if esr_type %} + {%- endif %} + {%- if esr_type %} , "type": "{{ esr_type }}" - {% endif %} - {% if vendor %} + {%- endif %} + {%- if vendor %} , "vendor": "{{ vendor }}" - {% endif %} - {% if version %} + {%- endif %} + {%- if version %} , "version": "{{ version }}" - {% endif %} - {% if service_url %} + {%- endif %} + {%- if service_url %} , "service-url": "{{ service_url }}" - {% endif %} - {% if protocol %} + {%- endif %} + {%- if protocol %} , "protocol": "{{ protocol }}" - {% endif %} - {% if ssl_cacert %} + {%- endif %} + {%- if ssl_cacert %} , "ssl-cacert": "{{ ssl_cacert }}" - {% endif %} - {% if ssl_insecure is not none %} + {%- endif %} + {%- if ssl_insecure is not none %} , "ssl-insecure": {{ ssl_insecure | tojson }} - {% endif %} - {% if ip_address %} + {%- endif %} + {%- if ip_address %} , "ip-address": "{{ ip_address }}" - {% endif %} - {% if port %} + {%- endif %} + {%- if port %} , "port": "{{ port }}" - {% endif %} - {% if cloud_domain %} + {%- endif %} + {%- if cloud_domain %} , "cloud-domain": "{{ cloud_domain }}" - {% endif %} - {% if default_tenant %} + {%- endif %} + {%- if default_tenant %} , "default-tenant": "{{ default_tenant }}" - {% endif %} - {% if passive is not none %} + {%- endif %} + {%- if passive is not none %} , "passive": {{ passive | tojson }} - {% endif %} - {% if remote_path %} + {%- endif %} + {%- if remote_path %} , "remote-path": "{{ remote_path }}" - {% endif %} - {% if system_status %} + {%- endif %} + {%- if system_status %} , "system-status": "{{ system_status }}" - {% endif %} - {% if openstack_region_id %} + {%- endif %} + {%- if openstack_region_id %} , "openstack-region-id": "{{ openstack_region_id }}" - {% endif %} + {%- endif %} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/customer_create_update.json.j2 b/src/onapsdk/aai/templates/customer_create_update.json.j2 index 0eea2ed..2ac30b4 100644 --- a/src/onapsdk/aai/templates/customer_create_update.json.j2 +++ b/src/onapsdk/aai/templates/customer_create_update.json.j2 @@ -1,15 +1,15 @@ { "global-customer-id": "{{ global_customer_id }}", "subscriber-name": "{{ subscriber_name }}", - "subscriber-type": "{{ subscriber_type }}"{% if service_subscriptions %}, + "subscriber-type": "{{ subscriber_type }}"{%- if service_subscriptions %}, "service-subscriptions": { "service-subscription": [ {% for service_subscription in service_subscriptions %} { "service-type": "{{ service_subscription }}" - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] } - {% endif %} + {%- endif %} } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/geo_region_create.json.j2 b/src/onapsdk/aai/templates/geo_region_create.json.j2 index d84b427..00f4c46 100644 --- a/src/onapsdk/aai/templates/geo_region_create.json.j2 +++ b/src/onapsdk/aai/templates/geo_region_create.json.j2 @@ -1,10 +1,10 @@ { - {% if geo_region_name is not none %}"geo-region-name": "{{ geo_region_name }}",{% endif %} - {% if geo_region_type is not none %}"geo-region-type": "{{ geo_region_type }}",{% endif %} - {% if geo_region_role is not none %}"geo-region-role": "{{ geo_region_role }}",{% endif %} - {% if geo_region_function is not none %}"geo-region-function": "{{ geo_region_function }}",{% endif %} - {% if data_owner is not none %}"data-owner": "{{ data_owner }}",{% endif %} - {% if data_source is not none %}"data-source": "{{ data_source }}",{% endif %} - {% if data_source_version is not none %}"data-source-version": "{{ data_source_version }}",{% endif %} + {%- if geo_region_name is not none %}"geo-region-name": "{{ geo_region_name }}",{%- endif %} + {%- if geo_region_type is not none %}"geo-region-type": "{{ geo_region_type }}",{%- endif %} + {%- if geo_region_role is not none %}"geo-region-role": "{{ geo_region_role }}",{%- endif %} + {%- if geo_region_function is not none %}"geo-region-function": "{{ geo_region_function }}",{%- endif %} + {%- if data_owner is not none %}"data-owner": "{{ data_owner }}",{%- endif %} + {%- if data_source is not none %}"data-source": "{{ data_source }}",{%- endif %} + {%- if data_source_version is not none %}"data-source-version": "{{ data_source_version }}",{%- endif %} "geo-region-id": "{{ geo_region_id }}" } \ No newline at end of file diff --git a/src/onapsdk/aai/templates/site_resource_create.json.j2 b/src/onapsdk/aai/templates/site_resource_create.json.j2 index caaf291..d215758 100644 --- a/src/onapsdk/aai/templates/site_resource_create.json.j2 +++ b/src/onapsdk/aai/templates/site_resource_create.json.j2 @@ -1,16 +1,16 @@ { - {% if site_resource_name is not none %}"site-resource-name": "{{ site_resource_name }}",{% endif %} - {% if description is not none %}"description": "{{ description }}",{% endif %} - {% if site_resource_type is not none %}"type": "{{ site_resource_type }}",{% endif %} - {% if role is not none %}"role": "{{ role }}",{% endif %} - {% if generated_site_id is not none %}"generated-site-id": "{{ generated_site_id }}",{% endif %} - {% if selflink is not none %}"selflink": "{{ selflink }}",{% endif %} - {% if operational_status is not none %}"operational-status": "{{ operational_status }}",{% endif %} - {% if model_customization_id is not none %}"model-customization-id": "{{ model_customization_id }}",{% endif %} - {% if model_invariant_id is not none %}"model-invariant-id": "{{ model_invariant_id }}",{% endif %} - {% if model_version_id is not none %}"model-version-id": "{{ model_version_id }}",{% endif %} - {% if data_owner is not none %}"data-owner": "{{ data_owner }}",{% endif %} - {% if data_source is not none %}"data-source": "{{ data_source }}",{% endif %} - {% if data_source_version is not none %}"data-source-version": "{{ data_source_version }}",{% endif %} + {%- if site_resource_name is not none %}"site-resource-name": "{{ site_resource_name }}",{%- endif %} + {%- if description is not none %}"description": "{{ description }}",{%- endif %} + {%- if site_resource_type is not none %}"type": "{{ site_resource_type }}",{%- endif %} + {%- if role is not none %}"role": "{{ role }}",{%- endif %} + {%- if generated_site_id is not none %}"generated-site-id": "{{ generated_site_id }}",{%- endif %} + {%- if selflink is not none %}"selflink": "{{ selflink }}",{%- endif %} + {%- if operational_status is not none %}"operational-status": "{{ operational_status }}",{%- endif %} + {%- if model_customization_id is not none %}"model-customization-id": "{{ model_customization_id }}",{%- endif %} + {%- if model_invariant_id is not none %}"model-invariant-id": "{{ model_invariant_id }}",{%- endif %} + {%- if model_version_id is not none %}"model-version-id": "{{ model_version_id }}",{%- endif %} + {%- if data_owner is not none %}"data-owner": "{{ data_owner }}",{%- endif %} + {%- if data_source is not none %}"data-source": "{{ data_source }}",{%- endif %} + {%- if data_source_version is not none %}"data-source-version": "{{ data_source_version }}",{%- endif %} "site-resource-id": "{{ site_resource_id }}" } \ No newline at end of file diff --git a/src/onapsdk/cds/templates/data_dictionary_base.json.j2 b/src/onapsdk/cds/templates/data_dictionary_base.json.j2 index 0ea6752..3ec2fd1 100644 --- a/src/onapsdk/cds/templates/data_dictionary_base.json.j2 +++ b/src/onapsdk/cds/templates/data_dictionary_base.json.j2 @@ -15,7 +15,7 @@ "updated-by": "Python ONAP SDK", "sources": { {% for source in mapping.dictionary_sources %} - {% if source == "input" %} + {%- if source == "input" %} "input": { "type": "source-input" }, @@ -41,7 +41,7 @@ "type": "unknown", "properties": {} }, - {% endif %} + {%- endif %} {% endfor %} "default": { "type": "source-default", diff --git a/src/onapsdk/k8s/templates/msb_esr_vim_registration.json.j2 b/src/onapsdk/k8s/templates/msb_esr_vim_registration.json.j2 index ba19258..c96a4d0 100644 --- a/src/onapsdk/k8s/templates/msb_esr_vim_registration.json.j2 +++ b/src/onapsdk/k8s/templates/msb_esr_vim_registration.json.j2 @@ -3,29 +3,29 @@ "cloudRegionId": "{{ cloud_region_id }}", "cloudType": "{{ cloud_type }}", "cloudRegionVersion": "{{ cloud_region_version }}" - {% if owner_defined_type %} + {%- if owner_defined_type %} , "ownerDefinedType": "{{ owner_defined_type }}" - {% endif %} - {% if cloud_zone %} + {%- endif %} + {%- if cloud_zone %} , "cloudZone": "{{ cloud_zone }}" - {% endif %} - {% if complex_name %} + {%- endif %} + {%- if complex_name %} , "physicalLocationId": "{{ physical_location_id }}" - {% endif %} - {% if cloud_extra_info %} + {%- endif %} + {%- if cloud_extra_info %} , "cloudExtraInfo": "{{ cloud_extra_info }}" - {% endif %} + {%- endif %} , "vimAuthInfos": [{ "userName": "{{ auth_info_username }}", "password": "{{ auth_info_password }}", "authUrl": "{{ auth_info_url }}", "cloudDomain": "{{ auth_info_cloud_domain }}" - {% if auth_info_ssl_cacert %} + {%- if auth_info_ssl_cacert %} , "sslCacert": "{{ auth_info_ssl_cacert }}" - {% endif %} - {% if auth_info_ssl_insecure is not none %} + {%- endif %} + {%- if auth_info_ssl_insecure is not none %} , "sslInsecure": {{ auth_info_ssl_insecure | tojson }} - {% endif %} + {%- endif %} }] } diff --git a/src/onapsdk/k8s/templates/multicloud_k8s_instantiate.json.j2 b/src/onapsdk/k8s/templates/multicloud_k8s_instantiate.json.j2 index fa5ef66..14af85c 100644 --- a/src/onapsdk/k8s/templates/multicloud_k8s_instantiate.json.j2 +++ b/src/onapsdk/k8s/templates/multicloud_k8s_instantiate.json.j2 @@ -6,13 +6,13 @@ "override-values": { {% for override_value in override_values %} - "{{ override_value.name }}": "{{ override_value.value }}"{% if not loop.last %},{% endif %} + "{{ override_value.name }}": "{{ override_value.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} }, "labels": { {% for label in labels %} - "{{ label.name }}": "{{ label.value }}"{% if not loop.last %},{% endif %} + "{{ label.name }}": "{{ label.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} } } \ No newline at end of file diff --git a/src/onapsdk/sdc/templates/component_declare_input.json.j2 b/src/onapsdk/sdc/templates/component_declare_input.json.j2 index fd0ee03..b9fedc8 100644 --- a/src/onapsdk/sdc/templates/component_declare_input.json.j2 +++ b/src/onapsdk/sdc/templates/component_declare_input.json.j2 @@ -17,11 +17,11 @@ "schemaType": null, "type": "{{ property.property_type }}", "uniqueId": "{{ property.unique_id }}", - {% if property.value is not none %} + {%- if property.value is not none %} "value":"{{ property.value }}", {% else %} "value":null, - {% endif %} + {%- endif %} "definition": false, "getInputValues": null, "parentPropertyType": null, diff --git a/src/onapsdk/sdc/templates/pnf_create.json.j2 b/src/onapsdk/sdc/templates/pnf_create.json.j2 index fe7e60c..54e5de6 100644 --- a/src/onapsdk/sdc/templates/pnf_create.json.j2 +++ b/src/onapsdk/sdc/templates/pnf_create.json.j2 @@ -8,13 +8,13 @@ "componentInstancesProperties": {}, "componentType": "RESOURCE", "contactId": "cs0008", - {% if vsp is not none %} + {%- if vsp is not none %} "csarUUID": "{{ vsp.csar_uuid }}", "csarVersion": "1.0", "vendorName": "{{ vsp.vendor.name }}", {% else %} "vendorName": "{{ vendor.name }}", - {% endif %} + {%- endif %} "deploymentArtifacts": {}, "description": "PNF", "icon": "defaulticon", diff --git a/src/onapsdk/sdc/templates/sdc_element_action.json.j2 b/src/onapsdk/sdc/templates/sdc_element_action.json.j2 index 04fd946..6b2d4da 100644 --- a/src/onapsdk/sdc/templates/sdc_element_action.json.j2 +++ b/src/onapsdk/sdc/templates/sdc_element_action.json.j2 @@ -1,6 +1,6 @@ { -{% if action == const.COMMIT %} +{%- if action == const.COMMIT %} "commitRequest":{"message":"ok"}, -{% endif %} +{%- endif %} "action": "{{ action }}" } diff --git a/src/onapsdk/sdc/templates/sdc_resource_add_input.json.j2 b/src/onapsdk/sdc/templates/sdc_resource_add_input.json.j2 index 1964f36..feb22ca 100644 --- a/src/onapsdk/sdc/templates/sdc_resource_add_input.json.j2 +++ b/src/onapsdk/sdc/templates/sdc_resource_add_input.json.j2 @@ -22,11 +22,11 @@ "schemaType":"", "type":"{{ property.property_type }}", "uniqueId":"{{ sdc_resource.unique_identifier }}.{{ property.name }}", - {% if property.value is not none %} + {%- if property.value is not none %} "value":"{{ property.value }}", {% else %} "value":null, - {% endif %} + {%- endif %} "definition":false, "getInputValues":null, "parentPropertyType":null, diff --git a/src/onapsdk/sdc/templates/sdc_resource_add_nested_input.json.j2 b/src/onapsdk/sdc/templates/sdc_resource_add_nested_input.json.j2 index 9dc8261..3d800aa 100644 --- a/src/onapsdk/sdc/templates/sdc_resource_add_nested_input.json.j2 +++ b/src/onapsdk/sdc/templates/sdc_resource_add_nested_input.json.j2 @@ -19,9 +19,9 @@ {# "schemaType":"", #} "type":"{{ input.input_type }}", "uniqueId":"{{ sdc_resource.unique_identifier }}.{{ input.name }}", - {% if input.default_value is not none %} + {%- if input.default_value is not none %} "value":"{{ input.default_value }}", - {% endif %} + {%- endif %} "definition":false {# "type":"{{ input.input_type }}", #} } diff --git a/src/onapsdk/sdc/templates/sdc_resource_add_property.json.j2 b/src/onapsdk/sdc/templates/sdc_resource_add_property.json.j2 index bed49ca..bc02275 100644 --- a/src/onapsdk/sdc/templates/sdc_resource_add_property.json.j2 +++ b/src/onapsdk/sdc/templates/sdc_resource_add_property.json.j2 @@ -6,12 +6,12 @@ } }, "name": "{{ property.name }}", - {% if property.description %} + {%- if property.description %} "description": "{{ property.description }}", - {% endif %} - {% if property.value %} + {%- endif %} + {%- if property.value %} "value": "{{ property.value }}", - {% endif %} + {%- endif %} "type": "{{ property.property_type }}" } } \ No newline at end of file diff --git a/src/onapsdk/sdc/templates/sdc_resource_category.json.j2 b/src/onapsdk/sdc/templates/sdc_resource_category.json.j2 index 633aacd..c346b89 100644 --- a/src/onapsdk/sdc/templates/sdc_resource_category.json.j2 +++ b/src/onapsdk/sdc/templates/sdc_resource_category.json.j2 @@ -3,11 +3,11 @@ "normalizedName": "{{ category.normalized_name }}", "name": "{{ category.name }}", "uniqueId": "{{ category.unique_id }}", - "subcategories": {% if category.subcategories %}{{ category.subcategories|tojson }}{% else %}null{% endif %}, - "version": {% if category.version %}"{{ category.version }}"{% else %}null{% endif %}, - "ownerId": {% if category.owner_id %}"{{ category.owner_id }}"{% else %}null{% endif %}, + "subcategories": {%- if category.subcategories %}{{ category.subcategories|tojson }}{% else %}null{%- endif %}, + "version": {%- if category.version %}"{{ category.version }}"{% else %}null{%- endif %}, + "ownerId": {%- if category.owner_id %}"{{ category.owner_id }}"{% else %}null{%- endif %}, "empty": {{ category.empty|tojson }}, - "type": {% if category.type %}"{{ category.type }}"{% else %}null{% endif %}, + "type": {%- if category.type %}"{{ category.type }}"{% else %}null{%- endif %}, "icons": {% if category.icons %}{{ category.icons|tojson }}{% else %}null{% endif %} } ] \ No newline at end of file diff --git a/src/onapsdk/sdc/templates/vf_create.json.j2 b/src/onapsdk/sdc/templates/vf_create.json.j2 index 6f165e5..1d9c701 100644 --- a/src/onapsdk/sdc/templates/vf_create.json.j2 +++ b/src/onapsdk/sdc/templates/vf_create.json.j2 @@ -8,10 +8,10 @@ "componentInstancesProperties": {}, "componentType": "RESOURCE", "contactId": "cs0008", - {% if category.name != "Allotted Resource" %} + {%- if category.name != "Allotted Resource" %} "csarUUID": "{{ vsp.csar_uuid }}", "csarVersion": "1.0", - {% endif %} + {%- endif %} "deploymentArtifacts": {}, "description": "VF", "icon": "defaulticon", diff --git a/src/onapsdk/sdc2/templates/sdc2_create_resource_base.json.j2 b/src/onapsdk/sdc2/templates/sdc2_create_resource_base.json.j2 index 4e8cb46..9b0bab9 100644 --- a/src/onapsdk/sdc2/templates/sdc2_create_resource_base.json.j2 +++ b/src/onapsdk/sdc2/templates/sdc2_create_resource_base.json.j2 @@ -2,10 +2,10 @@ "name": "{{ name }}", "contactId": "{{ user_id }}", "componentType": "RESOURCE", - {% if category.name != "Allotted Resource" and vsp is not none %} + {%- if category.name != "Allotted Resource" and vsp is not none %} "csarUUID": "{{ vsp.csar_uuid }}", "csarVersion": "1.0", - {% endif %} + {%- endif %} "categories": [{ "name": "{{ category.name }}", "uniqueId": "{{ category.unique_id }}", diff --git a/src/onapsdk/sdnc/templates/create_node_netconf_api.json.j2 b/src/onapsdk/sdnc/templates/create_node_netconf_api.json.j2 index 26d4c51..70127a6 100644 --- a/src/onapsdk/sdnc/templates/create_node_netconf_api.json.j2 +++ b/src/onapsdk/sdnc/templates/create_node_netconf_api.json.j2 @@ -9,21 +9,21 @@ {%- elif key == "netconf-node-topology:port" %}"{{key}}": {{port_}} {%- elif key == "netconf-node-topology:username" %}"{{key}}": "{{username_}}" {%- elif key == "netconf-node-topology:password" %}"{{key}}": "{{password_}}" - {%- else %}"{{key}}": + {% else %}"{{key}}": {%- if value is number %}{{value}} {%- elif value is boolean %}{{value}} {%- elif value is string %}{{value}} {%- elif value is mapping %}{{value|replace("'",'"')|replace("True","true")|replace("False","false")}} {%- endif %} {%- endif %} - {%- else %} + {% else %} {%- if key == "node-id" %} "{{key}}": "{{node_id}}", {%- elif key == "netconf-node-topology:host" %}"{{key}}": "{{host_}}", {%- elif key == "netconf-node-topology:port" %}"{{key}}": {{port_}}, {%- elif key == "netconf-node-topology:username" %}"{{key}}": "{{username_}}", {%- elif key == "netconf-node-topology:password" %}"{{key}}": "{{password_}}", - {%- else %}"{{key}}": + {% else %}"{{key}}": {%- if value is number %}{{value}}, {%- elif value is boolean %}{{value|replace("True","true")}}, {%- elif value is string %}"{{value}}", diff --git a/src/onapsdk/sdnc/templates/create_service_gr_api.json.j2 b/src/onapsdk/sdnc/templates/create_service_gr_api.json.j2 index 5f575be..f50ffbf 100644 --- a/src/onapsdk/sdnc/templates/create_service_gr_api.json.j2 +++ b/src/onapsdk/sdnc/templates/create_service_gr_api.json.j2 @@ -6,13 +6,13 @@ "{{key}}": {%- if value is mapping %}{{value|replace("'",'"')|replace("True","true")|replace("False","false")}} {%- elif value == "" %}{} - {%- else %}"{{value}}" + {% else %}"{{value}}" {%- endif %} - {%- else %} + {% else %} "{{key}}": {%- if value is mapping %}{{value|replace("'",'"')|replace("True","true")|replace("False","false")}}, {%- elif value == "" %}{}, - {%- else %}"{{value}}", + {% else %}"{{value}}", {%- endif %} {%- endif %} {%- endfor %} diff --git a/src/onapsdk/sdnc/templates/instantiate_network_ala_carte_upload_preload_gr_api.json.j2 b/src/onapsdk/sdnc/templates/instantiate_network_ala_carte_upload_preload_gr_api.json.j2 index 9eead38..3690714 100644 --- a/src/onapsdk/sdnc/templates/instantiate_network_ala_carte_upload_preload_gr_api.json.j2 +++ b/src/onapsdk/sdnc/templates/instantiate_network_ala_carte_upload_preload_gr_api.json.j2 @@ -21,15 +21,15 @@ "start-address": "{{ subnet.start_address }}", "cidr-mask": "{{ subnet.cidr_mask }}", "ip-version": "{{ subnet.ip_version }}", - {% if subnet.dhcp_enabled %} + {%- if subnet.dhcp_enabled %} "dhcp-enabled": "Y", "dhcp-start-address": "{{ subnet.dhcp_start_address }}", "dhcp-end-address": "{{ subnet.dhcp_end_address }}", {% else %} "dhcp-enabled": "N", - {% endif %} + {%- endif %} "gateway-address": "{{ subnet.gateway_address }}" - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] }, diff --git a/src/onapsdk/so/templates/deletion_service.json.j2 b/src/onapsdk/so/templates/deletion_service.json.j2 index 022c08e..81927d6 100644 --- a/src/onapsdk/so/templates/deletion_service.json.j2 +++ b/src/onapsdk/so/templates/deletion_service.json.j2 @@ -14,13 +14,13 @@ "requestParameters": { "testApi": "GR_API", "aLaCarte": {{ a_la_carte | tojson }} - }{% if service_instance.sdc_service.resources and service_instance.sdc_service.has_vnfs %}, + }{%- if service_instance.sdc_service.resources and service_instance.sdc_service.has_vnfs %}, {# the code below is needed to be refactored #} {# https://gitlab.com/Orange-OpenSource/lfn/onap/python-onapsdk/-/issues/133 #} "cloudConfiguration": { "cloudOwner": "{{ service_instance.service_subscription.cloud_region.cloud_owner }}", "lcpCloudRegionId": "{{ service_instance.service_subscription.cloud_region.cloud_region_id }}", "tenantId": "{{ service_instance.service_subscription.tenant.tenant_id }}" - }{% endif %} + }{%- endif %} } } \ No newline at end of file diff --git a/src/onapsdk/so/templates/instantiate_multi_vnf_service_macro.json.j2 b/src/onapsdk/so/templates/instantiate_multi_vnf_service_macro.json.j2 index d02c259..1b04ca9 100644 --- a/src/onapsdk/so/templates/instantiate_multi_vnf_service_macro.json.j2 +++ b/src/onapsdk/so/templates/instantiate_multi_vnf_service_macro.json.j2 @@ -5,13 +5,13 @@ {% endblock %} {% block pnfs %} - {% if so_service.pnfs %} + {%- if so_service.pnfs %} "pnfs": [ {% for pnf in so_service.pnfs %} { "modelInfo":{ {% for sdc_pnf in sdc_service.pnfs %} - {% if sdc_pnf.model_name == pnf.model_name %} + {%- if sdc_pnf.model_name == pnf.model_name %} "modelCustomizationName":"{{ sdc_pnf.model_name }}", "modelCustomizationId":"{{ sdc_pnf.model_customization_id }}", "modelInvariantId":"{{ sdc_pnf.unique_uuid }}", @@ -19,7 +19,7 @@ "modelName":"{{ sdc_pnf.name }}", "modelType":"pnf", "modelVersion":"{{ sdc_pnf.model_version }}" - {% endif %} + {%- endif %} {% endfor %} }, "platform":{ @@ -30,7 +30,7 @@ }, "productFamilyId":"{{ aai_service.service_id }}", "instanceParams":[], - {% if pnf.registration_parameters %} + {%- if pnf.registration_parameters %} "pnfRegistrationFields": { "modelNumber": "{{ pnf.registration_parameters.model_number }}", "oamV4IpAddress": "{{ pnf.registration_parameters.oam_v4_ip_address }}", @@ -40,32 +40,32 @@ "unitType": "{{ pnf.registration_parameters.unit_type }}", "vendorName": "{{ pnf.registration_parameters.vendor_name }}" }, - {% endif %} - {% if pnf.processing_priority %} + {%- endif %} + {%- if pnf.processing_priority %} "processingPriority": "{{ pnf.processing_priority }}", - {% endif %} + {%- endif %} "instanceName": "{{ pnf.instance_name }}" - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} - ]{% if so_service.vnfs %},{% endif %} - {% endif %} + ]{%- if so_service.vnfs %},{%- endif %} + {%- endif %} {% endblock %} {% block vnfs %} - {% if so_service.vnfs %} + {%- if so_service.vnfs %} "vnfs": [ {% for vnf in so_service.vnfs %} { "modelInfo": { {% for sdc_vnf in sdc_service.vnfs %} - {% if sdc_vnf.model_name == vnf.model_name %} + {%- if sdc_vnf.model_name == vnf.model_name %} "modelName": "{{ sdc_vnf.model_name }}", "modelVersionId": "{{ sdc_vnf.model_version_id }}", "modelInvariantUuid": "{{ sdc_vnf.model_invariant_id }}", "modelVersion": "{{ sdc_vnf.model_version }}", "modelCustomizationId": "{{ sdc_vnf.model_customization_id }}", "modelInstanceName": "{{ sdc_vnf.model_name }}" - {% endif %} + {%- endif %} {% endfor %} }, "cloudConfiguration": { @@ -84,49 +84,49 @@ "instanceParams": [ { {% for key, value in vnf.parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} } ], - {% if vnf.processing_priority %} + {%- if vnf.processing_priority %} "processingPriority": "{{ vnf.processing_priority }}", - {% endif %} + {%- endif %} "vfModules": [ {% for vf_module in vnf.vf_modules %} { "modelInfo": { {% for sdc_vnf in sdc_service.vnfs %} - {% if sdc_vnf.model_name == vnf.model_name %} + {%- if sdc_vnf.model_name == vnf.model_name %} {% for sdc_vf_module in sdc_vnf.vf_modules %} {% set mylist = sdc_vf_module.name.split('..') %} {% set item = mylist|length-2 %} - {% if vf_module.model_name == mylist[item] %} + {%- if vf_module.model_name == mylist[item] %} "modelName": "{{ sdc_vf_module.model_name }}", "modelVersionId": "{{ sdc_vf_module.model_version_id }}", "modelInvariantUuid": "{{ sdc_vf_module.model_invariant_uuid }}", "modelVersion": "{{ sdc_vf_module.model_version }}", "modelCustomizationId": "{{ sdc_vf_module.model_customization_id }}" - {% endif %} + {%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} }, "instanceName": "{{ vf_module.instance_name }}", - {% if vf_module.processing_priority %} + {%- if vf_module.processing_priority %} "processingPriority": "{{ vf_module.processing_priority }}", - {% endif %} + {%- endif %} "instanceParams": [ { {% for key, value in vf_module.parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} } ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% endif %} + {%- endif %} {% endblock %} diff --git a/src/onapsdk/so/templates/instantiate_network_vnf_macro_base.json.j2 b/src/onapsdk/so/templates/instantiate_network_vnf_macro_base.json.j2 index 29e600c..116811a 100644 --- a/src/onapsdk/so/templates/instantiate_network_vnf_macro_base.json.j2 +++ b/src/onapsdk/so/templates/instantiate_network_vnf_macro_base.json.j2 @@ -45,55 +45,55 @@ "networkDetails": [ { "networkType": "{{ network_details.network_type }}", - "vnf-id": "{{ network_details.vnf_id }}"{% if network_details.child_resources %},{% endif %} - {% if network_details.child_resources %} + "vnf-id": "{{ network_details.vnf_id }}"{%- if network_details.child_resources %},{%- endif %} + {%- if network_details.child_resources %} "child-resources": [ {% for child_resource in network_details.child_resources %} { "{{ child_resource.network_details_element_type }}": { {% for key, value in child_resource.network_details_element_parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %}{% if loop.last and child_resource.child_resources %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %}{%- if loop.last and child_resource.child_resources %},{%- endif %} {% endfor %} - {% if child_resource.child_resources %} + {%- if child_resource.child_resources %} "child-resources": [ {% for child_resource_child_resource in child_resource.child_resources %} { {% for key, value in child_resource_child_resource.network_details_element_parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% endif %} + {%- endif %} } - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ], - {% endif %} - {% if network_details.related_to %} + {%- endif %} + {%- if network_details.related_to %} "related-to": [ {% for related_to in network_details.related_to %} { "{{ related_to.network_details_element_type }}": { {% for key, value in related_to.network_details_element_parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %}{% if loop.last and related_to.child_resources %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %}{%- if loop.last and related_to.child_resources %},{%- endif %} {% endfor %} - {% if related_to.child_resources %} + {%- if related_to.child_resources %} "child-resources": [ {% for related_to_child_resource in related_to.child_resources %} { {% for key, value in related_to_child_resource.network_details_element_parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% endif %} + {%- endif %} } - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% endif %} + {%- endif %} } ], "instanceParams": [] diff --git a/src/onapsdk/so/templates/instantiate_pnf_macro.json.j2 b/src/onapsdk/so/templates/instantiate_pnf_macro.json.j2 index 1f9b3a2..7d4c5bf 100755 --- a/src/onapsdk/so/templates/instantiate_pnf_macro.json.j2 +++ b/src/onapsdk/so/templates/instantiate_pnf_macro.json.j2 @@ -59,11 +59,11 @@ "instanceParams": [ { {% for pnf_parameter in pnf_parameters %} - {% if pnf_parameter.name == pnf.model_name %} + {%- if pnf_parameter.name == pnf.model_name %} {% for parameter in pnf_parameter.pnf_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ], diff --git a/src/onapsdk/so/templates/instantiate_pnf_macro_so_pnf.json.j2 b/src/onapsdk/so/templates/instantiate_pnf_macro_so_pnf.json.j2 index 27b9041..a1e6af8 100755 --- a/src/onapsdk/so/templates/instantiate_pnf_macro_so_pnf.json.j2 +++ b/src/onapsdk/so/templates/instantiate_pnf_macro_so_pnf.json.j2 @@ -54,7 +54,7 @@ "lineOfBusiness": { "lineOfBusinessName": "{{ line_of_business }}" }, - {% if so_pnf.registration_parameters %} + {%- if so_pnf.registration_parameters %} "pnfRegistrationFields": { "modelNumber": "{{ so_pnf.registration_parameters.model_number }}", "oamV4IpAddress": "{{ so_pnf.registration_parameters.oam_v4_ip_address }}", @@ -64,13 +64,13 @@ "unitType": "{{ so_pnf.registration_parameters.unit_type }}", "vendorName": "{{ so_pnf.registration_parameters.vendor_name }}" }, - {% endif %} + {%- endif %} "productFamilyId": "1234", "instanceName": "{{ instance_name }}", "instanceParams": [ { {% for key, value in so_pnf.parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} } ] diff --git a/src/onapsdk/so/templates/instantiate_service_ala_carte.json.j2 b/src/onapsdk/so/templates/instantiate_service_ala_carte.json.j2 index 4954cde..47ddeef 100644 --- a/src/onapsdk/so/templates/instantiate_service_ala_carte.json.j2 +++ b/src/onapsdk/so/templates/instantiate_service_ala_carte.json.j2 @@ -20,12 +20,12 @@ }, "requestParameters": { "userParams": [ - {% if enable_multicloud %} + {%- if enable_multicloud %} { "name":"orchestrator", "value":"multicloud" } - {% endif %} + {%- endif %} ], "testApi": "GR_API", "subscriptionServiceType": "{{ service_subscription.service_type }}", diff --git a/src/onapsdk/so/templates/instantiate_service_macro.json.j2 b/src/onapsdk/so/templates/instantiate_service_macro.json.j2 index a252672..1435205 100644 --- a/src/onapsdk/so/templates/instantiate_service_macro.json.j2 +++ b/src/onapsdk/so/templates/instantiate_service_macro.json.j2 @@ -2,11 +2,11 @@ "requestDetails": { "requestInfo": { "suppressRollback": false, - {% if aai_service %} + {%- if aai_service %} "productFamilyId":"{{ aai_service.service_id }}", {% else %} "productFamilyId": "1234", - {% endif %} + {%- endif %} "requestorId": "demo", "instanceName": "{{ service_instance_name }}", "source": "VID" @@ -18,13 +18,13 @@ "modelName": "{{ sdc_service.name }}", "modelVersion": "1.0" }, - {% if sdc_service.components and sdc_service.has_vnfs %} + {%- if sdc_service.components and sdc_service.has_vnfs %} "cloudConfiguration": { "tenantId": "{{ tenant.tenant_id }}", "cloudOwner": "{{ cloud_region.cloud_owner }}", "lcpCloudRegionId": "{{ cloud_region.cloud_region_id }}" }, - {% endif %} + {%- endif %} "subscriberInfo": { "globalSubscriberId": "{{ customer.global_customer_id }}" }, @@ -36,30 +36,30 @@ { "Homing_Solution": "none" }, - {% if enable_multicloud %} + {%- if enable_multicloud %} { "name":"orchestrator", "value":"multicloud" }, - {% endif %} + {%- endif %} { "service": { - {% if not sdc_service.components %} + {%- if not sdc_service.components %} "instanceParams": [], {% else %} "instanceParams": [ - {% if so_service %} + {%- if so_service %} { {% for key, value in so_service.parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %}, - {% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %}, + {%- endif %} {% endfor %} } - {% endif %} + {%- endif %} ], - {% endif %} + {%- endif %} "instanceName": "{{ service_instance_name }}", - {% if not sdc_service.components %} + {%- if not sdc_service.components %} "resources": {}, "modelInfo": { "modelVersion": "1.0", @@ -72,7 +72,7 @@ {% else %} "resources": { {% block pnfs %} - {% if sdc_service.pnfs %} + {%- if sdc_service.pnfs %} "pnfs":[ {% for pnf in sdc_service.pnfs %} { @@ -94,14 +94,14 @@ "productFamilyId":"{{ aai_service.service_id }}", "instanceParams":[], "instanceName":"{{ service_instance_name }}" - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% if sdc_service.vnfs %},{% endif %} - {% endif %} + {%- if sdc_service.vnfs %},{%- endif %} + {%- endif %} {% endblock %} {% block vnfs %} - {% if sdc_service.vnfs %} + {%- if sdc_service.vnfs %} "vnfs": [ {% for vnf in sdc_service.vnfs %} { @@ -129,11 +129,11 @@ "instanceParams": [ { {% for vnf_parameter in vnf_parameters %} - {% if vnf_parameter.name == vnf.model_name %} + {%- if vnf_parameter.name == vnf.model_name %} {% for parameter in vnf_parameter.vnf_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ], @@ -151,27 +151,27 @@ "instanceParams": [ { {% for vnf_parameter in vnf_parameters %} - {% if vnf_parameter.name == vnf.model_name %} + {%- if vnf_parameter.name == vnf.model_name %} {% set mylist = vf_module.name.split('..') %} {% set item = mylist|length-2 %} {% for vf_module_parameter in vnf_parameter.vfmodule_parameters %} - {% if vf_module_parameter.name == mylist[item] %} + {%- if vf_module_parameter.name == mylist[item] %} {% for parameter in vf_module_parameter.vfmodule_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% endif %} + {%- endif %} {% endblock %} }, "modelInfo": { @@ -182,7 +182,7 @@ "modelType": "service" } } - {% endif %} + {%- endif %} } ], diff --git a/src/onapsdk/so/templates/instantiate_service_macro_skip_pnf_registration_event.json.j2 b/src/onapsdk/so/templates/instantiate_service_macro_skip_pnf_registration_event.json.j2 index caa0ab4..b356a17 100644 --- a/src/onapsdk/so/templates/instantiate_service_macro_skip_pnf_registration_event.json.j2 +++ b/src/onapsdk/so/templates/instantiate_service_macro_skip_pnf_registration_event.json.j2 @@ -2,11 +2,11 @@ "requestDetails": { "requestInfo": { "suppressRollback": false, - {% if aai_service %} + {%- if aai_service %} "productFamilyId":"{{ aai_service.service_id }}", {% else %} "productFamilyId": "1234", - {% endif %} + {%- endif %} "requestorId": "demo", "instanceName": "{{ service_instance_name }}", "source": "VID" @@ -18,13 +18,13 @@ "modelName": "{{ sdc_service.name }}", "modelVersion": "1.0" }, - {% if sdc_service.has_vnfs %} + {%- if sdc_service.has_vnfs %} "cloudConfiguration": { "tenantId": "{{ tenant.tenant_id }}", "cloudOwner": "{{ cloud_region.cloud_owner }}", "lcpCloudRegionId": "{{ cloud_region.cloud_region_id }}" }, - {% endif %} + {%- endif %} "subscriberInfo": { "globalSubscriberId": "{{ customer.global_customer_id }}" }, @@ -36,19 +36,19 @@ { "Homing_Solution": "none" }, - {% if enable_multicloud %} + {%- if enable_multicloud %} { "name":"orchestrator", "value":"multicloud" }, - {% endif %} + {%- endif %} { "service": { "instanceParams": [], "instanceName": "{{ service_instance_name }}", "resources": { {% block pnfs %} - {% if sdc_service.pnfs %} + {%- if sdc_service.pnfs %} "pnfs":[ {% for pnf in sdc_service.pnfs %} { @@ -78,14 +78,14 @@ "productFamilyId":"{{ aai_service.service_id }}", "instanceParams":[], "instanceName":"{{ service_instance_name }}" - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% if sdc_service.vnfs %},{% endif %} - {% endif %} + {%- if sdc_service.vnfs %},{%- endif %} + {%- endif %} {% endblock %} {% block vnfs %} - {% if sdc_service.vnfs %} + {%- if sdc_service.vnfs %} "vnfs": [ {% for vnf in sdc_service.vnfs %} { @@ -113,11 +113,11 @@ "instanceParams": [ { {% for vnf_parameter in vnf_parameters %} - {% if vnf_parameter.name == vnf.model_name %} + {%- if vnf_parameter.name == vnf.model_name %} {% for parameter in vnf_parameter.vnf_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ], @@ -135,27 +135,27 @@ "instanceParams": [ { {% for vnf_parameter in vnf_parameters %} - {% if vnf_parameter.name == vnf.model_name %} + {%- if vnf_parameter.name == vnf.model_name %} {% set mylist = vf_module.name.split('..') %} {% set item = mylist|length-2 %} {% for vf_module_parameter in vnf_parameter.vfmodule_parameters %} - {% if vf_module_parameter.name == mylist[item] %} + {%- if vf_module_parameter.name == mylist[item] %} {% for parameter in vf_module_parameter.vfmodule_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] - {% endif %} + {%- endif %} {% endblock %} }, "modelInfo": { diff --git a/src/onapsdk/so/templates/instantiate_vf_module_ala_carte.json.j2 b/src/onapsdk/so/templates/instantiate_vf_module_ala_carte.json.j2 index 0738379..5bfe12e 100644 --- a/src/onapsdk/so/templates/instantiate_vf_module_ala_carte.json.j2 +++ b/src/onapsdk/so/templates/instantiate_vf_module_ala_carte.json.j2 @@ -22,7 +22,7 @@ { "name": "{{ parameter.name }}", "value": "{{ parameter.value }}" - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ], "testApi": "GR_API", diff --git a/src/onapsdk/so/templates/instantiate_vnf_ala_carte.json.j2 b/src/onapsdk/so/templates/instantiate_vnf_ala_carte.json.j2 index 9fbf989..a8c49a8 100644 --- a/src/onapsdk/so/templates/instantiate_vnf_ala_carte.json.j2 +++ b/src/onapsdk/so/templates/instantiate_vnf_ala_carte.json.j2 @@ -13,6 +13,6 @@ { "name": "{{ parameter.name }}", "value": "{{ parameter.value }}" -}{% if not loop.last %},{% endif %} +}{%- if not loop.last %},{%- endif %} {% endfor %} {% endblock %} \ No newline at end of file diff --git a/src/onapsdk/so/templates/instantiate_vnf_macro.json.j2 b/src/onapsdk/so/templates/instantiate_vnf_macro.json.j2 index 2d7aeee..baadd39 100644 --- a/src/onapsdk/so/templates/instantiate_vnf_macro.json.j2 +++ b/src/onapsdk/so/templates/instantiate_vnf_macro.json.j2 @@ -69,11 +69,11 @@ "instanceParams": [ { {% for vnf_parameter in vnf_parameters %} - {% if vnf_parameter.name == vnf.model_name %} + {%- if vnf_parameter.name == vnf.model_name %} {% for parameter in vnf_parameter.vnf_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ], @@ -92,21 +92,21 @@ "instanceParams": [ { {% for vnf_parameter in vnf_parameters %} - {% if vnf_parameter.name == vnf.model_name %} + {%- if vnf_parameter.name == vnf.model_name %} {% set mylist = vf_module.name.split('..') %} {% set item = mylist|length-2 %} {% for vf_module_parameter in vnf_parameter.vfmodule_parameters %} - {% if vf_module_parameter.name == mylist[item] %} + {%- if vf_module_parameter.name == mylist[item] %} {% for parameter in vf_module_parameter.vfmodule_parameters %} - "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %} + "{{ parameter.name }}": "{{ parameter.value }}"{%- if not loop.last %},{%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} - {% endif %} + {%- endif %} {% endfor %} } ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] } diff --git a/src/onapsdk/so/templates/instantiate_vnf_macro_so_vnf.json.j2 b/src/onapsdk/so/templates/instantiate_vnf_macro_so_vnf.json.j2 index c7f4356..5525cc3 100644 --- a/src/onapsdk/so/templates/instantiate_vnf_macro_so_vnf.json.j2 +++ b/src/onapsdk/so/templates/instantiate_vnf_macro_so_vnf.json.j2 @@ -69,7 +69,7 @@ "instanceParams": [ { {% for key, value in so_vnf.parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} } ], @@ -78,33 +78,33 @@ { "modelInfo": { - {% if vnf.model_name == so_vnf.model_name %} + {%- if vnf.model_name == so_vnf.model_name %} {% for sdc_vf_module in vnf.vf_modules %} {% set mylist = sdc_vf_module.name.split('..') %} {% set item = mylist|length-2 %} - {% if vf_module.model_name == mylist[item] %} + {%- if vf_module.model_name == mylist[item] %} "modelName": "{{ sdc_vf_module.model_name }}", "modelVersionId": "{{ sdc_vf_module.model_version_id}}", "modelInvariantUuid": "{{ sdc_vf_module.model_invariant_uuid }}", "modelVersion": "{{ sdc_vf_module.model_version }}", "modelCustomizationId": "{{ sdc_vf_module.model_customization_id }}" - {% endif %} + {%- endif %} {% endfor %} - {% endif %} + {%- endif %} }, "instanceName": "{{ vf_module.instance_name }}", - {% if vf_module.processing_priority %} + {%- if vf_module.processing_priority %} "processingPriority": "{{ vf_module.processing_priority }}", - {% endif %} + {%- endif %} "instanceParams": [ { {% for key, value in vf_module.parameters.items() %} - "{{ key }}": "{{ value }}"{% if not loop.last %},{% endif %} + "{{ key }}": "{{ value }}"{%- if not loop.last %},{%- endif %} {% endfor %} } ] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] } diff --git a/src/onapsdk/so/templates/modify_pnf.json.j2 b/src/onapsdk/so/templates/modify_pnf.json.j2 index 898e549..53fa4ff 100644 --- a/src/onapsdk/so/templates/modify_pnf.json.j2 +++ b/src/onapsdk/so/templates/modify_pnf.json.j2 @@ -32,7 +32,7 @@ "instanceParams": [], "resources": { {% block pnfs %} - {% if service.pnfs %} + {%- if service.pnfs %} "pnfs": [ {% for pnf in service.pnfs %} { @@ -71,7 +71,7 @@ } {% endfor %} ] - {% endif %} + {%- endif %} {% endblock %} } } diff --git a/src/onapsdk/so/templates/vf_model_info.json.j2 b/src/onapsdk/so/templates/vf_model_info.json.j2 index 4b40898..d93722a 100644 --- a/src/onapsdk/so/templates/vf_model_info.json.j2 +++ b/src/onapsdk/so/templates/vf_model_info.json.j2 @@ -10,6 +10,6 @@ }, "instanceName": "{{ module.metadata.vfModuleModelName }}", "instanceParams": [] - }{% if not loop.last %},{% endif %} + }{%- if not loop.last %},{%- endif %} {% endfor %} ] \ No newline at end of file diff --git a/tests/test_pnf.py b/tests/test_pnf.py index 0f606a0..a8c2a35 100644 --- a/tests/test_pnf.py +++ b/tests/test_pnf.py @@ -16,6 +16,7 @@ from unittest import mock from unittest.mock import MagicMock from pathlib import Path +import json import pytest @@ -181,7 +182,6 @@ def test_create_already_exists(mock_category, mock_send, mock_exists): @mock.patch.object(Pnf, 'send_message_json') @mock.patch.object(Pnf, "category", new_callable=mock.PropertyMock) def test_create_issue_in_creation(mock_category, mock_send, mock_exists): -# def test_create_issue_in_creation(mock_send, mock_exists): """Do nothing if not created but issue during creation.""" pnf = Pnf() vsp = Vsp() @@ -190,7 +190,7 @@ def test_create_issue_in_creation(mock_category, mock_send, mock_exists): vsp.create_csar = MagicMock(return_value=True) vsp.vendor = vendor pnf.vsp = vsp - expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories": [{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version": null,\n "ownerId": null,\n "empty": false,\n "type": null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n \n "csarUUID": "None",\n "csarVersion": "1.0",\n "vendorName": "Generic-Vendor",\n \n "deploymentArtifacts": {},\n "description": "PNF",\n "icon": "defaulticon",\n "name": "ONAP-test-PNF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "PNF",\n "tags": ["ONAP-test-PNF"],\n "toscaArtifacts": {},\n "vendorRelease": "1.0"\n}' + expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories":[{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version":null,\n "ownerId":null,\n "empty": false,\n "type":null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n "csarUUID": "None",\n "csarVersion": "1.0",\n "vendorName": "Generic-Vendor",\n \n "deploymentArtifacts": {},\n "description": "PNF",\n "icon": "defaulticon",\n "name": "ONAP-test-PNF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "PNF",\n "tags": ["ONAP-test-PNF"],\n "toscaArtifacts": {},\n "vendorRelease": "1.0"\n}' mock_exists.return_value = False mock_send.side_effect = RequestError rc = ResourceCategory( @@ -223,7 +223,7 @@ def test_create_OK(mock_category, mock_send, mock_exists): pnf.vsp = vsp vsp.vendor = vendor vsp._csar_uuid = "1234" - expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories": [{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version": null,\n "ownerId": null,\n "empty": false,\n "type": null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n \n "csarUUID": "1234",\n "csarVersion": "1.0",\n "vendorName": "Generic-Vendor",\n \n "deploymentArtifacts": {},\n "description": "PNF",\n "icon": "defaulticon",\n "name": "ONAP-test-PNF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "PNF",\n "tags": ["ONAP-test-PNF"],\n "toscaArtifacts": {},\n "vendorRelease": "1.0"\n}' + expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories":[{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version":null,\n "ownerId":null,\n "empty": false,\n "type":null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n "csarUUID": "1234",\n "csarVersion": "1.0",\n "vendorName": "Generic-Vendor",\n \n "deploymentArtifacts": {},\n "description": "PNF",\n "icon": "defaulticon",\n "name": "ONAP-test-PNF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "PNF",\n "tags": ["ONAP-test-PNF"],\n "toscaArtifacts": {},\n "vendorRelease": "1.0"\n}' mock_exists.return_value = False mock_send.return_value = {'resourceType': 'PNF', 'name': 'one', 'uuid': '1234', 'invariantUUID': '5678', 'version': '1.0', 'uniqueId': '91011', 'lifecycleState': 'NOT_CERTIFIED_CHECKOUT'} rc = ResourceCategory( diff --git a/tests/test_sp_partner.py b/tests/test_sp_partner.py index 7005c02..13e3644 100644 --- a/tests/test_sp_partner.py +++ b/tests/test_sp_partner.py @@ -81,4 +81,4 @@ def test_sp_partner_create(_, mock_send): mock_send.assert_called_once_with("PUT", "Declare A&AI sp partner", "https://aai.api.sparky.simpledemo.onap.org:30233/aai/v27/business/sp-partners/sp-partner/123", - data='{\n "sp-partner-id": "123"\n \n \n \n \n \n \n}') + data='{\n "sp-partner-id": "123"\n}') diff --git a/tests/test_vendor.py b/tests/test_vendor.py index f791b8e..7df65bc 100644 --- a/tests/test_vendor.py +++ b/tests/test_vendor.py @@ -205,7 +205,7 @@ def test_submit_certified_NOK(mock_send, mock_load, mock_exists): vendor = Vendor() vendor._identifier = "12345" mock_send.side_effect = RequestError - expected_data = '{\n\n "action": "Submit"\n}' + expected_data = '{\n "action": "Submit"\n}' vendor._status = "Draft" vendor._version = "1234" with pytest.raises(RequestError) as err: @@ -225,7 +225,7 @@ def test_submit_certified_OK(mock_send, mock_load, mock_exists): vendor._version = "1234" vendor.identifier = "12345" mock_send.return_value = mock.Mock() - expected_data = '{\n\n "action": "Submit"\n}' + expected_data = '{\n "action": "Submit"\n}' vendor.submit() mock_send.assert_called_once_with("PUT", "Submit Vendor", 'https://sdc.api.fe.simpledemo.onap.org:30207/sdc1/feProxy/onboarding-api/v1.0/vendor-license-models/12345/versions/1234/actions', data=expected_data) assert vendor.status == const.CERTIFIED @@ -324,4 +324,4 @@ def test_vendor_archive(mock_send, mock_load): mock_send.assert_called_once_with("PUT", "ARCHIVE Vendor", "https://sdc.api.fe.simpledemo.onap.org:30207/sdc1/feProxy/onboarding-api/v1.0/items/12345/actions", - data='{\n\n "action": "ARCHIVE"\n}') + data='{\n "action": "ARCHIVE"\n}') diff --git a/tests/test_vf.py b/tests/test_vf.py index 540a377..2afff2a 100644 --- a/tests/test_vf.py +++ b/tests/test_vf.py @@ -190,7 +190,7 @@ def test_create_issue_in_creation(mock_category, mock_send, mock_exists): vsp.create_csar = MagicMock(return_value=True) vsp.vendor = vendor vf.vsp = vsp - expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories": [{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version": null,\n "ownerId": null,\n "empty": false,\n "type": null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n \n "csarUUID": "None",\n "csarVersion": "1.0",\n \n "deploymentArtifacts": {},\n "description": "VF",\n "icon": "defaulticon",\n "name": "ONAP-test-VF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "VF",\n "tags": ["ONAP-test-VF"],\n "toscaArtifacts": {},\n "vendorName": "Generic-Vendor",\n "vendorRelease": "1.0"\n}' + expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories":[{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version":null,\n "ownerId":null,\n "empty": false,\n "type":null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n "csarUUID": "None",\n "csarVersion": "1.0",\n "deploymentArtifacts": {},\n "description": "VF",\n "icon": "defaulticon",\n "name": "ONAP-test-VF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "VF",\n "tags": ["ONAP-test-VF"],\n "toscaArtifacts": {},\n "vendorName": "Generic-Vendor",\n "vendorRelease": "1.0"\n}' mock_exists.return_value = False mock_send.side_effect = RequestError rc = ResourceCategory( @@ -223,7 +223,7 @@ def test_create_OK(mock_category, mock_send, mock_exists): vf.vsp = vsp vsp.vendor = vendor vsp._csar_uuid = "1234" - expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories": [{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version": null,\n "ownerId": null,\n "empty": false,\n "type": null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n \n "csarUUID": "1234",\n "csarVersion": "1.0",\n \n "deploymentArtifacts": {},\n "description": "VF",\n "icon": "defaulticon",\n "name": "ONAP-test-VF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "VF",\n "tags": ["ONAP-test-VF"],\n "toscaArtifacts": {},\n "vendorName": "Generic-Vendor",\n "vendorRelease": "1.0"\n}' + expected_data = '{\n "artifacts": {},\n "attributes": [],\n "capabilities": {},\n "categories": [\n {\n "normalizedName": "generic",\n "name": "Generic",\n "uniqueId": "resourceNewCategory.generic",\n "subcategories":[{"empty": false, "groupings": null, "icons": ["objectStorage", "compute"], "name": "Abstract", "normalizedName": "abstract", "ownerId": null, "type": null, "uniqueId": "resourceNewCategory.generic.abstract", "version": null}],\n "version":null,\n "ownerId":null,\n "empty": false,\n "type":null,\n "icons": null\n }\n ],\n "componentInstances": [],\n "componentInstancesAttributes": {},\n "componentInstancesProperties": {},\n "componentType": "RESOURCE",\n "contactId": "cs0008",\n "csarUUID": "1234",\n "csarVersion": "1.0",\n "deploymentArtifacts": {},\n "description": "VF",\n "icon": "defaulticon",\n "name": "ONAP-test-VF",\n "properties": [],\n "groups": [],\n "requirements": {},\n "resourceType": "VF",\n "tags": ["ONAP-test-VF"],\n "toscaArtifacts": {},\n "vendorName": "Generic-Vendor",\n "vendorRelease": "1.0"\n}' mock_exists.return_value = False mock_send.return_value = {'resourceType': 'VF', 'name': 'one', 'uuid': '1234', 'invariantUUID': '5678', 'version': '1.0', 'uniqueId': '91011', 'lifecycleState': 'NOT_CERTIFIED_CHECKOUT'} rc = ResourceCategory( diff --git a/tests/test_vsp.py b/tests/test_vsp.py index 7f427a1..44f646c 100644 --- a/tests/test_vsp.py +++ b/tests/test_vsp.py @@ -391,7 +391,7 @@ def test_submit_OK(mock_send, mock_status): """Don't update status if submission NOK.""" vsp = Vsp() vsp._status = const.COMMITED - expected_data = '{\n\n "action": "Submit"\n}' + expected_data = '{\n "action": "Submit"\n}' vsp._version = "1234" vsp._identifier = "12345" vsp.submit() @@ -415,7 +415,7 @@ def test_create_csar_not_OK(mock_send, mock_status): vsp = Vsp() vsp._status = const.CERTIFIED mock_send.return_value = {} - expected_data = '{\n\n "action": "Create_Package"\n}' + expected_data = '{\n "action": "Create_Package"\n}' vsp._version = "1234" vsp._identifier = "12345" vsp.create_csar() @@ -432,7 +432,7 @@ def test_create_csar_OK(mock_send, mock_status): result.status_code = 201 result._content = json.dumps({'packageId': "64"}).encode('UTF-8') mock_send.return_value = result - expected_data = '{\n\n "action": "Create_Package"\n}' + expected_data = '{\n "action": "Create_Package"\n}' vsp._version = "1234" vsp._identifier = "12345" vsp.create_csar() @@ -455,7 +455,7 @@ def test_commit_OK(mock_send, mock_status): """Don't update status if submission NOK.""" vsp = Vsp() vsp._status = const.VALIDATED - expected_data = '{\n\n "commitRequest":{"message":"ok"},\n\n "action": "Commit"\n}' + expected_data = '{\n "commitRequest":{"message":"ok"},\n "action": "Commit"\n}' vsp._version = "1234" vsp._identifier = "12345" vsp.commit() @@ -797,4 +797,4 @@ def test_archive_vsp(mock_send, mock_load): mock_send.assert_called_once_with("PUT", "ARCHIVE Vsp", "https://sdc.api.fe.simpledemo.onap.org:30207/sdc1/feProxy/onboarding-api/v1.0/items/1232/actions", - data='{\n\n "action": "ARCHIVE"\n}') + data='{\n "action": "ARCHIVE"\n}') -- cgit 1.2.3-korg