1ca36aface75a7beae8e9ab1ea4a215b2657aad9
[so.git] / adapters / mso-adapters-rest-interface / src / main / java / org / openecomp / mso / adapters / nwrest / QueryNetworkResponse.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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
22 package org.openecomp.mso.adapters.nwrest;
23
24
25
26 import org.openecomp.mso.openstack.beans.NetworkStatus;
27
28 import java.util.List;
29 import java.util.Map;
30
31 import javax.xml.bind.annotation.XmlRootElement;
32
33 import org.codehaus.jackson.map.ObjectMapper;
34 import org.jboss.resteasy.annotations.providers.NoJackson;
35 import org.openecomp.mso.logger.MsoLogger;
36
37 @XmlRootElement(name = "queryNetworkResponse")
38 @NoJackson
39 public class QueryNetworkResponse {
40         private String networkId;
41         private String neutronNetworkId;
42         private String networkStackId;
43         private Boolean networkExists;
44         private NetworkStatus networkStatus;
45         private List<Integer> vlans;
46         private List<String> routeTargets;
47         private Map<String, String> subnetIdMap;
48         private Map<String, String> networkOutputs;
49         private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
50         
51         public QueryNetworkResponse() {
52                 super();
53         }
54
55         public QueryNetworkResponse(String networkId, String neutronNetworkId,
56                         String networkStackId, NetworkStatus networkStatus,
57                         Map<String, String> networkOutputs) {
58                 super();
59                 this.networkId = networkId;
60                 this.neutronNetworkId = neutronNetworkId;
61                 this.networkStackId = networkStackId;
62                 this.networkStatus = networkStatus;
63                 this.networkOutputs = networkOutputs;
64         }
65
66         public String getNetworkId() {
67                 return networkId;
68         }
69
70         public void setNetworkId(String networkId) {
71                 this.networkId = networkId;
72         }
73
74         public String getNeutronNetworkId() {
75                 return neutronNetworkId;
76         }
77
78         public void setNeutronNetworkId(String neutronNetworkId) {
79                 this.neutronNetworkId = neutronNetworkId;
80         }
81
82         public String getNetworkStackId() {
83                 return networkStackId;
84         }
85
86         public void setNetworkStackId(String networkStackId) {
87                 this.networkStackId = networkStackId;
88         }
89
90         public NetworkStatus getNetworkStatus() {
91                 return networkStatus;
92         }
93
94         public void setNetworkStatus(NetworkStatus networkStatus) {
95                 this.networkStatus = networkStatus;
96         }
97
98         public Boolean getNetworkExists() {
99                 return networkExists;
100         }
101
102         public void setNetworkExists(Boolean networkExists) {
103                 this.networkExists = networkExists;
104         }
105
106         public List<Integer> getVlans() {
107                 return vlans;
108         }
109
110         public void setVlans(List<Integer> vlans) {
111                 this.vlans = vlans;
112         }
113
114         public List<String> getRouteTargets() {
115                 return routeTargets;
116         }
117
118         public void setRouteTargets(List<String> routeTargets) {
119                 this.routeTargets = routeTargets;
120         }
121
122         public Map<String, String> getSubnetIdMap() {
123                 return subnetIdMap;
124         }
125
126         public void setSubnetIdMap(Map<String, String> subnetIdMap) {
127                 this.subnetIdMap = subnetIdMap;
128         }
129
130         public Map<String, String> getNetworkOutputs() {
131                 return networkOutputs;
132         }
133
134         public void setNetworkOutputs(Map<String, String> networkOutputs) {
135                 this.networkOutputs = networkOutputs;
136         }
137         
138         public String toJsonString() {
139                 String jsonString = null;
140                 try {
141                         ObjectMapper mapper = new ObjectMapper();
142                         jsonString = mapper.writeValueAsString(this);
143                 }
144                 catch (Exception e) {
145                     LOGGER.debug("Exception:", e);
146                 }
147                 return jsonString;
148         }
149 }