3438c7957c63e55413d179ec0a56ca42b98dccb7
[so.git] / bpmn / MSOCommonBPMN / src / test / groovy / org / onap / so / bpmn / common / scripts / SDNCAdapterTest.groovy
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.bpmn.common.scripts
22
23
24 import static org.mockito.Mockito.*
25
26 import org.camunda.bpm.engine.ProcessEngineServices
27 import org.camunda.bpm.engine.RepositoryService
28 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
29 import org.camunda.bpm.engine.repository.ProcessDefinition
30 import org.junit.Before
31 import org.junit.Test
32 import org.junit.runner.RunWith
33 import org.mockito.MockitoAnnotations
34 import org.mockito.junit.MockitoJUnitRunner;
35 import org.mockito.internal.debugging.MockitoDebuggerImpl
36 import org.onap.so.bpmn.common.scripts.SDNCAdapter;
37
38 import org.onap.so.bpmn.mock.FileUtil
39
40 @RunWith(MockitoJUnitRunner.Silent.class)
41 public class SDNCAdapterTest {
42
43         @Before
44         public void init()
45         {
46                 MockitoAnnotations.initMocks(this)
47                 System.setProperty("jboss.qualified.host.name","myhost.com")
48         }
49
50
51         String workflowResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
52                                                  xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"
53                                                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
54                                                  xmlns="com:att:sdnctl:l3api">
55    <sdncadapterworkflow:response-data>
56       <tag0:CallbackHeader>
57          <tag0:RequestId>testRequestId</tag0:RequestId>
58          <tag0:ResponseCode>200</tag0:ResponseCode>
59          <tag0:ResponseMessage>OK</tag0:ResponseMessage>
60       </tag0:CallbackHeader>
61       <tag0:RequestData xsi:type="xs:string">
62          <layer3-service-list>
63             <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
64             <service-status>
65                <rpc-name>service-configuration-operation</rpc-name>
66                <rpc-action>activate</rpc-action>
67                <request-status>synccomplete</request-status>
68                <final-indicator>N</final-indicator>
69                <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
70                <l3sdn-subaction>SUPP</l3sdn-subaction>
71                <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
72             </service-status>
73             <service-data>
74                <internet-evc-access-information>
75                   <ip-version>ds</ip-version>
76                   <internet-evc-speed-value>8</internet-evc-speed-value>
77                   <internet-evc-speed-units>Mbps</internet-evc-speed-units>
78                </internet-evc-access-information>
79                <vr-lan>
80                   <vr-lan-interface>
81                      <static-routes>
82                         <v6-static-routes>
83                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
84                            <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
85                            <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
86                         </v6-static-routes>
87                         <v4-static-routes>
88                            <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
89                            <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
90                            <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
91                         </v4-static-routes>
92                         <v6-static-routes>
93                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
94                            <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
95                            <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
96                         </v6-static-routes>
97                         <v4-static-routes>
98                            <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
99                            <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
100                            <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
101                         </v4-static-routes>
102                         <v4-static-routes>
103                            <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
104                            <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
105                            <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
106                         </v4-static-routes>
107                      </static-routes>
108                      <dhcp>
109                         <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
110                         <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
111                         <use-v6-default-pool>N</use-v6-default-pool>
112                         <excluded-v4-dhcp-addresses-from-default-pool>
113                            <excluded-v4-address>192.168.1.7</excluded-v4-address>
114                         </excluded-v4-dhcp-addresses-from-default-pool>
115                         <excluded-v4-dhcp-addresses-from-default-pool>
116                            <excluded-v4-address>192.168.1.8</excluded-v4-address>
117                         </excluded-v4-dhcp-addresses-from-default-pool>
118                         <v4-dhcp-pools>
119                            <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
120                            <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
121                            <excluded-v4-addresses>
122                               <excluded-v4-address>192.168.1.5</excluded-v4-address>
123                            </excluded-v4-addresses>
124                            <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
125                            <excluded-v4-addresses>
126                               <excluded-v4-address>192.168.1.6</excluded-v4-address>
127                            </excluded-v4-addresses>
128                            <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
129                         </v4-dhcp-pools>
130                         <v4-dhcp-pools>
131                            <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
132                            <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
133                            <excluded-v4-addresses>
134                               <excluded-v4-address>192.168.1.6</excluded-v4-address>
135                            </excluded-v4-addresses>
136                            <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
137                            <excluded-v4-addresses>
138                               <excluded-v4-address>192.168.1.7</excluded-v4-address>
139                            </excluded-v4-addresses>
140                            <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
141                         </v4-dhcp-pools>
142                         <use-v4-default-pool>Y</use-v4-default-pool>
143                         <excluded-v6-dhcp-addresses-from-default-pool>
144                            <excluded-v6-address>1:5</excluded-v6-address>
145                         </excluded-v6-dhcp-addresses-from-default-pool>
146                         <excluded-v6-dhcp-addresses-from-default-pool>
147                            <excluded-v6-address>1:6</excluded-v6-address>
148                         </excluded-v6-dhcp-addresses-from-default-pool>
149                         <v6-dhcp-pools>
150                            <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
151                            <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
152                            <excluded-v6-addresses>
153                               <excluded-v6-address>1:1</excluded-v6-address>
154                            </excluded-v6-addresses>
155                            <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
156                            <excluded-v6-addresses>
157                               <excluded-v6-address>2:2</excluded-v6-address>
158                            </excluded-v6-addresses>
159                            <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
160                         </v6-dhcp-pools>
161                         <v6-dhcp-pools>
162                            <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
163                            <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
164                            <excluded-v6-addresses>
165                               <excluded-v6-address>1:1</excluded-v6-address>
166                            </excluded-v6-addresses>
167                            <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
168                            <excluded-v6-addresses>
169                               <excluded-v6-address>2:2</excluded-v6-address>
170                            </excluded-v6-addresses>
171                            <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
172                         </v6-dhcp-pools>
173                      </dhcp>
174                      <firewall-lite>
175                         <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
176                         <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
177                         <v4-firewall-packet-filters>
178                            <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
179                            <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
180                            <allow-icmp-ping>Y</allow-icmp-ping>
181                            <udp-ports>
182                               <port-number>1</port-number>
183                            </udp-ports>
184                            <tcp-ports>
185                               <port-number>1</port-number>
186                            </tcp-ports>
187                         </v4-firewall-packet-filters>
188                         <v4-firewall-packet-filters>
189                            <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
190                            <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
191                            <allow-icmp-ping>Y</allow-icmp-ping>
192                            <udp-ports>
193                               <port-number>2</port-number>
194                            </udp-ports>
195                            <tcp-ports>
196                               <port-number>2</port-number>
197                            </tcp-ports>
198                         </v4-firewall-packet-filters>
199                         <v6-firewall-packet-filters>
200                            <v6-firewall-prefix>:</v6-firewall-prefix>
201                            <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
202                            <allow-icmp-ping>Y</allow-icmp-ping>
203                            <udp-ports>
204                               <port-number>3</port-number>
205                            </udp-ports>
206                            <tcp-ports>
207                               <port-number>3</port-number>
208                            </tcp-ports>
209                         </v6-firewall-packet-filters>
210                         <v6-firewall-packet-filters>
211                            <v6-firewall-prefix>:</v6-firewall-prefix>
212                            <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
213                            <allow-icmp-ping>Y</allow-icmp-ping>
214                            <udp-ports>
215                               <port-number>4</port-number>
216                            </udp-ports>
217                            <tcp-ports>
218                               <port-number>4</port-number>
219                            </tcp-ports>
220                         </v6-firewall-packet-filters>
221                      </firewall-lite>
222                      <pat>
223                         <v4-pat-pools>
224                            <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
225                            <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
226                            <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
227                         </v4-pat-pools>
228                         <use-v4-default-pool>Y</use-v4-default-pool>
229                         <v4-pat-enabled>N</v4-pat-enabled>
230                         <v4-pat-pools>
231                            <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
232                            <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
233                            <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
234                         </v4-pat-pools>
235                      </pat>
236                      <nat>
237                         <v4-nat-enabled>Y</v4-nat-enabled>
238                         <v4-nat-mapping-entries>
239                            <v4-nat-internal>0.0.0.0</v4-nat-internal>
240                            <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
241                            <v4-nat-external>0.0.0.0</v4-nat-external>
242                         </v4-nat-mapping-entries>
243                         <v4-nat-mapping-entries>
244                            <v4-nat-internal>0.0.0.1</v4-nat-internal>
245                            <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
246                            <v4-nat-external>0.0.0.1</v4-nat-external>
247                         </v4-nat-mapping-entries>
248                      </nat>
249                      <vr-designation>primary</vr-designation>
250                      <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
251                      <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
252                      <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
253                      <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
254                      <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
255                      <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
256                      <v4-public-lan-prefixes>
257                         <t-provided-v4-lan-public-prefixes>
258                            <request-index>1</request-index>
259                            <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
260                            <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
261                            <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
262                         </t-provided-v4-lan-public-prefixes>
263                         <t-provided-v4-lan-public-prefixes>
264                            <request-index>1</request-index>
265                            <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
266                            <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
267                            <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
268                         </t-provided-v4-lan-public-prefixes>
269                         <t-provided-v4-lan-public-prefixes>
270                            <request-index>1</request-index>
271                            <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
272                            <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
273                            <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
274                         </t-provided-v4-lan-public-prefixes>
275                      </v4-public-lan-prefixes>
276                      <v6-public-lan-prefixes>
277                         <t-provided-v6-lan-public-prefixes>
278                            <request-index>1</request-index>
279                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
280                            <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
281                            <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
282                         </t-provided-v6-lan-public-prefixes>
283                         <t-provided-v6-lan-public-prefixes>
284                            <request-index>1</request-index>
285                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
286                            <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
287                            <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
288                         </t-provided-v6-lan-public-prefixes>
289                         <t-provided-v6-lan-public-prefixes>
290                            <request-index>1</request-index>
291                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
292                            <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
293                            <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
294                         </t-provided-v6-lan-public-prefixes>
295                      </v6-public-lan-prefixes>
296                   </vr-lan-interface>
297                   <routing-protocol>none</routing-protocol>
298                </vr-lan>
299                <ucpe-vms-service-information>
300                   <transport-service-information>
301                      <transport-service-type>AVPN</transport-service-type>
302                      <access-circuit-info>
303                         <access-circuit-id>1</access-circuit-id>
304                         <dual-mode>Active</dual-mode>
305                      </access-circuit-info>
306                      <access-circuit-info>
307                         <access-circuit-id>2</access-circuit-id>
308                         <dual-mode>Standby</dual-mode>
309                      </access-circuit-info>
310                   </transport-service-information>
311                   <ucpe-information>
312                      <ucpe-host-name>hostname</ucpe-host-name>
313                      <ucpe-activation-code>activecode</ucpe-activation-code>
314                      <out-of-band-management-modem>OOB</out-of-band-management-modem>
315                   </ucpe-information>
316                   <vnf-list>
317                      <vnf-information>
318                         <vnf-instance-id>1</vnf-instance-id>
319                         <vnf-sequence-number>1</vnf-sequence-number>
320                         <vnf-type>ZZ</vnf-type>
321                         <vnf-vendor>JUNIPER</vnf-vendor>
322                         <vnf-model>MODEL1</vnf-model>
323                         <vnf-id>1</vnf-id>
324                         <prov-status>1</prov-status>
325                         <operational-state>1</operational-state>
326                         <orchestration-status>1</orchestration-status>
327                         <equipment-role>1</equipment-role>
328                      </vnf-information>
329                      <vnf-information>
330                         <vnf-instance-id>2</vnf-instance-id>
331                         <vnf-sequence-number>2</vnf-sequence-number>
332                         <vnf-type>HY</vnf-type>
333                         <vnf-vendor>JUNIPER</vnf-vendor>
334                         <vnf-model>MODEL2</vnf-model>
335                         <vnf-id>2</vnf-id>
336                         <prov-status>2</prov-status>
337                         <operational-state>2</operational-state>
338                         <orchestration-status>2</orchestration-status>
339                         <equipment-role>2</equipment-role>
340                      </vnf-information>
341                   </vnf-list>
342                </ucpe-vms-service-information>
343                <request-information>
344                   <request-action>Layer3ServiceActivateRequest</request-action>
345                   <order-number>4281555</order-number>
346                   <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
347                   <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
348                   <source>OMX</source>
349                   <order-version>1</order-version>
350                </request-information>
351                <sdnc-request-header>
352                   <svc-action>activate</svc-action>
353                   <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url>
354                   <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
355                </sdnc-request-header>
356                <l2-homing-information>
357                   <topology>MultiPoint</topology>
358                   <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
359                   <evc-name>AS/VLXM/003717//SW</evc-name>
360                </l2-homing-information>
361                <service-information>
362                   <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
363                   <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
364                   <service-type>SDN-ETHERNET-INTERNET</service-type>
365                </service-information>
366                <internet-service-change-details>
367                   <internet-evc-speed-value>10</internet-evc-speed-value>
368                   <internet-evc-speed-units>Kbps</internet-evc-speed-units>
369                   <t-provided-v4-lan-public-prefixes>
370                      <request-index>1</request-index>
371                      <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
372                      <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
373                      <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
374                   </t-provided-v4-lan-public-prefixes>
375                   <t-provided-v4-lan-public-prefixes>
376                      <request-index>2</request-index>
377                      <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
378                      <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
379                      <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
380                   </t-provided-v4-lan-public-prefixes>
381                   <t-provided-v6-lan-public-prefixes>
382                      <request-index>1</request-index>
383                      <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
384                      <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
385                      <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
386                   </t-provided-v6-lan-public-prefixes>
387                   <t-provided-v6-lan-public-prefixes>
388                      <request-index>1</request-index>
389                      <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
390                      <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
391                      <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
392                   </t-provided-v6-lan-public-prefixes>
393                </internet-service-change-details>
394             </service-data>
395          </layer3-service-list>
396       </tag0:RequestData>
397    </sdncadapterworkflow:response-data>
398 </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
399
400         String sdncAdapterRequest = """
401                         <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
402                         <SOAP-ENV:Body>
403                         <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.onap/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.onap/workflow/sdnc/adapter/schema/v1">
404                         <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
405                         <sdncadapter:RequestId>745b1b50-e39e-4685-9cc8-c71f0bde8bf0</sdncadapter:RequestId>
406                         <sdncadapter:SvcAction>query</sdncadapter:SvcAction>
407                         <sdncadapter:SvcOperation>services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET</sdncadapter:SvcOperation>
408                         <sdncadapter:CallbackUrl>http://myhost.com:28080/mso/sdncAdapterCallbackServiceImpl</sdncadapter:CallbackUrl>
409                         </sdncadapter:RequestHeader>
410                         <sdncadaptersc:RequestData>
411                                 <rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
412               contentType="text/xml">
413    <service-request xmlns="http://org.onap/so/request/details/schema/v1">
414       <request-information>
415          <request-id>12570a36-7388-4c0a-bec4-189ce3kg9956</request-id>
416          <request-action>GetLayer3ServiceDetailsRequest</request-action>
417          <source>OMX</source>
418       </request-information>
419       <service-information>
420          <service-type>SDN-ETHERNET-INTERNET</service-type>
421          <service-instance-id>PD/VLXM/003717//SW_INTERNET</service-instance-id>
422       </service-information>
423    </service-request>
424 </rest:payload>
425                         </sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
426
427 String sdncAdapterResponse = """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
428 <sdncadapterworkflow:response-data>
429 <tag0:CallbackHeader xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1">
430    <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId>
431    <tag0:ResponseCode>404</tag0:ResponseCode>
432    <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
433                         https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
434                         SDNC Returned-[error-type:application, error-tag:data-missing,
435                         error-message:Request could not be completed because the relevant
436                         data model content does not exist.]</tag0:ResponseMessage>
437 </tag0:CallbackHeader>
438 </sdncadapterworkflow:response-data>
439 </sdncadapterworkflow:SDNCAdapterWorkflowResponse>
440 """
441
442 String workflowErrorResponse = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
443                                                                 <aetgt:ErrorMessage>Received error from SDN-C: Error processing request to SDNC. Not Found.
444                         https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
445                         SDNC Returned-[error-type:application, error-tag:data-missing,
446                         error-message:Request could not be completed because the relevant
447                         data model content does not exist.]</aetgt:ErrorMessage>
448                                                                 <aetgt:ErrorCode>5300</aetgt:ErrorCode>
449                                                                 <aetgt:SourceSystemErrorCode>404</aetgt:SourceSystemErrorCode>
450                                                                 </aetgt:WorkflowException>"""
451
452 String workflowErrorResponse1 = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
453                                         <aetgt:ErrorMessage>Invalid Callback Response from SDNC Adapter</aetgt:ErrorMessage>
454                                         <aetgt:ErrorCode>5300</aetgt:ErrorCode>
455                                   </aetgt:WorkflowException>"""
456
457 String     enhancedCallbackRequestData =
458     """<tag0:RequestData xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1"
459                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
460                   xsi:type="xs:string">                         <layer3-service-list xmlns="com:att:sdnctl:l3api">
461                                         <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
462                                         <service-status>
463                                                 <rpc-name>service-configuration-operation</rpc-name>
464                                                 <rpc-action>activate</rpc-action>
465                                                 <request-status>synccomplete</request-status>
466                                                 <final-indicator>N</final-indicator>
467                                                 <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action>
468                                                 <l3sdn-subaction>SUPP</l3sdn-subaction>
469                                                 <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp>
470                                         </service-status>
471                                         <service-data>
472                                                 <internet-evc-access-information>
473                                                         <ip-version>ds</ip-version>
474                                                         <internet-evc-speed-value>8</internet-evc-speed-value>
475                                                         <internet-evc-speed-units>Mbps</internet-evc-speed-units>
476                                                 </internet-evc-access-information>
477                                                 <vr-lan xmlns="com:att:sdnctl:l3api">
478                                                         <vr-lan-interface>
479                                                                 <static-routes>
480                                                                         <v6-static-routes>
481                                                                                 <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
482                                                                                 <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
483                                                                                 <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
484                                                                         </v6-static-routes>
485                                                                         <v4-static-routes>
486                                                                                 <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix>
487                                                                                 <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
488                                                                                 <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
489                                                                         </v4-static-routes>
490                                                                         <v6-static-routes>
491                                                                                 <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
492                                                                                 <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix>
493                                                                                 <v6-static-route-prefix-length>28</v6-static-route-prefix-length>
494                                                                         </v6-static-routes>
495                                                                         <v4-static-routes>
496                                                                                 <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix>
497                                                                                 <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
498                                                                                 <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
499                                                                         </v4-static-routes>
500                                                                         <v4-static-routes>
501                                                                                 <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix>
502                                                                                 <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
503                                                                                 <v4-static-route-prefix-length>28</v4-static-route-prefix-length>
504                                                                         </v4-static-routes>
505                                                                 </static-routes>
506                                                                 <dhcp>
507                                                                         <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled>
508                                                                         <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled>
509                                                                         <use-v6-default-pool>N</use-v6-default-pool>
510                                                                         <excluded-v4-dhcp-addresses-from-default-pool>
511                                                                           <excluded-v4-address>192.168.1.7</excluded-v4-address>
512                                                                         </excluded-v4-dhcp-addresses-from-default-pool>
513                                                                         <excluded-v4-dhcp-addresses-from-default-pool>
514                                                                           <excluded-v4-address>192.168.1.8</excluded-v4-address>
515                                                                         </excluded-v4-dhcp-addresses-from-default-pool>
516                                                                         <v4-dhcp-pools>
517                                                                                 <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address>
518                                                                                 <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
519                                                                                 <excluded-v4-addresses>
520                                                                                         <excluded-v4-address>192.168.1.5</excluded-v4-address>
521                                                                                 </excluded-v4-addresses>
522                                                                                 <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address>
523                                                                                 <excluded-v4-addresses>
524                                                                                         <excluded-v4-address>192.168.1.6</excluded-v4-address>
525                                                                                 </excluded-v4-addresses>
526                                                                                 <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix>
527                                                                         </v4-dhcp-pools>
528                                                                         <v4-dhcp-pools>
529                                                                                 <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address>
530                                                                                 <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length>
531                                                                                 <excluded-v4-addresses>
532                                                                                         <excluded-v4-address>192.168.1.6</excluded-v4-address>
533                                                                                 </excluded-v4-addresses>
534                                                                                 <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address>
535                                                                                 <excluded-v4-addresses>
536                                                                                         <excluded-v4-address>192.168.1.7</excluded-v4-address>
537                                                                                 </excluded-v4-addresses>
538                                                                                 <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix>
539                                                                         </v4-dhcp-pools>
540                                                                         <use-v4-default-pool>Y</use-v4-default-pool>
541                                                                         <excluded-v6-dhcp-addresses-from-default-pool>
542                                                                           <excluded-v6-address>1:5</excluded-v6-address>
543                                                                         </excluded-v6-dhcp-addresses-from-default-pool>
544                                                                         <excluded-v6-dhcp-addresses-from-default-pool>
545                                                                           <excluded-v6-address>1:6</excluded-v6-address>
546                                                                         </excluded-v6-dhcp-addresses-from-default-pool>
547                                                                         <v6-dhcp-pools>
548                                                                                 <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
549                                                                                 <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
550                                                                                 <excluded-v6-addresses>
551                                                                                         <excluded-v6-address>1:1</excluded-v6-address>
552                                                                                 </excluded-v6-addresses>
553                                                                                 <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
554                                                                                 <excluded-v6-addresses>
555                                                                                         <excluded-v6-address>2:2</excluded-v6-address>
556                                                                                 </excluded-v6-addresses>
557                                                                                 <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
558                                                                         </v6-dhcp-pools>
559                                                                         <v6-dhcp-pools>
560                                                                                 <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address>
561                                                                                 <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length>
562                                                                                 <excluded-v6-addresses>
563                                                                                         <excluded-v6-address>1:1</excluded-v6-address>
564                                                                                 </excluded-v6-addresses>
565                                                                                 <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address>
566                                                                                 <excluded-v6-addresses>
567                                                                                         <excluded-v6-address>2:2</excluded-v6-address>
568                                                                                 </excluded-v6-addresses>
569                                                                                 <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix>
570                                                                         </v6-dhcp-pools>
571                                                                 </dhcp>
572                                                                 <firewall-lite>
573                                                                         <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled>
574                                                                         <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled>
575                                                                         <v4-firewall-packet-filters>
576                                                                           <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix>
577                                                                           <v4-firewall-prefix-length>1</v4-firewall-prefix-length>
578                                                                           <allow-icmp-ping>Y</allow-icmp-ping>
579                                                                           <udp-ports>
580                                                                             <port-number>1</port-number>
581                                                                           </udp-ports>
582                                                                           <tcp-ports>
583                                                                             <port-number>1</port-number>
584                                                                           </tcp-ports>
585                                                                         </v4-firewall-packet-filters>
586                                                                         <v4-firewall-packet-filters>
587                                                                           <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix>
588                                                                           <v4-firewall-prefix-length>2</v4-firewall-prefix-length>
589                                                                           <allow-icmp-ping>Y</allow-icmp-ping>
590                                                                           <udp-ports>
591                                                                             <port-number>2</port-number>
592                                                                           </udp-ports>
593                                                                           <tcp-ports>
594                                                                             <port-number>2</port-number>
595                                                                           </tcp-ports>
596                                                                         </v4-firewall-packet-filters>
597                                                                         <v6-firewall-packet-filters>
598                                                                           <v6-firewall-prefix>:</v6-firewall-prefix>
599                                                                           <v6-firewall-prefix-length>0</v6-firewall-prefix-length>
600                                                                           <allow-icmp-ping>Y</allow-icmp-ping>
601                                                                           <udp-ports>
602                                                                             <port-number>3</port-number>
603                                                                           </udp-ports>
604                                                                           <tcp-ports>
605                                                                             <port-number>3</port-number>
606                                                                           </tcp-ports>
607                                                                         </v6-firewall-packet-filters>
608                                                                         <v6-firewall-packet-filters>
609                                                                           <v6-firewall-prefix>:</v6-firewall-prefix>
610                                                                           <v6-firewall-prefix-length>1</v6-firewall-prefix-length>
611                                                                           <allow-icmp-ping>Y</allow-icmp-ping>
612                                                                           <udp-ports>
613                                                                             <port-number>4</port-number>
614                                                                           </udp-ports>
615                                                                           <tcp-ports>
616                                                                             <port-number>4</port-number>
617                                                                           </tcp-ports>
618                                                                         </v6-firewall-packet-filters>
619                                                                 </firewall-lite>
620                                                                 <pat>
621                                                                         <v4-pat-pools>
622                                                                                 <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix>
623                                                                                 <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address>
624                                                                                 <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length>
625                                                                         </v4-pat-pools>
626                                                                         <use-v4-default-pool>Y</use-v4-default-pool>
627                                                                         <v4-pat-enabled>N</v4-pat-enabled>
628                                                                         <v4-pat-pools>
629                                                                                 <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix>
630                                                                                 <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address>
631                                                                                 <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length>
632                                                                         </v4-pat-pools>
633                                                                 </pat>
634                                                                 <nat>
635                                                                   <v4-nat-enabled>Y</v4-nat-enabled>
636                                                                   <v4-nat-mapping-entries>
637                                                                     <v4-nat-internal>0.0.0.0</v4-nat-internal>
638                                                                     <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address>
639                                                                     <v4-nat-external>0.0.0.0</v4-nat-external>
640                                                                   </v4-nat-mapping-entries>
641                                                                   <v4-nat-mapping-entries>
642                                                                     <v4-nat-internal>0.0.0.1</v4-nat-internal>
643                                                                     <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address>
644                                                                     <v4-nat-external>0.0.0.1</v4-nat-external>
645                                                                   </v4-nat-mapping-entries>
646                                                                 </nat>
647                                                                 <vr-designation>primary</vr-designation>
648                                                                 <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address>
649                                                                 <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length>
650                                                                 <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address>
651                                                                 <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix>
652                                                                 <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length>
653                                                                 <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix>
654                                                                 <v4-public-lan-prefixes>
655                                                                         <t-provided-v4-lan-public-prefixes>
656                                                                                 <request-index>1</request-index>
657                                                                                 <v4-next-hop-address>192.168.1.2</v4-next-hop-address>
658                                                                                 <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix>
659                                                                                 <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
660                                                                         </t-provided-v4-lan-public-prefixes>
661                                                                         <t-provided-v4-lan-public-prefixes>
662                                                                                 <request-index>1</request-index>
663                                                                                 <v4-next-hop-address>192.168.1.72</v4-next-hop-address>
664                                                                                 <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix>
665                                                                                 <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
666                                                                         </t-provided-v4-lan-public-prefixes>
667                                                                         <t-provided-v4-lan-public-prefixes>
668                                                                                 <request-index>1</request-index>
669                                                                                 <v4-next-hop-address>192.168.1.68</v4-next-hop-address>
670                                                                                 <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix>
671                                                                                 <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
672                                                                         </t-provided-v4-lan-public-prefixes>
673                                                                 </v4-public-lan-prefixes>
674                                                                 <v6-public-lan-prefixes>
675                                                                         <t-provided-v6-lan-public-prefixes>
676                                                                                 <request-index>1</request-index>
677                                                                                 <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
678                                                                                 <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
679                                                                                 <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
680                                                                         </t-provided-v6-lan-public-prefixes>
681                                                                         <t-provided-v6-lan-public-prefixes>
682                                                                                 <request-index>1</request-index>
683                                                                                 <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
684                                                                                 <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix>
685                                                                                 <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
686                                                                         </t-provided-v6-lan-public-prefixes>
687                                                                         <t-provided-v6-lan-public-prefixes>
688                                                                                 <request-index>1</request-index>
689                                                                                 <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
690                                                                                 <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix>
691                                                                                 <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
692                                                                         </t-provided-v6-lan-public-prefixes>
693                                                                 </v6-public-lan-prefixes>
694                                                         </vr-lan-interface>
695                                                         <routing-protocol>none</routing-protocol>
696                                                 </vr-lan>
697 <ucpe-vms-service-information>
698  <transport-service-information>
699     <transport-service-type>AVPN</transport-service-type>
700         <access-circuit-info>
701            <access-circuit-id>1</access-circuit-id>
702            <dual-mode>Active</dual-mode>
703         </access-circuit-info>
704         <access-circuit-info>
705            <access-circuit-id>2</access-circuit-id>
706            <dual-mode>Standby</dual-mode>
707         </access-circuit-info>
708  </transport-service-information>
709  <ucpe-information>
710     <ucpe-host-name>hostname</ucpe-host-name>
711     <ucpe-activation-code>activecode</ucpe-activation-code>
712     <out-of-band-management-modem>OOB</out-of-band-management-modem>
713   </ucpe-information>
714   <vnf-list>
715         <vnf-information>
716                 <vnf-instance-id>1</vnf-instance-id>
717                 <vnf-sequence-number>1</vnf-sequence-number>
718                 <vnf-type>ZZ</vnf-type>
719                 <vnf-vendor>JUNIPER</vnf-vendor>
720                 <vnf-model>MODEL1</vnf-model>
721                 <vnf-id>1</vnf-id>
722                 <prov-status>1</prov-status>
723                 <operational-state>1</operational-state>
724                 <orchestration-status>1</orchestration-status>
725                 <equipment-role>1</equipment-role>
726     </vnf-information>
727         <vnf-information>
728                 <vnf-instance-id>2</vnf-instance-id>
729                 <vnf-sequence-number>2</vnf-sequence-number>
730                 <vnf-type>HY</vnf-type>
731                 <vnf-vendor>JUNIPER</vnf-vendor>
732                 <vnf-model>MODEL2</vnf-model>
733                 <vnf-id>2</vnf-id>
734                 <prov-status>2</prov-status>
735                 <operational-state>2</operational-state>
736                 <orchestration-status>2</orchestration-status>
737                 <equipment-role>2</equipment-role>
738     </vnf-information>
739   </vnf-list>
740  </ucpe-vms-service-information>
741                                                 <request-information>
742                                                         <request-action>Layer3ServiceActivateRequest</request-action>
743                                                         <order-number>4281555</order-number>
744                                                         <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id>
745                                                         <notification-url>https://csi-tst-q22.it.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url>
746                                                         <source>OMX</source>
747                                                         <order-version>1</order-version>
748                                                 </request-information>
749                                                 <sdnc-request-header>
750                                                         <svc-action>activate</svc-action>
751                                                         <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url>
752                                                         <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id>
753                                                 </sdnc-request-header>
754                                                 <l2-homing-information>
755                                                         <topology>MultiPoint</topology>
756                                                         <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli>
757                                                         <evc-name>AS/VLXM/003717//SW</evc-name>
758                                                 </l2-homing-information>
759                                                 <service-information>
760                                                         <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id>
761                                                         <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name>
762                                                         <service-type>SDN-ETHERNET-INTERNET</service-type>
763                                                 </service-information>
764                                                 <internet-service-change-details>
765                                                         <internet-evc-speed-value>10</internet-evc-speed-value>
766                                                         <internet-evc-speed-units>Kbps</internet-evc-speed-units>
767                                                         <t-provided-v4-lan-public-prefixes>
768                                                            <request-index>1</request-index>
769                                                            <v4-next-hop-address>192.168.1.15</v4-next-hop-address>
770                                                            <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix>
771                                                            <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
772                                                         </t-provided-v4-lan-public-prefixes>
773                                                         <t-provided-v4-lan-public-prefixes>
774                                                            <request-index>2</request-index>
775                                                            <v4-next-hop-address>192.168.1.16</v4-next-hop-address>
776                                                            <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix>
777                                                            <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length>
778                                                         </t-provided-v4-lan-public-prefixes>
779                                                         <t-provided-v6-lan-public-prefixes>
780                                                            <request-index>1</request-index>
781                                                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
782                                                            <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
783                                                            <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
784                                                         </t-provided-v6-lan-public-prefixes>
785                                                         <t-provided-v6-lan-public-prefixes>
786                                                            <request-index>1</request-index>
787                                                            <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address>
788                                                            <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix>
789                                                            <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length>
790                                                         </t-provided-v6-lan-public-prefixes>
791                                                 </internet-service-change-details>
792                                         </service-data>
793                                 </layer3-service-list>
794 </tag0:RequestData>
795 """
796
797 def sdncAdapterResponseEmpty =
798 """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
799    <sdncadapterworkflow:response-data/>
800 </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
801
802 def sdncAdapterResponseError =
803 """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
804                                                  xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1">
805    <sdncadapterworkflow:response-data>
806       <tag0:CallbackHeader>
807          <tag0:RequestId>39542e39-ccc3-4d1a-8b79-04ce88526613</tag0:RequestId>
808          <tag0:ResponseCode>404</tag0:ResponseCode>
809          <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
810                         https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout.
811                         SDNC Returned-[error-type:application, error-tag:data-missing,
812                         error-message:Request could not be completed because the relevant
813                         data model content does not exist.]</tag0:ResponseMessage>
814       </tag0:CallbackHeader>
815    </sdncadapterworkflow:response-data>
816 </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
817
818
819         @Test
820         public void testPreProcessRequest() {
821
822                 String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml");
823                 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
824                 when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C")
825                 when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
826                 when(mockExecution.getVariable("mso-request-id")).thenReturn("testReqId")
827                 when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest)
828                 when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl")
829                 when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true")
830
831                 when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
832                 when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
833
834
835                 SDNCAdapter sdncAdapter = new SDNCAdapter()
836                 sdncAdapter.preProcessRequest(mockExecution)
837
838                 MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
839                 debugger.printInvocations(mockExecution)
840
841
842                 verify(mockExecution).setVariable("prefix","SDNCA_")
843                 verify(mockExecution).setVariable("sdncAdapterResponse","")
844                 verify(mockExecution).setVariable("asynchronousResponseTimeout",false)
845                 verify(mockExecution).setVariable("continueListening",false)
846                 verify(mockExecution).setVariable("serviceConfigActivate",false)
847                 verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false)
848                 verify(mockExecution).setVariable("SDNCA_InterimNotify",false)
849                 verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic dGVzdDp0ZXN0")
850                 verify(mockExecution).setVariable("source","")
851                 verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0")
852                 verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest)
853         }
854
855         @Test
856         public void testProcessResponse()
857         {
858                 String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml");
859                 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
860                 when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse)
861                 SDNCAdapter sdncAdapter = new SDNCAdapter()
862                 sdncAdapter.postProcessResponse(mockExecution)
863
864 //              MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
865 //              debugger.printInvocations(mockExecution)
866
867                 verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
868         //      verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData)
869                 verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse)
870                 verify(mockExecution).setVariable("continueListening",false)
871
872         }
873
874         @Test
875         public void testProcessResponse_ErrorCase_404()
876         {
877                 String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml");
878                 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
879                 when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse)
880                 SDNCAdapter sdncAdapter = new SDNCAdapter()
881                 sdncAdapter.postProcessResponse(mockExecution)
882
883                 verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
884                 verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError)
885                 verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
886                 verify(mockExecution).setVariable("continueListening",false)
887
888         }
889
890         @Test
891         public void testProcessResponse_ErrorCase_InvalidCallback()
892         {
893                 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
894                 when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("<h1>Service Unavailable</h1>")
895                 SDNCAdapter sdncAdapter = new SDNCAdapter()
896                 sdncAdapter.postProcessResponse(mockExecution)
897
898                 verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
899                 verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty)
900                 verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
901                 verify(mockExecution).setVariable("continueListening",false)
902
903         }
904
905         @Test
906         public void postProcessResponse()
907         {
908
909                 String SDNCAdapterCallbackRequest =
910                 """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
911 <SDNCAdapterCallbackRequest
912         xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1">
913         <CallbackHeader>
914                 <RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</RequestId>
915                 <ResponseCode>404</ResponseCode>
916                 <ResponseMessage>Error processing request to SDNC. Not Found.
917                         https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693.
918                         SDNC Returned-[error-type:application, error-tag:data-missing,
919                         error-message:Request could not be completed because the relevant
920                         data model content does not exist ]</ResponseMessage>
921         </CallbackHeader>
922 </SDNCAdapterCallbackRequest>"""
923
924                 String sdncAdapterResponse =
925                 """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
926                                                  xmlns:tag0="http://org.onap/workflow/sdnc/adapter/schema/v1">
927    <sdncadapterworkflow:response-data>
928       <tag0:CallbackHeader>
929          <tag0:RequestId>3bb02798-b344-4d28-9bca-1f029954d1c9</tag0:RequestId>
930          <tag0:ResponseCode>404</tag0:ResponseCode>
931          <tag0:ResponseMessage>Error processing request to SDNC. Not Found.
932                         https://localhost:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693.
933                         SDNC Returned-[error-type:application, error-tag:data-missing,
934                         error-message:Request could not be completed because the relevant
935                         data model content does not exist ]</tag0:ResponseMessage>
936       </tag0:CallbackHeader>
937    </sdncadapterworkflow:response-data>
938 </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
939
940                 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
941                 when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest)
942                 SDNCAdapter sdncAdapter = new SDNCAdapter()
943                 sdncAdapter.postProcessResponse(mockExecution)
944
945                 verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest")
946                 verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse)
947                 verify(mockExecution).setVariable("enhancedCallbackRequestData", "")
948                 verify(mockExecution).setVariable("continueListening",false)
949
950         }
951
952 }