530dabb42d5463b0fec8c98dcfc981b63934008f
[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 /**
19  *
20  */
21 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf;
22
23 import java.util.List;
24 import javax.annotation.Nonnull;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.InventoryInformation;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container.Capabilities;
27 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
28 import org.slf4j.Logger;
29 import org.slf4j.LoggerFactory;
30
31 /**
32  * @author herbert
33  *
34  */
35 @SuppressWarnings("deprecation")
36 public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation {
37
38     private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class);
39
40     protected static final String EMPTY = "";
41
42     private final String mountPointNodeName;
43     private final DataBroker netconfNodeDataBroker;
44     private final Capabilities capabilities;
45     private final boolean isNetworkElementCurrentProblemsSupporting10;
46
47     private @Nonnull InventoryInformation inventoryInformation = new InventoryInformation();
48
49
50     protected ONFCoreNetworkElementBase(String mountPointNodeName, DataBroker netconfNodeDataBroker,
51             Capabilities capabilities) {
52         LOG.info("Create ONFCoreNetworkElementBase");
53         this.mountPointNodeName = mountPointNodeName;
54         this.netconfNodeDataBroker = netconfNodeDataBroker;
55         this.capabilities = capabilities;
56
57         this.isNetworkElementCurrentProblemsSupporting10 = false;
58
59     }
60
61     @Override
62     public String getMountPointNodeName() {
63         return mountPointNodeName;
64     }
65
66     /**
67      * @return the netconfNodeDataBroker
68      */
69     public DataBroker getNetconfNodeDataBroker() {
70         return netconfNodeDataBroker;
71     }
72
73     /**
74      * @return the capabilities
75      */
76     public Capabilities getCapabilities() {
77         return capabilities;
78     }
79
80     /**
81      * @return the isNetworkElementCurrentProblemsSupporting10
82      */
83     public boolean isNetworkElementCurrentProblemsSupporting10() {
84         return isNetworkElementCurrentProblemsSupporting10;
85     }
86
87     public void setInventoryInformation(InventoryInformation newInventoryInformation) {
88         this.inventoryInformation = newInventoryInformation;
89     }
90
91     @Override
92     public InventoryInformation getInventoryInformation() {
93         return getInventoryInformation(null);
94     }
95
96     @Override
97     public InventoryInformation getInventoryInformation(String layerProtocolFilter) {
98         InventoryInformation res = new InventoryInformation(inventoryInformation);
99         res.setInterfaceUuidList(getFilteredInterfaceUuidsAsStringList(layerProtocolFilter));
100
101         return res;
102     }
103
104     @Override
105     public void close() throws Exception {}
106
107     /*---------------------------------------------------------------
108      * Getter/ Setter
109      */
110
111     public String getMountpoint() {
112         return mountPointNodeName;
113     }
114
115     public DataBroker getDataBroker() {
116         return netconfNodeDataBroker;
117     }
118
119     /*-----------------------------------------------------------------------------
120      * Sychronization
121      */
122
123     @Override
124     public void initSynchronizationExtension() {}
125
126     protected @Nonnull abstract List<String> getFilteredInterfaceUuidsAsStringList(String layerProtocolFilter);
127
128 }