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.TransactionUtils;
27 import org.opendaylight.mdsal.binding.api.DataBroker;
28 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
36 public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCoreNetworkElementRepresentation {
38 private static final Logger LOG = LoggerFactory.getLogger(ONFCoreNetworkElementBase.class);
40 protected static final String EMPTY = "";
42 private final String mountPointNodeName;
43 private final NodeId nodeId;
44 private final DataBroker netconfNodeDataBroker;
45 private final NetconfAccessor acessor;
47 protected ONFCoreNetworkElementBase(NetconfAccessor acessor) {
48 LOG.info("Create ONFCoreNetworkElementBase");
49 this.mountPointNodeName = acessor.getNodeId().getValue();
50 this.nodeId = acessor.getNodeId();
51 this.netconfNodeDataBroker = acessor.getDataBroker();
52 this.acessor = acessor;
57 public Optional<NetconfAccessor> getAcessor() {
58 return Optional.of(acessor);
62 public String getMountPointNodeName() {
63 return mountPointNodeName;
67 * @return the netconfNodeDataBroker
69 public DataBroker getNetconfNodeDataBroker() {
70 return netconfNodeDataBroker;
74 public void warmstart() {
75 int problems = removeAllCurrentProblemsOfNode();
76 LOG.debug("Removed all {} problems from database at deregistration for {}", problems, mountPointNodeName);
80 public NodeId getNodeId() {
84 public TransactionUtils getGenericTransactionUtils() {
85 return acessor.getTransactionUtils();
88 /*---------------------------------------------------------------
92 public String getMountpoint() {
93 return mountPointNodeName;
97 public DataBroker getDataBroker() {
98 return netconfNodeDataBroker;