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
10 * http://www.apache.org/licenses/LICENSE-2.0
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
16 * ============LICENSE_END==========================================================================
21 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ne;
23 import java.util.Optional;
24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ONFCoreNetworkElementRepresentation;
25 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor;
26 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor;
27 import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils;
28 import org.opendaylight.mdsal.binding.api.DataBroker;
29 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
37 public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation {
39 private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class);
41 protected static final String EMPTY = "";
43 private final String mountPointNodeName;
44 private final NodeId nodeId;
45 private final DataBroker netconfNodeDataBroker;
46 private final NetconfBindingAccessor acessor;
48 protected ONFCoreNetworkElementBase(NetconfBindingAccessor acessor) {
49 LOG.info("Create ONFCoreNetworkElementBase");
50 this.mountPointNodeName = acessor.getNodeId().getValue();
51 this.nodeId = acessor.getNodeId();
52 this.netconfNodeDataBroker = acessor.getDataBroker();
53 this.acessor = acessor;
58 public Optional<NetconfAccessor> getAcessor() {
59 return Optional.of(acessor);
63 public String getMountPointNodeName() {
64 return mountPointNodeName;
68 * @return the netconfNodeDataBroker
70 public DataBroker getNetconfNodeDataBroker() {
71 return netconfNodeDataBroker;
75 public void warmstart() {
76 int problems = removeAllCurrentProblemsOfNode();
77 LOG.debug("Removed all {} problems from database at deregistration for {}", problems, mountPointNodeName);
81 public NodeId getNodeId() {
85 public TransactionUtils getGenericTransactionUtils() {
86 return acessor.getTransactionUtils();
89 /*---------------------------------------------------------------
93 public String getMountpoint() {
94 return mountPointNodeName;
98 public DataBroker getDataBroker() {
99 return netconfNodeDataBroker;