Increase tests coverage in backend
[vid.git] / vid-app-common / src / main / java / org / onap / vid / mso / rest / MsoRestClientNew.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2018 Nokia. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21 package org.onap.vid.mso.rest;
22
23 import com.google.common.collect.ImmutableMap;
24 import io.joshworks.restclient.http.HttpResponse;
25 import java.util.HashMap;
26 import java.util.Map;
27 import javax.ws.rs.core.HttpHeaders;
28 import javax.ws.rs.core.MediaType;
29 import org.apache.commons.codec.binary.Base64;
30 import org.eclipse.jetty.util.security.Password;
31 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
32 import org.onap.portalsdk.core.util.SystemProperties;
33 import org.onap.vid.changeManagement.MsoRequestDetails;
34 import org.onap.vid.changeManagement.RequestDetailsWrapper;
35 import org.onap.vid.client.SyncRestClient;
36 import org.onap.vid.model.RequestReferencesContainer;
37 import org.onap.vid.mso.*;
38
39 import java.text.DateFormat;
40 import java.text.SimpleDateFormat;
41 import java.util.Date;
42 import org.onap.vid.utils.Logging;
43
44
45 /**
46  * Created by pickjonathan on 21/06/2017.
47  */
48 public class MsoRestClientNew implements MsoInterface {
49
50     /**
51      * The Constant dateFormat.
52      */
53     public static final String X_FROM_APP_ID = "X-FromAppId";
54     final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
55     private static final String START = " start";
56     private final SyncRestClient client;
57     private final String baseUrl;
58     private final Map<String, String> commonHeaders;
59     /**
60      * The logger.
61      */
62     EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class);
63
64     public MsoRestClientNew(SyncRestClient client, String baseUrl) {
65         this.client = client;
66         this.baseUrl = baseUrl;
67         this.commonHeaders = initCommonHeaders();
68     }
69
70     @Override
71     public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) {
72         String methodName = "createSvcInstance ";
73         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
74         String path = baseUrl + endpoint;
75
76         return createInstance(requestDetails, path);
77     }
78     
79     @Override
80     public MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint) {
81         String methodName = "createE2eSvcInstance ";
82         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
83         String path = baseUrl + endpoint;
84
85         return createInstance(requestDetails, path);
86     }
87
88     @Override
89     public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) {
90
91         String methodName = "createVnf";
92         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
93         String path = baseUrl + endpoint;
94
95         return createInstance(requestDetails, path);
96     }
97
98     @Override
99     public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) {
100
101         String methodName = "createNwInstance";
102         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
103         String path = baseUrl + endpoint;
104
105         return createInstance(requestDetails, path);
106     }
107
108     @Override
109     public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String endpoint) {
110         String methodName = "createVolumeGroupInstance";
111         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
112         String path = baseUrl + endpoint;
113
114         return createInstance(requestDetails, path);
115     }
116
117     @Override
118     public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) {
119         String methodName = "createVfModuleInstance";
120         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
121         String path = baseUrl + endpoint;
122
123         return createInstance(requestDetails, path);
124     }
125
126     @Override
127     public MsoResponseWrapper createConfigurationInstance(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String endpoint) {
128         String methodName = "createConfigurationInstance";
129         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
130         String path = baseUrl + endpoint;
131
132         return createInstance(requestDetailsWrapper, path);
133     }
134
135     @Override
136     public MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint) {
137         String methodName = "deleteE2eSvcInstance";
138         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
139         String path = baseUrl + endpoint;
140         return deleteInstance(requestDetails, path);
141     }
142
143     @Override
144     public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) {
145         String methodName = "deleteSvcInstance";
146         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
147         String path = baseUrl + endpoint;
148         return deleteInstance(requestDetails, path);
149     }
150
151     @Override
152     public MsoResponseWrapper unassignSvcInstance(RequestDetails requestDetails, String endpoint) {
153         String methodName = "unassignSvcInstance";
154         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
155         HttpResponse<String> response = client.post(endpoint, commonHeaders, requestDetails, String.class);
156         return MsoUtil.wrapResponse(response);
157     }
158
159     @Override
160     public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) {
161         String methodName = "deleteVnf";
162         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
163         String path = baseUrl + endpoint;
164
165         return deleteInstance(requestDetails, path);
166     }
167
168     @Override
169     public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) {
170         String methodName = "deleteVfModule";
171         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
172         String path = baseUrl + endpoint;
173
174         return deleteInstance(requestDetails, path);
175     }
176
177     @Override
178     public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) {
179         String methodName = "deleteVolumeGroupInstance";
180         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
181         String path = baseUrl + endpoint;
182
183         return deleteInstance(requestDetails, path);
184     }
185
186     @Override
187     public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) {
188         String methodName = "deleteNwInstance";
189         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
190         String path = baseUrl + endpoint;
191
192         return deleteInstance(requestDetails, path);
193     }
194
195     @Override
196     public MsoResponseWrapper getOrchestrationRequest(String endpoint) {
197         String path = baseUrl + endpoint;
198
199         HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
200         return MsoUtil.wrapResponse(response);
201     }
202
203     public MsoResponseWrapper getManualTasks(String endpoint) {
204         String path = baseUrl + endpoint;
205
206         HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);
207         return MsoUtil.wrapResponse(response);
208     }
209
210     public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String path, RestObject restObject) {
211         String methodName = "getOrchestrationRequestsForDashboard";
212         logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);
213
214         try {
215             MsoResponseWrapper w = getOrchestrationRequest(path);
216             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
217
218             return w;
219
220         } catch (Exception e) {
221             logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
222             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
223             throw e;
224         }
225     }
226
227     public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) {
228         String methodName = "getManualTasksByRequestId";
229         logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);
230
231         try {
232             String path = baseUrl + endpoint;
233
234             MsoResponseWrapper w =getManualTasks(path);
235             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
236
237             return w;
238
239         } catch (Exception e) {
240             logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
241             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
242             throw e;
243         }
244     }
245
246     @Override
247     public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) {
248         String methodName = "completeManualTask";
249         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Complete ");
250         try {
251             String path = baseUrl + endpoint;
252
253             HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
254             MsoResponseWrapper w = MsoUtil.wrapResponse(response);
255
256             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
257             return w;
258
259         } catch (Exception e) {
260             logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
261             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
262             throw e;
263         }
264     }
265
266     @Override
267     public MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) {
268         String methodName = "replaceVnf";
269         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
270         String path = baseUrl + endpoint;
271         return replaceInstance(requestDetails, path);
272     }
273
274     @Override
275     public MsoResponseWrapper deleteConfiguration(org.onap.vid.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint) {
276         String methodName = "deleteConfiguration";
277         logger.debug(EELFLoggerDelegate.debugLogger,
278                 dateFormat.format(new Date()) + "<== " + methodName + START);
279         String path = baseUrl + pmc_endpoint;
280
281         return deleteInstance(requestDetailsWrapper, path);
282     }
283
284     @Override
285     public MsoResponseWrapper setConfigurationActiveStatus(RequestDetails request, String endpoint) {
286         String methodName = "setConfigurationActiveStatus";
287         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
288
289         try {
290             String path = baseUrl + endpoint;
291
292             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== "
293                   + methodName + " calling change configuration active status, path =[" + path + "]");
294             HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
295             return MsoUtil.wrapResponse(response);
296         } catch (Exception e) {
297             logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
298             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
299             throw e;
300         }
301     }
302
303     @Override
304     public MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails request, String endpoint) {
305         String methodName = "setPortOnConfigurationStatus";
306         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
307
308         try {
309             String path = baseUrl + endpoint;
310             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== "
311                 + methodName + " calling change port configuration status, path =[" + path + "]");
312             HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
313             return MsoUtil.wrapResponse(response);
314         } catch (Exception e) {
315             logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
316             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
317             throw e;
318         }
319     }
320
321     @Override
322     public MsoResponseWrapperInterface changeManagementUpdate(RequestDetailsWrapper requestDetails, String endpoint) {
323         String path = baseUrl + endpoint;
324         HttpResponse<RequestReferencesContainer> response = client.post(path, commonHeaders, requestDetails, RequestReferencesContainer.class);
325         return MsoUtil.wrapResponse(response);
326     }
327
328     public MsoResponseWrapper replaceInstance(org.onap.vid.changeManagement.RequestDetails request, String path) {
329         String methodName = "replaceInstance";
330         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
331
332         try {
333             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Replace VNF, path =[" + path + "]");
334
335             HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
336             MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(response);
337             int status = msoResponseWrapperObject.getStatus();
338             if (status == 202) {
339                 logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +
340                         ",post succeeded, msoResponseWrapperObject response:" + msoResponseWrapperObject.getResponse());
341             } else {
342                 logger.error(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +
343                         ": post failed, msoResponseWrapperObject status" + status + ", response:" + msoResponseWrapperObject.getResponse());
344
345                 // TODO
346             }
347             return msoResponseWrapperObject;
348
349         } catch (Exception e) {
350             logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
351             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
352             throw e;
353         }
354
355     }
356
357     @Override
358     public MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String endpoint) {
359         String methodName = "updateVnf";
360         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
361         String path = baseUrl + endpoint;
362
363         RequestDetailsWrapper wrapper = new RequestDetailsWrapper();
364         wrapper.requestDetails = new MsoRequestDetails(requestDetails);
365         return updateInstance(requestDetails, path);
366     }
367
368     public MsoResponseWrapper updateInstance(org.onap.vid.changeManagement.RequestDetails request, String path) {
369         String methodName = "updateInstance";
370         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
371
372         try {
373             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");
374
375             HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);
376             MsoResponseWrapper w = MsoUtil.wrapResponse(response);
377
378             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
379             return w;
380
381         } catch (Exception e) {
382             logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
383             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
384             throw e;
385         }
386
387     }
388
389     public void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) {
390         String methodName = "activateServiceInstance";
391         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start ");
392         try {
393             String path = baseUrl + endpoint;
394             HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
395             MsoResponseWrapper w = MsoUtil.wrapResponse(response);
396             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w =" + w.getResponse());
397
398         } catch (Exception e) {
399             logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
400             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
401             throw e;
402         }
403     }
404
405     @Override
406     public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint) {
407         String methodName = "removeRelationshipFromServiceInstance";
408         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
409
410         try {
411             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]");
412             String path = baseUrl + endpoint;
413             HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
414             return MsoUtil.wrapResponse(response);
415         } catch (Exception e) {
416             logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
417             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
418             throw e;
419         }
420     }
421
422     @Override
423     public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath) {
424         String methodName = "addRelationshipToServiceInstance";
425         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
426
427         try {
428             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]");
429             String path = baseUrl + addRelationshipsPath;
430
431             HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);
432             return MsoUtil.wrapResponse(response);
433         } catch (Exception e) {
434             logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
435             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
436             throw e;
437         }
438     }
439
440     @Override
441     public <T> HttpResponse<T> get(String path, Class<T> responseClass) {
442         return client.get(path, commonHeaders, new HashMap<>(), responseClass);
443     }
444
445     @Override
446     public <T> HttpResponse<T> post(String path, RequestDetailsWrapper<?> requestDetailsWrapper,
447         Class<T> responseClass) {
448         return client.post(path, commonHeaders, requestDetailsWrapper, responseClass);
449     }
450
451
452     private MsoResponseWrapper createInstance(Object request, String endpoint) {
453         String methodName = "createInstance";
454         logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);
455
456         try {
457             HttpResponse<String> response = client.post(endpoint, commonHeaders, request, String.class);
458             return MsoUtil.wrapResponse(response);
459         } catch (Exception e) {
460             logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
461             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
462             throw e;
463         }
464     }
465
466     /**
467      * Delete instance.
468      *
469      * @param request the request
470      * @param path    the path
471      * @return the mso response wrapper
472      * @throws Exception the exception
473      */
474     private MsoResponseWrapper deleteInstance(Object request, String path) {
475         String methodName = "deleteInstance";
476         logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);
477
478         try {
479             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");
480
481             HttpResponse<String> response = client.delete(path, commonHeaders, String.class);
482             MsoResponseWrapper w = MsoUtil.wrapResponse(response);
483
484             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
485             return w;
486
487         } catch (Exception e) {
488             logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
489             logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
490             throw e;
491         }
492
493     }
494
495     private Map<String, String> initCommonHeaders() {
496         String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);
497         String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);
498         String decrypted_password = Password.deobfuscate(password);
499
500         String authString = username + ":" + decrypted_password;
501
502         byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
503         String authStringEnc = new String(authEncBytes);
504
505         Map<String, String> map = new HashMap<>();
506         map.put(HttpHeaders.AUTHORIZATION,  "Basic " + authStringEnc);
507         map.put(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
508         map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
509         map.put(X_FROM_APP_ID, SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));
510         map.put(SystemProperties.ECOMP_REQUEST_ID, Logging.extractOrGenerateRequestId());
511         return ImmutableMap.copyOf(map);
512     }
513
514 }