The conductor injest ingest json files
Script Language: https://shopify.github.io/liquid/
https://docs.128technology.com/docs/config_templates/#creating-a-template
Conductor | copy service to a template | convert csv files to json | https://csvjson.com/csv2json
---|
1-Create a blank template ( New way ) |
Image Added Image Added |
1- create a blank template ( Old way ) | Image Added |
2- add name and descriptive | Image Added |
3- copy the service to the new template | Image Added |
| Image Added |
Advance mode |
|
---|
| Image Added |
template → jinja format with {{ }} | modify the parameter to variable
Code Block |
---|
title | convert 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 Image Added |
Not advanced mode |
|
---|
| Image Added |
| multiple value ( list ip address, ports ) |
---|
| |
scripting in the |
Code Block |
---|
| {% 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 file | csv |
---|
convert csv files to json | csv to json and json to csv
Code Block |
---|
title | csv to json |
---|
collapse | true |
---|
| 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
}
] |
|
Code Block |
---|
| {
"authority": {
"service": [
{
"name": "<service_name>",
"accessPolicy": [
>>>>> loop if more than one
{
"source": "<tenant_name1>"
},
{
"source": "<tenant_name2>"
}
<<<<<<<
],
"description": "send private subnet to the HQ",
"security": "internal",
"address": [
"10.1.6.0/24",
"10.1.16.0/24"
],
"transport": [
{
"protocol": "icmp"
},
{
"protocol": "tcp",
"portRange": [
{
"startPort": "22"
},
{
"startPort": "443"
},
{
"startPort": "80"
}
]
}
]
} |
|
Code Block |
---|
| {
"instances":[
{
"service_name": "service1",
"dst_ip_address": "10.0.19.1",
"dst_protocol": "tcp",
"dst_port": 22
"accessPolicy":[
"source": "<tenant_name1>",
"source": "<tenant_name2>"
]
}
]
} |
|
Rest API |
|
---|
|
|
|
|
|
|