Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Conductorcopy service to a template
1- create a blank template
2- add name and descriptive
3- copy the service to the new template




go to advance mode

templet → jinja 

modify the parameter to variable


Code Block
titleconvert to jinja template
example:

"name": "{service_name",             >>>>>      "name": "{{instance.variables['name']}}",



and in the variable:
--------------------
{
  "instances": [
    {
      "name": "Instance_1",
      "variables": {       <<<<<<<<< list of all variables
        "name": "service11_from_template",  <<<<<<<<<<<<<< Name variable 
        "address": [
          "199.1.4.10"
        ]
      }
    },


Generate the service from jinja_template + json variable

click on the magic wand (wink)

not advanced mode

multiple value ( list ip address, ports )

scripting in the 


Code Block
titlemultiple
{% for address in addresses %}
  {
    "ipAddress": "{{address}}"
  }{%- if forloop.last == false -%},{%- endif %}
{% endfor %}


          {% for address in instance.variables.addresses %}
            {
            "{{address}},"
            }{%- if forloop.last == false -%},{%- endif %}
          {% endfor %}



create a template from file 



Click New:


>> provide a name and descriptive

Variable from a Source filecsv
convert csv files to json

https://csvjson.com/csv2json


Code Block
titlecsv to json
collapsetrue
Source file:
-----------
name_service, dst_ip_address,dst_protocol,dst_port
service1, 10.0.19.1,tcp,22

name_service, accessPolicy, accessPolicy,dst_ip_address,dst_protocol,dst_port,dst_port
service1, tenant1, tenant2, 10.0.19.1,tcp,80,81


JSON file:
---------
[
  {
    "name_service": "service1",
    "dst_ip_address": "10.0.19.1",
    "dst_protocol": "tcp",
    "dst_port": 22
  }
]





Rest API






...