aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-pnf-unassign.xml
blob: 2fc4a3aeb0ede39da5a076b7b4d8e5a36014fcdd (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
<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-pnf-unassign' mode='sync'>
        <block atomic='true'>
            <set>
                <parameter name='ss.capability.execution-order[0]' value='mS-mac-address-assign' />
                <parameter name='ss.capability.execution-order[1]' value='mac-address-assign' />
                <parameter name='ss.capability.execution-order[2]' value='netbox-ip-assign' />
                <parameter name='ss.capability.execution-order[3]' value='eipam-ip-assignment' />
                <parameter name='ss.capability.execution-order[4]' value='mS-vlan-tag-assign' />
                <parameter name='ss.capability.execution-order[5]' value='vlan-tag-assign' />
                <parameter name='ss.capability.execution-order[6]' value='alts-license-assign' />
                <parameter name='ss.capability.execution-order[7]' value='alts-entitlement-assign' />
                <parameter name='ss.capability.execution-order[8]' value='generate-name' />
                <parameter name='ss.capability.execution-order_length' value='9' />
            </set>
            <set>
                <parameter name='ss.capability-type' value='pnf' />
            </set>
            <switch test='`$prop.controller.user`'>
                <outcome value=''>
                    <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
                        <parameter name='fileName' value='%SDNC_CONFIG_DIR%/generic-resource-api-dg.properties' />
                        <parameter name='contextPrefix' value='prop' />
                    </execute>
                </outcome>
            </switch>
            <for index='cidx' start='0' end='`$ss.capability.execution-order_length`' >
                <set>
                    <parameter name='ss.capability-name' value='`$ss.capability.execution-order[$cidx]`' />
                    <!--
ss.capability.execution-order[]
-->
                </set>
                <set>
                    <parameter name='ss.capability-action' value='unassign' />
                </set>
                <set>
                    <parameter name='ss.capability-dg' value="`'self-serve-' + $ss.capability.execution-order[$cidx]`" />
                </set>
                <for index='pidx' start='0' end='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param_length`' >
                    <set>
                        <parameter name='tmp.param.capability-name' value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param[$pidx].resource-resolution-data.capability-name`' />
                    </set>
                    <switch test='`$ss.capability-name == $tmp.param.capability-name`'>
                        <outcome value='true'>
                            <block atomic='true'>
                                <switch test='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param[$pidx].resource-resolution-data.status`'>
                                    <outcome value='SUCCESS'>
                                        <call module='GENERIC-RESOURCE-API' rpc='`$ss.capability-dg`' mode='sync' >
                                            <outcome value='failure'>
                                                <block atomic='true'>
                                                    <set>
                                                        <parameter name='vf.pnf-id'
    value='`$service-data.pnfs.pnf[$pnf-index].pnf-id`' />
                                                        <parameter name='vf.pnf-data.sdnc-request-header.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.sdnc-request-header.`' />
                                                        <parameter name='vf.pnf-data.request-information.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.request-information.`' />
                                                        <parameter name='vf.pnf-data.service-information.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.service-information.`' />
                                                        <parameter name='vf.pnf-data.pnf-information.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-details.`' />
                                                        <parameter name='vf.pnf-data.pnf-request-input.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-request-input.`' />
                                                        <parameter name='vf.pnf-data.pnf-request-input.pnf-input-parameters.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-request-input.pnf-input-parameters.`' />
                                                        <parameter name='vf.pnf-data.pnf-topology.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.`' />
                                                        <parameter name='vf.pnf-data.pnf-level-oper-status.'
  value='`$service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-level-oper-status.`' />
                                                    </set>
                                                    <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                        <parameter name="source" value="`$prop.restapi.ss-pnf-assignments`"/>
                                                        <parameter name="outputPath" value="tmp.ss-pnf-url"/>
                                                        <parameter name="target" value="{service-instance-id}"/>
                                                        <parameter name="replacement" value="`$service-data.pnfs.pnf[$pnf-index].pnf-data.service-information.service-instance-id`"/>
                                                    </execute>
                                                    <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                        <parameter name="source" value="`$tmp.ss-pnf-url`"/>
                                                        <parameter name="outputPath" value="tmp.ss-pnf-url"/>
                                                        <parameter name="target" value="{pnf-id}"/>
                                                        <parameter name="replacement" value="`$service-data.pnfs.pnf[$pnf-index].pnf-id`"/>
                                                    </execute>
                                                    <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                                                        <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.ss.pnf.templatefile`" />
                                                        <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ss-pnf-url`' />
                                                        <parameter name='restapiUser' value='`$prop.controller.user`' />
                                                        <parameter name='restapiPassword' value='`$prop.controller.pwd`' />
                                                        <parameter name='format' value='json' />
                                                        <parameter name='httpMethod' value='PUT' />
                                                        <parameter name="responsePrefix" value="mdsal-ss-pnf" />
                                                        <outcome value='failure'>
                                                            <block atomic="true">
                                                                <set>
                                                                    <parameter name="error-message" value="Error persisting self-serve pnf assignments in MD-SAL during unassign" />
                                                                </set>
                                                            </block>
                                                        </outcome>
                                                        <outcome value='not-found'>
                                                            <block atomic="true">
                                                                <set>
                                                                    <parameter name="error-message" value="Error persisting self-serve pnf assignments in MD-SAL during unassign" />
                                                                </set>
                                                            </block>
                                                        </outcome>
                                                    </execute>
                                                    <return status='failure'>
                                                        <parameter name='error-code' value='500' />
                                                        <parameter name='error-message' value="`'Failed to unassign self-serve pnf assignments for ' + $ss.capability-dg + ' with error: ' + $error-message`" />
                                                    </return>
                                                </block>
                                            </outcome>
                                            <outcome value='success'>
                                                <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                                    <parameter name="logger" value="message-log"/>
                                                    <parameter name="field1" value="`'DONE: ' + $ss.capability-dg`"/>
                                                </record>
                                            </outcome>
                                        </call>
                                    </outcome>
                                    <outcome value='Other'>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                            <parameter name="logger" value="message-log"/>
                                            <parameter name="field1" value="`'SS: resource-resolution-data.status: ' + $service-data.pnfs.pnf[$pnf-index].pnf-data.pnf-topology.pnf-parameters-data.param[$pidx].resource-resolution-data.status`"/>
                                            <parameter name="field2" value="`'SS: ss.capability-name: ' + $ss.capability-name`"/>
                                            <parameter name="field3" value="`'SS: tmp.param.capability-name: ' + $tmp.param.capability-name`"/>
                                        </record>
                                    </outcome>
                                </switch>
                                <break/>
                            </block>
                        </outcome>
                    </switch>
                </for>
            </for>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='printContext' >
                <parameter name='filename' value='/var/tmp/ss-pnf-unassign.log' />
            </execute>
        </block>
    </method>
</service-logic>