2 * ============LICENSE_START=======================================================
3 * ONAP : ccsdk features
4 * ================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
7 * ================================================================================
8 * Update Copyright (C) 2021 Samsung Electronics Intellectual Property. All rights reserved.
9 * =================================================================================================
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 * ============LICENSE_END=========================================================
24 package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.entity;
26 import java.util.ArrayList;
27 import java.util.Arrays;
28 import java.util.Date;
29 import java.util.HashMap;
30 import java.util.List;
32 import java.util.Optional;
33 import javax.annotation.Nonnull;
34 import org.eclipse.jdt.annotation.NonNull;
35 import org.eclipse.jdt.annotation.Nullable;
36 import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient;
37 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder;
38 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder;
39 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders;
40 import org.onap.ccsdk.features.sdnr.wt.common.database.queries.RangeQueryBuilder;
41 import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.EsDataObjectReaderWriter2;
42 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.ArchiveCleanProvider;
43 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataInconsistencyException;
44 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider;
45 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp;
46 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl;
47 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmlogBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CmlogEntity;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionLogStatus;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogBuilder;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ConnectionlogEntity;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentBuilder;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultcurrentEntity;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GuicutthroughBuilder;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GuicutthroughEntity;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryBuilder;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryEntity;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionEntity;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntity;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntityBuilder;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionInputBuilder;
72 import org.opendaylight.yangtools.yang.common.Uint32;
73 import org.slf4j.Logger;
74 import org.slf4j.LoggerFactory;
77 * Event service, writing all events into the database into the appropriate index.
81 public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvider {
82 private static final Logger LOG = LoggerFactory.getLogger(HtDatabaseEventsService.class);
84 private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
86 private static final int ROOT_TREE_LEVEL = 0;
88 private HtDatabaseClient client;
89 private EsDataObjectReaderWriter2<EventlogEntity> eventRWEventLogDevicemanager;
90 private EsDataObjectReaderWriter2<InventoryEntity> eventRWEquipment;
91 private EsDataObjectReaderWriter2<FaultcurrentEntity> eventRWFaultCurrentDB;
92 private EsDataObjectReaderWriter2<FaultlogEntity> eventRWFaultLogDB;
93 private EsDataObjectReaderWriter2<CmlogEntity> eventRWFCMLogDB;
94 private EsDataObjectReaderWriter2<ConnectionlogEntity> eventRWConnectionLogDB;
95 private final EsDataObjectReaderWriter2<NetworkElementConnectionEntity> networkelementConnectionDB;
96 private final EsDataObjectReaderWriter2<GuicutthroughEntity> guiCutThroughDB;
97 private final EsDataObjectReaderWriter2<PmdataEntity> pmData15mDB;
98 private final EsDataObjectReaderWriter2<PmdataEntity> pmData24hDB;
99 // --- Construct and initialize
101 public HtDatabaseEventsService(HtDatabaseClient client) throws Exception {
103 LOG.info("Create {} start", HtDatabaseEventsService.class);
106 // Create control structure
107 this.client = client;
109 eventRWEventLogDevicemanager = new EsDataObjectReaderWriter2<>(client, Entity.Eventlog,
110 EventlogEntity.class, EventlogBuilder.class);
112 eventRWEquipment = new EsDataObjectReaderWriter2<>(client, Entity.Inventoryequipment, InventoryEntity.class,
113 InventoryBuilder.class);
115 eventRWFaultCurrentDB = new EsDataObjectReaderWriter2<>(client, Entity.Faultcurrent,
116 FaultcurrentEntity.class, FaultcurrentBuilder.class);
118 eventRWFaultLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Faultlog, FaultlogEntity.class,
119 FaultlogBuilder.class);
122 new EsDataObjectReaderWriter2<>(client, Entity.Cmlog, CmlogEntity.class, CmlogBuilder.class);
124 eventRWConnectionLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Connectionlog,
125 ConnectionlogEntity.class, ConnectionlogBuilder.class);
127 networkelementConnectionDB = new EsDataObjectReaderWriter2<>(client, Entity.NetworkelementConnection,
128 NetworkElementConnectionEntity.class, NetworkElementConnectionBuilder.class, true)
129 .setEsIdAttributeName("_id");
131 guiCutThroughDB = new EsDataObjectReaderWriter2<>(client, Entity.Guicutthrough, GuicutthroughEntity.class,
132 GuicutthroughBuilder.class);
134 pmData15mDB = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance15min, PmdataEntity.class,
135 PmdataEntityBuilder.class);
137 pmData24hDB = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance24h, PmdataEntity.class,
138 PmdataEntityBuilder.class);
140 } catch (Exception e) {
141 LOG.error("Can not start database client. Exception: {}", e);
142 throw new Exception("Can not start database client. Exception: {}", e);
144 LOG.info("Create {} finished. DB Service {} started.", HtDatabaseEventsService.class,
145 client != null ? "sucessfully" : "not");
152 public void writeConnectionLog(ConnectionlogEntity event) {
153 if (assertIfClientNull(event)) {
156 LOG.debug("Write event: {}", event);
157 eventRWConnectionLogDB.write(event, null);
163 public void writeEventLog(EventlogEntity event) {
164 if (assertIfClientNull("No client to write {}", event)) {
168 LOG.debug("Write event: {}", event.toString());
169 eventRWEventLogDevicemanager.write(event, null);
175 public void writeFaultLog(FaultlogEntity fault) {
176 if (assertIfClientNull(fault)) {
180 LOG.debug("Write fault to faultlog: {}", fault.toString());
181 eventRWFaultLogDB.write(fault, null);
187 public void writeCMLog(CmlogEntity cm) {
188 if (assertIfClientNull(cm)) {
192 LOG.debug("Write CM to cmlog: {}", cm.toString());
193 eventRWFCMLogDB.write(cm, null);
199 public void updateFaultCurrent(FaultcurrentEntity fault) {
200 if (assertIfClientNull(fault)) {
204 if (FaultEntityManager.isManagedAsCurrentProblem(fault)) {
205 if (FaultEntityManager.isNoAlarmIndication(fault)) {
206 LOG.debug("Remove from currentFaults: {}", fault.toString());
207 eventRWFaultCurrentDB.remove(FaultEntityManager.genSpecificEsId(fault));
209 LOG.debug("Write to currentFaults: {}", fault.toString());
210 eventRWFaultCurrentDB.write(fault, FaultEntityManager.genSpecificEsId(fault));
213 LOG.debug("Ingnore for currentFaults: {}", fault.toString());
218 * Remove all entries for one node
220 * @param nodeName contains the mountpointname
221 * @return number of deleted entries
224 public int clearFaultsCurrentOfNode(String nodeName) {
225 if (assertIfClientNullForNodeName(nodeName)) {
229 LOG.debug("Remove from currentFaults all faults for node: {}", nodeName);
230 return eventRWFaultCurrentDB.remove(EsFaultCurrent.getQueryForOneNode(nodeName));
234 * Remove all entries for one node
236 * @param nodeName contains the mountpointname
237 * @param objectId of element to be deleted
238 * @return number of deleted entries
241 public int clearFaultsCurrentOfNodeWithObjectId(String nodeName, String objectId) {
242 if (assertIfClientNullForNodeName(nodeName)) {
246 LOG.debug("Remove from currentFaults all faults for node/objectId: {}/{}", nodeName, objectId);
247 return eventRWFaultCurrentDB.remove(EsFaultCurrent.getQueryForOneNodeAndObjectId(nodeName, objectId));
251 * Deliver list with all mountpoint/node-names in the database.
253 * @return List of all mountpoint/node-names the had active alarms.
256 public @Nonnull List<String> getAllNodesWithCurrentAlarms() {
257 if (assertIfClientNull("No DB, can not delete for all nodes", null)) {
258 return new ArrayList<>();
261 LOG.debug("Remove from currentFaults faults for all node");
262 List<String> nodeNames = new ArrayList<>();
264 for (FaultcurrentEntity fault : eventRWFaultCurrentDB.doReadAll().getHits()) {
265 String nodeName = fault.getNodeId();
266 if (!nodeNames.contains(nodeName)) {
267 // this.clearFaultsCurrentOfNode(nodeName); -> Function shifted
268 nodeNames.add(nodeName);
274 // -- Inventory and equipment current
277 * write internal equipment to database
279 * @param internalEquipment with mandatory fields.
282 private void writeInventory(Inventory internalEquipment) {
284 if (internalEquipment.getManufacturerIdentifier() == null) {
285 internalEquipment = new InventoryBuilder(internalEquipment).setManufacturerIdentifier("").build();
287 if (internalEquipment.getDate() == null) {
288 internalEquipment = new InventoryBuilder(internalEquipment).setDate("").build();
290 eventRWEquipment.write(internalEquipment, internalEquipment.getNodeId() + "/" + internalEquipment.getUuid());
294 * write internal equipment to database
300 public void writeInventory(String nodeId, List<Inventory> list) {
303 checkConsistency(nodeId, list);
304 } catch (DataInconsistencyException e) {
305 LOG.warn("inventory list for node {} is not consistent", nodeId, e);
306 list = e.getRepairedList();
309 for (Inventory internalEquipment : list) {
310 this.writeInventory(internalEquipment);
314 private static void checkConsistency(String nodeId, List<Inventory> list) throws DataInconsistencyException {
315 final String UNBOUND_INVENTORY_UUID = "unbound";
316 List<String> failures = new ArrayList<>();
319 Map<String, Inventory> repairList = new HashMap<>();
320 InventoryBuilder repairedItem;
321 InventoryBuilder unboundItem = new InventoryBuilder().setNodeId(nodeId).setUuid(UNBOUND_INVENTORY_UUID)
322 .setTreeLevel(Uint32.valueOf(0));;
323 for (Inventory item : list) {
324 repairedItem = new InventoryBuilder(item);
325 // check for bad node-id
326 if (!nodeId.equals(item.getNodeId())) {
327 failures.add(String.format("missing node-id for equipment(uuid=%s)", item.getUuid()));
328 repairedItem.setNodeId(nodeId);
331 // check missing tree-level
332 if (item.getTreeLevel() == null) {
333 failures.add(String.format("missing tree-level for equipment(uuid=%s)", item.getUuid()));
334 repairedItem.setTreeLevel(Uint32.valueOf(ROOT_TREE_LEVEL));
338 treeLevel = item.getTreeLevel().longValue();
339 if (treeLevel > ROOT_TREE_LEVEL) {
340 // check non root elem and missing parent
341 if (item.getParentUuid() == null) {
342 failures.add(String.format("Non root level element (uuid=%s) has to have a parent element",
345 repairedItem.setParentUuid(UNBOUND_INVENTORY_UUID);
346 repairList.put(unboundItem.getUuid(), unboundItem.build());
348 // check that parent exists in list and is tree-level -1
350 Optional<Inventory> parent =
351 list.stream().filter(e -> item.getParentUuid().equals(e.getUuid())).findFirst();
352 if (parent.isEmpty()) {
353 failures.add(String.format("no parent found for uuid=%s with parent-uuid=%s",
354 item.getUuid(), item.getParentUuid()));
355 repairedItem.setParentUuid(UNBOUND_INVENTORY_UUID);
360 // check for duplicated uui
361 Optional<Inventory> duplicate = list
362 .stream().filter(e -> !item.equals(e) && item.getUuid() != null
363 && item.getUuid().equals(e.getUuid()) && repairList.containsKey(e.getUuid()))
365 if (duplicate.isPresent()) {
366 failures.add(String.format("found duplicate uuid=%s", item.getUuid()));
371 if (failCounter > 0) {
372 repairList.put(repairedItem.getUuid(), repairedItem.build());
374 repairList.put(item.getUuid(), item);
379 if (failures.size() > 0) {
380 throw new DataInconsistencyException(new ArrayList<>(repairList.values()),
381 "inventory list is not consistent;\n" + String.join("\n", failures));
388 * join base with parameters of toJoin (only non null values)
390 * @param base base object
391 * @param toJoin object with new property values
392 * @return new joined object
394 @SuppressWarnings("unused")
395 private NetworkElementConnectionEntity joinNe(NetworkElementConnectionEntity base,
396 NetworkElementConnectionEntity toJoin) {
400 NetworkElementConnectionBuilder builder = new NetworkElementConnectionBuilder(base);
401 if (toJoin != null) {
402 if (toJoin.requireIsRequired() != null) {
403 builder.setIsRequired(toJoin.requireIsRequired());
405 if (toJoin.getCoreModelCapability() != null) {
406 builder.setCoreModelCapability(toJoin.getCoreModelCapability());
408 if (toJoin.getDeviceType() != null) {
409 builder.setDeviceType(toJoin.getDeviceType());
411 if (toJoin.getHost() != null) {
412 builder.setHost(toJoin.getHost());
414 if (toJoin.getNodeDetails() != null) {
415 builder.setNodeDetails(toJoin.getNodeDetails());
417 if (toJoin.getPassword() != null) {
418 builder.setPassword(toJoin.getPassword());
420 if (toJoin.getPort() != null) {
421 builder.setPort(toJoin.getPort());
423 if (toJoin.getStatus() != null) {
424 builder.setStatus(toJoin.getStatus());
426 if (toJoin.getUsername() != null) {
427 builder.setUsername(toJoin.getUsername());
430 return builder.build();
435 * @param networkElementConnectionEntitiy to wirte to DB
436 * @param nodeId Id for this DB element
439 public boolean updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy,
441 return this.networkelementConnectionDB.update(networkElementConnectionEntitiy, nodeId) != null;
442 // NetworkElementConnectionEntity e =
443 // this.networkelementConnectionDB.read(nodeId);
444 // this.networkelementConnectionDB.write(this.joinNe(e,
445 // networkElementConnectionEntitiy), nodeId);
449 * Update after new mountpoint registration
451 * @param networkElementConnectionEntitiy data
452 * @param nodeId of device (mountpoint name)
455 public boolean updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy,
457 LOG.debug("update networkelement-connection for {} with data {}", nodeId, networkElementConnectionEntitiy);
458 return this.networkelementConnectionDB.updateOrCreate(networkElementConnectionEntitiy, nodeId,
459 Arrays.asList("is-required", "username", "password")) != null;
460 // NetworkElementConnectionEntity e =
461 // this.networkelementConnectionDB.read(nodeId);
462 // this.networkelementConnectionDB.write(this.joinNe(e,
463 // networkElementConnectionEntitiy), nodeId);
467 /* please do not remove */
468 // public void cleanNetworkElementConnections() {
469 // this.networkelementConnectionDB.remove(QueryBuilders.matchQuery("is-required",
471 // CreateNetworkElementConnectionInput x = new
472 // CreateNetworkElementConnectionInputBuilder().setStatus(ConnectionLogStatus.Disconnected).build();
473 // this.networkelementConnectionDB.update(x,QueryBuilders.matchAllQuery());
477 public void removeNetworkConnection(String nodeId) {
479 NetworkElementConnectionEntity e = this.networkelementConnectionDB.read(nodeId);
480 if (e != null && (isRequired = e.requireIsRequired()) != null) {
482 LOG.debug("updating connection status for {} of required ne to disconnected", nodeId);
483 this.networkelementConnectionDB.update(new UpdateNetworkElementConnectionInputBuilder()
484 .setStatus(ConnectionLogStatus.Disconnected).build(), nodeId);
486 LOG.debug("remove networkelement-connection for {} entry because of non-required", nodeId);
487 this.networkelementConnectionDB.remove(nodeId);
490 LOG.warn("Unable to update connection-status. dbentry for {} not found in networkelement-connection",
498 public int doIndexClean(Date olderAreOutdated) {
500 String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
503 QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp);
504 removed += eventRWEventLogDevicemanager.remove(queryEventBase);
506 QueryBuilder queryFaultLog = EsFaultLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
507 removed += eventRWFaultLogDB.remove(queryFaultLog);
509 QueryBuilder queryCMLog = EsCMLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
510 removed += eventRWFCMLogDB.remove(queryCMLog);
516 public long getNumberOfOldObjects(Date olderAreOutdated) {
518 String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
519 int numberOfElements = 0;
521 QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp);
522 numberOfElements += eventRWEventLogDevicemanager.doReadAll(queryEventBase).getTotal();
524 QueryBuilder queryFaultLog = EsFaultLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
525 numberOfElements += eventRWFaultLogDB.doReadAll(queryFaultLog).getTotal();
527 QueryBuilder queryCMLog = EsCMLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
528 numberOfElements += eventRWFCMLogDB.doReadAll(queryCMLog).getTotal();
530 return numberOfElements;
536 * Verify status of client
538 * @param event that is printed with message
539 * @return true if client is null
541 private boolean assertIfClientNull(Object event) {
542 return assertIfClientNull("No DB, can not write: {}", event);
545 private boolean assertIfClientNullForNodeName(Object object) {
546 return assertIfClientNull("No DB, can not handle node: {}", object);
550 * Verify status of client
552 * @param message to print including {} for object printout.
553 * @return true if client is null
555 private boolean assertIfClientNull(String message, Object object) {
556 if (client == null) {
557 LOG.debug(message, object);
565 private static class EsEventBase {
567 * Query to get older Elements
569 * @param netconfTimeStamp to identify older Elements
570 * @return QueryBuilder for older elements related to timestamp
572 private static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
573 return new RangeQueryBuilder("timestamp").lte(netconfTimeStamp);
577 private static class EsFaultLogDevicemanager {
581 * @param netconfTimeStamp to identify query elements older than this timestamp.
582 * @return QueryBuilder for related elements
584 public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
585 return new RangeQueryBuilder("timestamp").lte(netconfTimeStamp);
589 private static class EsCMLogDevicemanager {
593 * @param netconfTimeStamp to identify query elements older than this timestamp.
594 * @return QueryBuilder for related elements
596 public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
597 return new RangeQueryBuilder("timestamp").lte(netconfTimeStamp);
601 public static class EsFaultCurrent {
603 * @param nodeName name of the node
604 * @return query builder
606 public static QueryBuilder getQueryForOneNode(String nodeName) {
607 return QueryBuilders.matchQuery("node-id", nodeName);
610 public static QueryBuilder getQueryForOneNodeAndObjectId(String nodeName, String objectId) {
611 BoolQueryBuilder bq = QueryBuilders.boolQuery();
612 bq.must(QueryBuilders.matchQuery("node-id", nodeName));
613 bq.must(QueryBuilders.matchQuery("object-id", objectId));
619 public List<NetworkElementConnectionEntity> getNetworkElementConnections() {
620 return this.networkelementConnectionDB.doReadAll().getHits();
624 public void doWritePerformanceData(List<PmdataEntity> list) {
626 list.forEach(elem -> {
627 GranularityPeriodType granularityPeriod = nnGetGranularityPeriodType(elem.getGranularityPeriod());
628 // _id": "Sim12600/LP-MWPS-TTP-01/2017-07-04T15:15:00.0+00:00"
629 StringBuffer id = new StringBuffer();
630 DateAndTime date = elem.getTimeStamp();
631 id.append(elem.getNodeName());
633 id.append(elem.getUuidInterface());
635 id.append(date != null ? date.getValue() : "null");
637 switch (granularityPeriod) {
639 pmData15mDB.write(elem, id.toString());
642 pmData24hDB.write(elem, id.toString());
646 LOG.debug("Unknown granularity {} id {}", granularityPeriod, id);
654 GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType granularityPeriod) {
655 return granularityPeriod != null ? granularityPeriod : GranularityPeriodType.Unknown;
659 public HtDatabaseClient getRawClient() {
664 public void writeGuiCutThroughData(Guicutthrough gcData, String nodeId) {
665 guiCutThroughDB.write(gcData, nodeId);
669 public int clearGuiCutThroughEntriesOfNode(String nodeName) {
670 guiCutThroughDB.remove(nodeName);