summaryrefslogtreecommitdiffstats
path: root/ms/gra/gra-app/src/test/resources/svclogic/GENERIC-RESOURCE-API_self-serve-vnf-generate-name-changeassign.xml
blob: c8a419a4773224611eecf474da84a6e37ca43ab7 (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
<service-logic
    xmlns='http://www.onap.org/sdnc/svclogic'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='GENERIC-RESOURCE-API' version='${project.version}'>
    <method rpc='self-serve-vnf-generate-name-changeassign' mode='sync'>
        <block atomic='true'>
            <set>
                <parameter name='tmp.external-key.value' value='' />
            </set>
            <for index='i' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.resource-key_length`' >
                <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.resource-key[$i].name`'>
                    <outcome value='external-key'>
                        <set>
                            <parameter name='tmp.external-key.value' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.resource-key[$i].value`' />
                        </set>
                    </outcome>
                </switch>
            </for>
            <switch test='`$tmp.external-key.value`'>
                <outcome value=''>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="self-service-vnf-generate-name-changeassign error : external-key is null for vnf" />
                    </return>
                </outcome>
            </switch>
            <set>
                <parameter name="tmp.vnf.changeassign.naming-data-payload" 
	value="`'{&quot;elements&quot;:[{' + '&quot;resource-name&quot;:&quot;' + $vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$ss.input.param.index].name + '&quot;,&quot;resource-value&quot;:&quot;' + $vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$ss.input.param.index].value + '&quot;,&quot;external-key&quot;:&quot;' + $tmp.external-key.value + '&quot;}]}'`"/>
            </set>
            <execute plugin='org.openecomp.sdnc.prov.namegeneration.node.AssignNameNode' method='process'>
                <parameter name='payload' value='`$tmp.vnf.changeassign.naming-data-payload`' />
                <parameter name="prifix" value="vnf.changeassign.nameGenResponse" />
                <outcome value='failure'>
                    <block atomic='true'>
                        <set>
                            <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.status`' value='FAILED' />
                        </set>
                        <return status='failure'>
                            <parameter name='ack-final' value='Y'/>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`'Error from NameGenerationNode ChangeAssign vnf ' + $error-message`" />
                        </return>
                    </block>
                </outcome>
                <outcome value='not-found'>
                    <block atomic='true'>
                        <set>
                            <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.status`' value='FAILED' />
                        </set>
                        <return status='failure'>
                            <parameter name='ack-final' value='Y'/>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`'Error from NameGenerationNode ChangeAssign vnf ' + $error-message`" />
                        </return>
                    </block>
                </outcome>
            </execute>
            <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
	resource="generic-vnf"
		key="generic-vnf.vnf-id =  $service-data.vnfs.vnf[$vnf-index].vnf-id " >
                <parameter name="vnf-name" value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$ss.input.param.index].value`' />
                <outcome value='failure'>
                    <block atomic='true'>
                        <set>
                            <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.status`' value='FAILED' />
                        </set>
                        <return status='failure'>
                            <parameter name='ack-final' value='Y'/>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`'Failed to update generic-vnf.vnf-name to ' + $vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$ss.input.param.index].value + ' in AnAI'`" />
                        </return>
                    </block>
                </outcome>
                <outcome value='not-found'>
                    <block atomic='true'>
                        <set>
                            <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.status`' value='FAILED' />
                        </set>
                        <return status='failure'>
                            <parameter name='ack-final' value='Y'/>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`'Failed to update generic-vnf.vnf-name to ' + $vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$ss.input.param.index].value + ' in AnAI'`" />
                        </return>
                    </block>
                </outcome>
            </update>
            <set>
                <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].value`' value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$ss.input.param.index].value`'/>
                <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$ss.service-data.param.index].resource-resolution-data.status`' value='SUCCESS' />
            </set>
        </block>
    </method>
</service-logic>