summaryrefslogtreecommitdiffstats
path: root/platform-logic/a1Adapter-api/src/main/xml/A1-ADAPTER-API_getA1PolicyStatus.xml
blob: 5750c5282a884f4c40bd8dc8c942a5b7667376dd (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
<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='A1-ADAPTER-API' version='${project.version}'>
    <method rpc='getA1PolicyStatus' mode='sync'>
        <block atomic='true'>
            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                <parameter name="level" value="info" />
                <parameter name="field1" value="Get A1 Policy Status:"/>
                <parameter name="field2" value="`$get-a1-policy-status-input.near-rt-ric-url`"/>
            </record>
            <set>
                <parameter name='response-code' value='200' />
                <parameter name='response-message' value='Get A1 Policy executed successfully' />
            </set>
            <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
                <parameter name='fileName' value='/opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties' />
                <parameter name='contextPrefix' value='prop' />
            </execute>
            <block atomic='true'>
                <set>
                    <parameter name="tmp.near-rt-ric-url" value="`$get-a1-policy-status-input.near-rt-ric-url`"/>
                </set>
                <block>
                    <set>
                        <parameter name="tmp.proxy-url" value="`$prop.a1Mediator.proxy.url`"/>
                    </set>
                    <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                        <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                        <parameter name="level" value="info" />
                        <parameter name="field1" value="Get A1 Policy Status: Check for proxy url: "/>
                        <parameter name="field2" value="`$tmp.proxy-url`"/>
                    </record>
                    <switch test='`$tmp.proxy-url`'>
                        <outcome value=''>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                <parameter name="level" value="info" />
                                <parameter name="field1" value="Get A1 Policy Status: No proxy found on properties file "/>
                            </record>
                        </outcome>
                        <outcome value='Other'>
                            <block>
                                <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split'>
                                    <parameter name="original_string" value="`$tmp.near-rt-ric-url`" />
                                    <parameter name="regex" value="/"/>
                                    <parameter name="ctx_memory_result_key" value="tmp.near-rt-ric-url-splitList"/>
                                </execute>
                                <for index='idx' start='3' end="`$tmp.near-rt-ric-url-splitList_length`" >
                                    <set>
                                        <parameter name='tmp.proxy-url' value="`$tmp.proxy-url +'/' + $tmp.near-rt-ric-url-splitList[$idx] `" />
                                    </set>
                                </for>
                                <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                    <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                    <parameter name="level" value="info" />
                                    <parameter name="field1" value="Get A1 Policy Status: Url with proxy: "/>
                                    <parameter name="field2" value="`$tmp.proxy-url`"/>
                                </record>
                                <set>
                                    <parameter name="tmp.near-rt-ric-url" value="`$tmp.proxy-url`"/>
                                </set>
                            </block>
                        </outcome>
                    </switch>
                </block>
                <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                    <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                    <parameter name="level" value="info" />
                    <parameter name="field1" value="Setting variables for A1 Adapter Get Policy Status."/>
                    <parameter name="field2" value="`$tmp.near-rt-ric-url`"/>
                </record>
                <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                    <parameter name="restapiUrl" value="`$tmp.near-rt-ric-url`"/>
                    <parameter name="format" value="json"/>
                    <parameter name="httpMethod" value="GET"/>
                    <parameter name="responsePrefix" value="a1MediatorRsp"/>
                    <parameter name='contentType' value='application/json' />
                    <parameter name='accept' value='application/json' />
                    <parameter name="convertResponse" value="true"/>
                    <outcome value='success'>
                        <block>
                            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replaceAll' >
                                <parameter name="source" value="`$a1MediatorRsp.httpResponse`"/>
                                <parameter name="outputPath" value="tmp.a1-mediator-restapi.httpResponse"/>
                                <parameter name="target" value="\n"/>
                                <parameter name="replacement" value=""/>
                            </execute>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                <parameter name="file" value="/opt/opendaylight/current/data/log/A1-Adapter.log" />
                                <parameter name="level" value="info" />
                                <parameter name="field1" value="A1 Get Policy Status "/>
                                <parameter name="field2" value="`$tmp.a1-mediator-restapi.httpResponse`"/>
                            </record>
                            <set>
                                <parameter name='responseBody' value='`$tmp.a1-mediator-restapi.httpResponse`'/>
                            </set>
                        </block>
                    </outcome>
                    <outcome value='failure'>
                        <block>
                            <set>
                                <parameter name='response-code' value='500'/>
                                <parameter name='response-message' value='Seems A1 Mediator Not Healthy'/>
                            </set>
                            <return status='failure'>
                                <parameter name='ack-final' value='Y'/>
                                <parameter name="response-code" value="404" />
                                <parameter name="response-message" value="Error in Getting A1 Policy Status. Aborting" />
                            </return>
                        </block>
                    </outcome>
                </execute>
            </block>
            <block>
                <return status='success'>
                    <parameter name="ack-final-indicator" value="Y" />
                    <parameter name="error-code" value="200" />
                    <parameter name="error-message" value="`$error-message`" />
                    <parameter name='response-code' value='200' />
                    <parameter name='response-message' value='Get Policy Status executed successfully'/>
                    <parameter name='ack-final' value='Y'/>
                </return>
            </block>
        </block>
    </method>
</service-logic>