e49ff65919be6a0f044ebb3542d74ba8ad12bba3
[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 public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation {
36
37     private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class);
38
39     protected static final String EMPTY = "";
40
41     private final String mountPointNodeName;
42     private final DataBroker netconfNodeDataBroker;
43     private final Capabilities capabilities;
44     private final boolean isNetworkElementCurrentProblemsSupporting10;
45
46     private @Nonnull InventoryInformation inventoryInformation = new InventoryInformation();
47
48
49     protected ONFCoreNetworkElementBase(String mountPointNodeName, DataBroker netconfNodeDataBroker,
50             Capabilities capabilities) {
51         LOG.info("Create ONFCoreNetworkElementBase");
52         this.mountPointNodeName = mountPointNodeName;
53         this.netconfNodeDataBroker = netconfNodeDataBroker;
54         this.capabilities = capabilities;
55
56         this.isNetworkElementCurrentProblemsSupporting10 = false;
57
58     }
59
60     @Override
61     public String getMountPointNodeName() {
62         return mountPointNodeName;
63     }
64
65     /**
66      * @return the netconfNodeDataBroker
67      */
68     public DataBroker getNetconfNodeDataBroker() {
69         return netconfNodeDataBroker;
70     }
71
72     /**
73      * @return the capabilities
74      */
75     public Capabilities getCapabilities() {
76         return capabilities;
77     }
78
79     /**
80      * @return the isNetworkElementCurrentProblemsSupporting10
81      */
82     public boolean isNetworkElementCurrentProblemsSupporting10() {
83         return isNetworkElementCurrentProblemsSupporting10;
84     }
85
86     public void setInventoryInformation(InventoryInformation newInventoryInformation) {
87         this.inventoryInformation = newInventoryInformation;
88     }
89
90     @Override
91     public InventoryInformation getInventoryInformation() {
92         return getInventoryInformation(null);
93     }
94
95     @Override
96     public InventoryInformation getInventoryInformation(String layerProtocolFilter) {
97         InventoryInformation res = new InventoryInformation(inventoryInformation);
98         res.setInterfaceUuidList(getFilteredInterfaceUuidsAsStringList(layerProtocolFilter));
99
100         return res;
101     }
102
103     @Override
104     public void close() throws Exception {}
105
106     /*---------------------------------------------------------------
107      * Getter/ Setter
108      */
109
110     public String getMountpoint() {
111         return mountPointNodeName;
112     }
113
114     public DataBroker getDataBroker() {
115         return netconfNodeDataBroker;
116     }
117
118     /*-----------------------------------------------------------------------------
119      * Sychronization
120      */
121
122     @Override
123     public void initSynchronizationExtension() {}
124
125     protected @Nonnull abstract List<String> getFilteredInterfaceUuidsAsStringList(String layerProtocolFilter);
126
127 }