aboutsummaryrefslogtreecommitdiffstats
path: root/src/onapsdk/so/templates/instantiate_service_macro.json.j2
blob: a2526721cfa746e5292a8bba49ad97fd3c9f9a41 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{
    "requestDetails": {
        "requestInfo": {
            "suppressRollback": false,
            {% if aai_service %}
            "productFamilyId":"{{ aai_service.service_id }}",
            {% else %}
            "productFamilyId": "1234",
            {% endif %}
            "requestorId": "demo",
            "instanceName": "{{ service_instance_name }}",
            "source": "VID"
        },
        "modelInfo": {
            "modelType": "service",
			"modelInvariantId": "{{ sdc_service.unique_uuid }}",
			"modelVersionId": "{{ sdc_service.identifier }}",
			"modelName": "{{ sdc_service.name }}",
            "modelVersion": "1.0"
        },
        {% 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 %}
        "subscriberInfo": {
            "globalSubscriberId": "{{ customer.global_customer_id }}"
        },
        "requestParameters": {
            {% block subscriptionServiceType %}
            "subscriptionServiceType": "{{ service_subscription.service_type }}",
            {% endblock %}
            "userParams": [
                {
                    "Homing_Solution": "none"
                },
                {% if enable_multicloud %}
                {
                    "name":"orchestrator",
                    "value":"multicloud"
                },
                {% endif %}
                {
                    "service": {
                        {% if not sdc_service.components %}
                        "instanceParams": [],
                        {% else %}
                        "instanceParams": [
                             {% if so_service  %}
                             {
                                 {% for key, value in so_service.parameters.items() %}
                                 "{{ key }}": "{{ value }}"{% if not loop.last %},
                                 {% endif %}
                                 {% endfor %}
                             }
                             {% endif %}
                        ],
                        {% endif %}
                        "instanceName": "{{ service_instance_name }}",
                        {% if not sdc_service.components %}
                        "resources": {},
                        "modelInfo": {
                            "modelVersion": "1.0",
                            "modelVersionId": "{{ sdc_service.identifier }}",
                            "modelInvariantId": "{{ sdc_service.unique_uuid }}",
                            "modelName": "{{ sdc_service.name }}",
                            "modelType": "service"
                        }
                    }
                        {% else %}
                        "resources": {
                            {% block pnfs %}
                            {% if sdc_service.pnfs %}
                            "pnfs":[
                                {% for pnf in sdc_service.pnfs  %}
                                {
                                    "modelInfo":{
                                        "modelCustomizationName":"{{ pnf.name }}",
                                        "modelCustomizationId":"{{ pnf.model_customization_id }}",
                                        "modelInvariantId":"{{ sdc_service.unique_uuid }}",
                                        "modelVersionId":"{{ sdc_service.identifier }}",
                                        "modelName":"{{ sdc_service.name }}",
                                        "modelType":"pnf",
                                        "modelVersion":"1.0"
                                    },
                                    "platform":{
                                        "platformName":"{{ platform }}"
                                    },
                                    "lineOfBusiness":{
                                        "lineOfBusinessName":"{{ line_of_business }}"
                                    },
                                    "productFamilyId":"{{ aai_service.service_id }}",
                                    "instanceParams":[],
                                    "instanceName":"{{ service_instance_name }}"
                                }{% if not loop.last %},{% endif %}
                                {% endfor %}
                            ]
                                {% if sdc_service.vnfs %},{% endif %}
                            {% endif %}
                            {% endblock %}
                            {% block vnfs %}
                            {% if sdc_service.vnfs %}
                            "vnfs": [
                                {% for vnf in sdc_service.vnfs %}
                                {
                                    "modelInfo": {
                                        "modelName": "{{ vnf.model_name }}",
                                        "modelVersionId": "{{ vnf.model_version_id }}",
                                        "modelInvariantUuid": "{{ vnf.model_invariant_id }}",
                                        "modelVersion": "{{ vnf.model_version }}",
                                        "modelCustomizationId": "{{ vnf.model_customization_id }}",
                                        "modelInstanceName": "{{ vnf.model_name }}"
                                    },
                                    "cloudConfiguration": {
                                        "tenantId": "{{ tenant.tenant_id }}",
                                        "cloudOwner": "{{ cloud_region.cloud_owner }}",
                                        "lcpCloudRegionId": "{{ cloud_region.cloud_region_id }}"
                                    },
                                    "platform": {
                                        "platformName": "{{ platform }}"
                                    },
                                    "lineOfBusiness": {
                                        "lineOfBusinessName": "{{ line_of_business }}"
                                    },
                                    "productFamilyId": "1234",
                                    "instanceName": "{{ vnf.model_name }}",
                                    "instanceParams": [
                                        {
                                            {% for vnf_parameter in vnf_parameters %}
                                            {% if vnf_parameter.name == vnf.model_name %}
                                            {% for parameter in vnf_parameter.vnf_parameters %}
                                            "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %}
                                            {% endfor %}
                                            {% endif %}
                                            {% endfor %}
                                        }
                                    ],
                                    "vfModules": [
                                        {% for vf_module in vnf.vf_modules %}
                                        {
                                            "modelInfo": {
                                                "modelName": "{{ vf_module.model_name }}",
                                                "modelVersionId": "{{ vf_module.model_version_id }}",
                                                "modelInvariantUuid": "{{ vf_module.model_invariant_uuid }}",
                                                "modelVersion": "{{ vf_module.model_version }}",
                                                "modelCustomizationId": "{{ vf_module.model_customization_id }}"
                                            },
                                            "instanceName": "{{ service_instance_name }}_{{ vf_module.name }}",
                                            "instanceParams": [
                                                {
                                                    {% for vnf_parameter in vnf_parameters %}
                                                    {% 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] %}
                                                    {% for parameter in vf_module_parameter.vfmodule_parameters %}
                                                    "{{ parameter.name }}": "{{ parameter.value }}"{% if not loop.last %},{% endif %}
                                                    {% endfor %}
                                                    {% endif %}
                                                    {% endfor %}
                                                    {% endif %}
                                                    {% endfor %}
                                                }
                                            ]
                                        }{% if not loop.last %},{% endif %}
                                        {% endfor %}
                                    ]
                                }{% if not loop.last %},{% endif %}
                                {% endfor %}
                            ]
                            {% endif %}
                            {% endblock %}
                        },
                        "modelInfo": {
                            "modelVersion": "1.0",
                            "modelVersionId": "{{ sdc_service.identifier }}",
                            "modelInvariantId": "{{ sdc_service.unique_uuid }}",
                            "modelName": "{{ sdc_service.name }}",
                            "modelType": "service"
                        }
                    }
                    {% endif %}
                }

            ],
            "aLaCarte": false
        },
        "project": {
            "projectName": "{{ project }}"
        },
        "owningEntity": {
            "owningEntityId": "{{ owning_entity.owning_entity_id }}",
            "owningEntityName": "{{ owning_entity.name }}"
        }
    }
}