cf43a5735915b66ce5f6c1deb7918ed202c43fe5
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt
4  * =================================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * =================================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  * ============LICENSE_END==========================================================================
17  */
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.types;
19
20 import java.util.ArrayList;
21 import java.util.List;
22
23 /**
24  * Inventory information of a device, used by DCAE
25  */
26 public class InventoryInformationDcae {
27
28     private static final String UNKNOWN = "unknown";
29     private static final List<String> EMPTY = new ArrayList<>();
30     private static final InventoryInformationDcae DEFAULT = new InventoryInformationDcae();
31
32     private String type;
33     private String model;
34     private String vendor;
35     private String deviceIpv4;
36     private String deviceIpv6;
37     private List<String> interfaceUuidList;
38
39     public InventoryInformationDcae() {
40         this.type = UNKNOWN;
41         this.model = UNKNOWN;
42         this.vendor = UNKNOWN;
43         this.deviceIpv4 = UNKNOWN;
44         this.deviceIpv6 = UNKNOWN;
45         this.interfaceUuidList = EMPTY;
46     }
47
48     public InventoryInformationDcae(InventoryInformationDcae inventoryInformation) {
49         this.type = inventoryInformation.type;
50         this.model = inventoryInformation.model;
51         this.vendor = inventoryInformation.vendor;
52         this.deviceIpv4 = inventoryInformation.deviceIpv4;
53         this.deviceIpv6 = inventoryInformation.deviceIpv6;
54         this.interfaceUuidList = new ArrayList<>(inventoryInformation.interfaceUuidList);
55     }
56
57     public InventoryInformationDcae(String type, String model, String vendor, String deviceIpv4, String deviceIpv6,
58             List<String> interfaceUuidList) {
59         setType(type);
60         setModel(model);
61         setVendor(vendor);
62         setDeviceIpv4(deviceIpv4);
63         setDeviceIpv6(deviceIpv6);
64         setInterfaceUuidList(interfaceUuidList);
65     }
66
67     public String getType() {
68         return type;
69     }
70
71     public String getModel() {
72         return model;
73     }
74
75     public String getVendor() {
76         return vendor;
77     }
78
79     public String getDeviceIpv4() {
80         return deviceIpv4;
81     }
82
83     public String getDeviceIpv6() {
84         return deviceIpv6;
85     }
86
87     public List<String> getInterfaceUuidList() {
88         return interfaceUuidList;
89     }
90
91     public InventoryInformationDcae setType(String type) {
92         this.type = type != null ? type : UNKNOWN;
93         return this;
94     }
95
96     public InventoryInformationDcae setModel(String model) {
97         this.model = model != null ? model : UNKNOWN;
98         return this;
99     }
100
101     public InventoryInformationDcae setVendor(String vendor) {
102         this.vendor = vendor != null ? vendor : UNKNOWN;
103         return this;
104     }
105
106     public InventoryInformationDcae setDeviceIpv4(String deviceIpv4) {
107         this.deviceIpv4 = deviceIpv4 != null ? deviceIpv4 : UNKNOWN;
108         return this;
109     }
110
111     public InventoryInformationDcae setDeviceIpv6(String deviceIpv6) {
112         this.deviceIpv6 = deviceIpv6 != null ? deviceIpv6 : UNKNOWN;
113         return this;
114     }
115
116     public InventoryInformationDcae setInterfaceUuidList(List<String> interfaceUuidList) {
117         this.interfaceUuidList = interfaceUuidList != null ? interfaceUuidList : EMPTY;
118         return this;
119     }
120
121     public static InventoryInformationDcae getDefault() {
122         return DEFAULT;
123     }
124
125     @Override
126     public String toString() {
127         return "InventoryInformation [type=" + type + ", model=" + model + ", vendor=" + vendor + ", deviceIpv4="
128                 + deviceIpv4 + ", deviceIpv6=" + deviceIpv6 + ", interfaceUuidList=" + interfaceUuidList + "]";
129     }
130
131 }