From 7ad72c86fbd10888a849eed2b00dc9fddadef5aa Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Tue, 18 Jun 2019 19:43:50 -0400 Subject: Add Jinja2 custom ResourceLocator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow to include template within template to create template hierarchy Change-Id: I21c5deaf51d391e1a51b9863a905c26b1891db16 Issue-ID: CCSDK-1417 Signed-off-by: Alexis de Talhouët --- .../templates/base-config-data-jinja.json | 15 +------- .../templates/base-config-jinja-template.jinja | 42 ---------------------- .../src/test/resources/templates/interface.jinja | 3 ++ .../src/test/resources/templates/isis.jinja | 3 ++ .../src/test/resources/templates/master.jinja | 7 ++++ 5 files changed, 14 insertions(+), 56 deletions(-) delete mode 100755 ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-jinja-template.jinja create mode 100755 ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja create mode 100644 ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja create mode 100644 ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja (limited to 'ms/controllerblueprints/modules/blueprint-core/src/test/resources') diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json index bbfb38d80..ab7abf3d4 100644 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-data-jinja.json @@ -1,16 +1,3 @@ { - "node_hostname": "sdnc-host", - "node_backup_router_address": "2001:1890:1253::192:168:100:1", - "node_backup_router_d_address": "2011:1090:1253::112:158:100:1", - "servers": [ - "Server1", - "Server2", - "Server3" - ], - "classes": [ - "superuser-class", - "tacacs-adv-class", - "tacacs-base-class" - ], - "system_password": "teamops-system-password" + "occurrence": 2 } \ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-jinja-template.jinja b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-jinja-template.jinja deleted file mode 100755 index db900bc8b..000000000 --- a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/base-config-jinja-template.jinja +++ /dev/null @@ -1,42 +0,0 @@ - - 15.1X49-D50.3 - - node0 - - {%- for server in servers %} - {{ server }} - {%- endfor %} - - - {{ node_hostname }} - -
{{ node_backup_router_address }}
- {{ node_backup_router_d_address }} -
- - ONAP information assets - {%- for class in classes %} - - {{ class }} - - {%- endfor %} - - readwrite - Read - Write Account Access - 1002 - tacacs-adv-class - - {{ system_password }} - - - - {%- for element in additional_array %} - - {{ element.name }} - {{ element.location }} - - {%- endfor %} -
-
-
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja new file mode 100755 index 000000000..93114d90a --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/interface.jinja @@ -0,0 +1,3 @@ + +blo + \ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja new file mode 100644 index 000000000..f46d91330 --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/isis.jinja @@ -0,0 +1,3 @@ + +blah + \ No newline at end of file diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja new file mode 100644 index 000000000..1137b2595 --- /dev/null +++ b/ms/controllerblueprints/modules/blueprint-core/src/test/resources/templates/master.jinja @@ -0,0 +1,7 @@ +{%- for i in range(occurrence) %} + +{% include "templates/isis.jinja" %} +{% include "templates/interface.jinja" %} + +{{ "]]>]]" if not loop.last }} +{%- endfor %} \ No newline at end of file -- cgit 1.2.3-korg