aboutsummaryrefslogtreecommitdiffstats
path: root/src/onapsdk/sdnc/templates/create_node_netconf_api.json.j2
blob: 26d4c513d897fe81c51aca736696084f92735843 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
  "node": [
    {
    {%- for key, value in node.items() %}
      {%- if loop.last %}
        {%- 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}}":
          {%- 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 %}
        {%- 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}}":
          {%- if value is number %}{{value}},
          {%- elif value is boolean %}{{value|replace("True","true")}},
          {%- elif value is string %}"{{value}}",
          {%- elif value is mapping %}{{value|replace("'",'"')|replace("True","true")|replace("False","false")}},
          {%- endif %}
        {%- endif %}
      {%- endif %}
    {% endfor %}
    }
  ]
}