Add generic-resource-api DG seed code
[sdnc/oam.git] / platform-logic / generic-resource-api / src / main / xml / GENERIC-RESOURCE-API_contrail-route-topology-operation-unassign.xml
1 <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='contrail-route-topology-operation-unassign' mode='sync'>\r
2 <block atomic="true"><set>\r
3 <parameter name='tmp.ar.allotted-resource-id' value='`$contrail-route-topology-operation-input.allotted-resource-information.allotted-resource-id`' />\r
4 <parameter name='tmp.ar.parent-service-instance-id' value='`$contrail-route-topology-operation-input.allotted-resource-information.parent-service-instance-id`' />\r
5 <parameter name='tmp.ar.sz-vnf-id' value='`$contrail-route-topology-operation-input.allotted-resource-data.security-zone-topology.security-zone-assignments.security-zone-vnf-id`' />\r
6 \r
7 \r
8 </set><set>\r
9 <parameter name='tmp.ar.self-link' value="`'restconf/config/GENERIC-RESOURCE-API:contrail-route-allotted-resources/contrail-route-allotted-resource/'\r
10  + $tmp.ar.allotted-resource-id\r
11  + '/allotted-resource-data/contrail-route-topology/'` " />\r
12 \r
13 </set><execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >\r
14     <parameter name='fileName' value='%SDNC_CONFIG_DIR%/generic-resource-api-dg.properties' />\r
15     <parameter name='contextPrefix' value='prop' />\r
16 </execute><execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >\r
17     <parameter name="source" value="`$prop.restapi.cr-allottedresource`"/>\r
18     <parameter name="outputPath" value="tmp.ar-url"/>\r
19     <parameter name="target" value="{allotted-resource-id}"/>\r
20     <parameter name="replacement" value="`$tmp.ar.allotted-resource-id`"/>\r
21 </execute><execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >\r
22     <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ar-url`' />\r
23     <parameter name='restapiUser' value='`$prop.controller.user`' />\r
24     <parameter name='restapiPassword' value='`$prop.controller.pwd`' />\r
25     <parameter name='format' value='json' />\r
26     <parameter name='httpMethod' value='GET' />\r
27     <parameter name="responsePrefix" value="mdsal-ar" />\r
28 \r
29 <outcome value='success'>\r
30 <block atomic="true">\r
31 <switch test='`$mdsal-ar.contrail-route-allotted-resource_length`'>\r
32 <outcome value='1'>\r
33 <block atomic='true'>\r
34 <set>\r
35 <parameter name='bk-cr-ar' value='$mdsal-ar.' />\r
36 </set><set>\r
37 <parameter name='ar.' value='$mdsal-ar.contrail-route-allotted-resource[0].' />\r
38 </set><switch test='`$ar.allotted-resource-data.allotted-resource-oper-status.order-status`'>\r
39 <outcome value='Created'>\r
40 <return status='failure'>\r
41         <parameter name='ack-final' value='Y'/>\r
42         <parameter name="error-code" value="500" />\r
43     <parameter name="error-message" \r
44     value="`'Existing contrail-route-allotted-resource with order status of ' + $ar.allotted-resource-data.allotted-resource-oper-status.order-status + '.'`" />\r
45 </return></outcome><outcome value='Other'>\r
46 <block>\r
47 </block></outcome></switch><set>\r
48 <parameter name='sz-ar.allotted-resource-data.allotted-resource-oper-status.last-action' value='`$sz-ar.allotted-resource-data.allotted-resource-operation-information.request-information.request-action`' />\r
49 <parameter name='sz-ar.allotted-resource-data.allotted-resource-oper-status.last-rpc-action' value='`$sz-ar.allotted-resource-status.rpc-action`' />\r
50 <parameter name='sz-ar.allotted-resource-data.allotted-resource-oper-status.last-svc-request-id' value='`$sz-ar.allotted-resource-data.allotted-resource-operation-information.sdnc-request-header.svc-request-id`' />\r
51 \r
52 </set></block></outcome><outcome value='Other'>\r
53 <return status='failure'>\r
54         <parameter name='ack-final' value='Y'/>\r
55         <parameter name="error-code" value="404" />\r
56     <parameter name="error-message" value="Error: Contrail Route not found" />\r
57     \r
58 </return></outcome></switch></block></outcome><outcome value='Other'>\r
59 <block atomic="true">\r
60 <return status='failure'>\r
61         <parameter name='ack-final' value='Y'/>\r
62         <parameter name="error-code" value="404" />\r
63     <parameter name="error-message" value="Error: Contrail Route not found" />\r
64     \r
65 </return></block></outcome></execute><set>\r
66 <parameter name='ar.allotted-resource-id' value="`$tmp.ar.allotted-resource-id` " />\r
67 <parameter name='ar.allotted-resource-status.action' value="`$contrail-route-topology-operation-input.request-information.request-action` " />\r
68 <parameter name='ar.allotted-resource-status.rpc-name' value="contrail-route-topology-operation" />\r
69 <parameter name='ar.allotted-resource-status.rpc-action' value="`$contrail-route-topology-operation-input.sdnc-request-header.svc-action` " />\r
70 <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.request-information.' value="`$contrail-route-topology-operation-input.request-information.` " />\r
71 <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.sdnc-request-header.' value="`$contrail-route-topology-operation-input.sdnc-request-header.` " />\r
72 <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.service-information.' value="`$contrail-route-topology-operation-input.service-information.` " />\r
73 <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.allotted-resource-information.' value="`$contrail-route-topology-operation-input.allotted-resource-information.` " />\r
74 <parameter name='ar.allotted-resource-data.allotted-resource-operation-information.contrail-route-request-input.' value="`$contrail-route-topology-operation-input.contrail-route-request-input.` " />\r
75 </set><set>\r
76 <parameter name='contrail-api-output.contrail-id' value="dummycid" />\r
77 </set><set>\r
78 <parameter name='ar-assignments.contrail-id' value="`$contrail-api-output.contrail-id`" />\r
79 \r
80 \r
81 \r
82 </set><execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='setTime' >\r
83     <parameter name="outputPath" value="tmp.current-time" />\r
84 \r
85 </execute><set>\r
86 <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.order-status' value='Active' />\r
87 <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.last-action' value='`$contrail-route-topology-operation-input.request-information.request-action`' />\r
88 <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.last-rpc-action' value='`$contrail-route-topology-operation-input.sdnc-request-header.svc-action`' />\r
89 <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.last-svc-request-id' value='`$contrail-route-topology-operation-input.sdnc-request-header.svc-request-id`' />\r
90 <parameter name='ar.allotted-resource-data.allotted-resource-oper-status.create-timestamp' value='`$tmp.current-time`' />\r
91 </set><execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >\r
92     <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ar-url`' />\r
93     <parameter name='restapiUser' value='`$prop.controller.user`' />\r
94     <parameter name='restapiPassword' value='`$prop.controller.pwd`' />\r
95     <parameter name='format' value='json' />\r
96     <parameter name='httpMethod' value='DELETE' />\r
97     <parameter name="responsePrefix" value="mdsal-ar" />\r
98 \r
99 <outcome value='success'>\r
100 <block>\r
101 </block></outcome><outcome value='failure'>\r
102 <return status='failure'>\r
103         <parameter name='ack-final' value='Y'/>\r
104         <parameter name="error-code" value="500" />\r
105     <parameter name="error-message" value="Error updating md-sal for contrail-route-allotted-resource" />\r
106 </return></outcome><outcome value='not-found'>\r
107 <return status='failure'>\r
108         <parameter name='ack-final' value='Y'/>\r
109         <parameter name="error-code" value="500" />\r
110     <parameter name="error-message" value="Error updating md-sal for contrail-route-allotted-resource" />\r
111 </return></outcome></execute><set>\r
112 <parameter name='allotted-resource-id' value='`$tmp.ar.allotted-resource-id`' />\r
113 <parameter name='service-object-path' value="`'restconf/config/GENERIC-RESOURCE-API:services/service/'\r
114  + $contrail-route-topology-operation-input.service-information.service-instance-id\r
115  + '/service-data/service-topology/'`"/>\r
116  \r
117 </set><return status='success'>\r
118 <parameter name="ack-final-indicator" value="Y" />\r
119 <parameter name="error-code" value="200" />\r
120 <parameter name="error-message" value="`$error-message`" />\r
121 </return></block></method></service-logic>