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.
82 public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvider {
83 private static final Logger LOG = LoggerFactory.getLogger(HtDatabaseEventsService.class);
85 private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
87 private static final int ROOT_TREE_LEVEL = 0;
89 private HtDatabaseClient client;
90 private EsDataObjectReaderWriter2<EventlogEntity> eventRWEventLogDevicemanager;
91 private EsDataObjectReaderWriter2<InventoryEntity> eventRWEquipment;
92 private EsDataObjectReaderWriter2<FaultcurrentEntity> eventRWFaultCurrentDB;
93 private EsDataObjectReaderWriter2<FaultlogEntity> eventRWFaultLogDB;
94 private EsDataObjectReaderWriter2<CmlogEntity> eventRWFCMLogDB;
95 private EsDataObjectReaderWriter2<ConnectionlogEntity> eventRWConnectionLogDB;
96 private final EsDataObjectReaderWriter2<NetworkElementConnectionEntity> networkelementConnectionDB;
97 private final EsDataObjectReaderWriter2<GuicutthroughEntity> guiCutThroughDB;
98 private final EsDataObjectReaderWriter2<PmdataEntity> pmData15mDB;
99 private final EsDataObjectReaderWriter2<PmdataEntity> pmData24hDB;
100 // --- Construct and initialize
102 public HtDatabaseEventsService(HtDatabaseClient client) throws Exception {
104 LOG.info("Create {} start", HtDatabaseEventsService.class);
107 // Create control structure
108 this.client = client;
110 eventRWEventLogDevicemanager = new EsDataObjectReaderWriter2<>(client, Entity.Eventlog,
111 EventlogEntity.class, EventlogBuilder.class);
113 eventRWEquipment = new EsDataObjectReaderWriter2<>(client, Entity.Inventoryequipment, InventoryEntity.class,
114 InventoryBuilder.class);
116 eventRWFaultCurrentDB = new EsDataObjectReaderWriter2<>(client, Entity.Faultcurrent,
117 FaultcurrentEntity.class, FaultcurrentBuilder.class);
119 eventRWFaultLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Faultlog, FaultlogEntity.class,
120 FaultlogBuilder.class);
123 new EsDataObjectReaderWriter2<>(client, Entity.Cmlog, CmlogEntity.class, CmlogBuilder.class);
125 eventRWConnectionLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Connectionlog,
126 ConnectionlogEntity.class, ConnectionlogBuilder.class);
128 networkelementConnectionDB = new EsDataObjectReaderWriter2<>(client, Entity.NetworkelementConnection,
129 NetworkElementConnectionEntity.class, NetworkElementConnectionBuilder.class, true)
130 .setEsIdAttributeName("_id");
132 guiCutThroughDB = new EsDataObjectReaderWriter2<>(client, Entity.Guicutthrough, GuicutthroughEntity.class,
133 GuicutthroughBuilder.class);
135 pmData15mDB = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance15min, PmdataEntity.class,
136 PmdataEntityBuilder.class);
138 pmData24hDB = new EsDataObjectReaderWriter2<>(client, Entity.Historicalperformance24h, PmdataEntity.class,
139 PmdataEntityBuilder.class);
141 } catch (Exception e) {
142 LOG.error("Can not start database client. Exception: {}", e);
143 throw new Exception("Can not start database client. Exception: {}", e);
145 LOG.info("Create {} finished. DB Service {} started.", HtDatabaseEventsService.class,
146 client != null ? "sucessfully" : "not");
153 public void writeConnectionLog(ConnectionlogEntity event) {
154 if (assertIfClientNull(event)) {
157 LOG.debug("Write event: {}", event);
158 eventRWConnectionLogDB.write(event, null);
164 public void writeEventLog(EventlogEntity event) {
165 if (assertIfClientNull("No client to write {}", event)) {
169 LOG.debug("Write event: {}", event.toString());
170 eventRWEventLogDevicemanager.write(event, null);
176 public void writeFaultLog(FaultlogEntity fault) {
177 if (assertIfClientNull(fault)) {
181 LOG.debug("Write fault to faultlog: {}", fault.toString());
182 eventRWFaultLogDB.write(fault, null);
188 public void writeCMLog(CmlogEntity cm) {
189 if (assertIfClientNull(cm)) {
193 LOG.debug("Write CM to cmlog: {}", cm.toString());
194 eventRWFCMLogDB.write(cm, null);
200 public void updateFaultCurrent(FaultcurrentEntity fault) {
201 if (assertIfClientNull(fault)) {
205 if (FaultEntityManager.isManagedAsCurrentProblem(fault)) {
206 if (FaultEntityManager.isNoAlarmIndication(fault)) {
207 LOG.debug("Remove from currentFaults: {}", fault.toString());
208 eventRWFaultCurrentDB.remove(FaultEntityManager.genSpecificEsId(fault));
210 LOG.debug("Write to currentFaults: {}", fault.toString());
211 eventRWFaultCurrentDB.write(fault, FaultEntityManager.genSpecificEsId(fault));
214 LOG.debug("Ingnore for currentFaults: {}", fault.toString());
219 * Remove all entries for one node
221 * @param nodeName contains the mountpointname
222 * @return number of deleted entries
225 public int clearFaultsCurrentOfNode(String nodeName) {
226 if (assertIfClientNullForNodeName(nodeName)) {
230 LOG.debug("Remove from currentFaults all faults for node: {}", nodeName);
231 return eventRWFaultCurrentDB.remove(EsFaultCurrent.getQueryForOneNode(nodeName));
235 * Remove all entries for one node
237 * @param nodeName contains the mountpointname
238 * @param objectId of element to be deleted
239 * @return number of deleted entries
242 public int clearFaultsCurrentOfNodeWithObjectId(String nodeName, String objectId) {
243 if (assertIfClientNullForNodeName(nodeName)) {
247 LOG.debug("Remove from currentFaults all faults for node/objectId: {}/{}", nodeName, objectId);
248 return eventRWFaultCurrentDB.remove(EsFaultCurrent.getQueryForOneNodeAndObjectId(nodeName, objectId));
252 * Deliver list with all mountpoint/node-names in the database.
254 * @return List of all mountpoint/node-names the had active alarms.
257 public @Nonnull List<String> getAllNodesWithCurrentAlarms() {
258 if (assertIfClientNull("No DB, can not delete for all nodes", null)) {
259 return new ArrayList<>();
262 LOG.debug("Remove from currentFaults faults for all node");
263 List<String> nodeNames = new ArrayList<>();
265 for (FaultcurrentEntity fault : eventRWFaultCurrentDB.doReadAll().getHits()) {
266 String nodeName = fault.getNodeId();
267 if (!nodeNames.contains(nodeName)) {
268 // this.clearFaultsCurrentOfNode(nodeName); -> Function shifted
269 nodeNames.add(nodeName);
275 // -- Inventory and equipment current
278 * write internal equipment to database
280 * @param internalEquipment with mandatory fields.
283 private void writeInventory(Inventory internalEquipment) {
285 if (internalEquipment.getManufacturerIdentifier() == null) {
286 internalEquipment = new InventoryBuilder(internalEquipment).setManufacturerIdentifier("").build();
288 if (internalEquipment.getDate() == null) {
289 internalEquipment = new InventoryBuilder(internalEquipment).setDate("").build();
291 eventRWEquipment.write(internalEquipment, internalEquipment.getNodeId() + "/" + internalEquipment.getUuid());
295 * write internal equipment to database
301 public void writeInventory(String nodeId, List<Inventory> list) {
304 checkConsistency(nodeId, list);
305 } catch (DataInconsistencyException e) {
306 LOG.warn("inventory list for node {} is not consistent", nodeId, e);
307 list = e.getRepairedList();
310 for (Inventory internalEquipment : list) {
311 this.writeInventory(internalEquipment);
315 private static void checkConsistency(String nodeId, List<Inventory> list) throws DataInconsistencyException {
316 final String UNBOUND_INVENTORY_UUID = "unbound";
317 List<String> failures = new ArrayList<>();
320 Map<String, Inventory> repairList = new HashMap<>();
321 InventoryBuilder repairedItem;
322 InventoryBuilder unboundItem = new InventoryBuilder().setNodeId(nodeId).setUuid(UNBOUND_INVENTORY_UUID)
323 .setTreeLevel(Uint32.valueOf(0));;
324 for (Inventory item : list) {
325 repairedItem = new InventoryBuilder(item);
326 // check for bad node-id
327 if (!nodeId.equals(item.getNodeId())) {
328 failures.add(String.format("missing node-id for equipment(uuid=%s)", item.getUuid()));
329 repairedItem.setNodeId(nodeId);
332 // check missing tree-level
333 if (item.getTreeLevel() == null) {
334 failures.add(String.format("missing tree-level for equipment(uuid=%s)", item.getUuid()));
335 repairedItem.setTreeLevel(Uint32.valueOf(ROOT_TREE_LEVEL));
339 treeLevel = item.getTreeLevel().longValue();
340 if (treeLevel > ROOT_TREE_LEVEL) {
341 // check non root elem and missing parent
342 if (item.getParentUuid() == null) {
343 failures.add(String.format("Non root level element (uuid=%s) has to have a parent element",
346 repairedItem.setParentUuid(UNBOUND_INVENTORY_UUID);
347 repairList.put(unboundItem.getUuid(), unboundItem.build());
349 // check that parent exists in list and is tree-level -1
351 Optional<Inventory> parent =
352 list.stream().filter(e -> item.getParentUuid().equals(e.getUuid())).findFirst();
353 if (parent.isEmpty()) {
354 failures.add(String.format("no parent found for uuid=%s with parent-uuid=%s",
355 item.getUuid(), item.getParentUuid()));
356 repairedItem.setParentUuid(UNBOUND_INVENTORY_UUID);
361 // check for duplicated uui
362 Optional<Inventory> duplicate = list
363 .stream().filter(e -> !item.equals(e) && item.getUuid() != null
364 && item.getUuid().equals(e.getUuid()) && repairList.containsKey(e.getUuid()))
366 if (duplicate.isPresent()) {
367 failures.add(String.format("found duplicate uuid=%s", item.getUuid()));
372 if (failCounter > 0) {
373 repairList.put(repairedItem.getUuid(), repairedItem.build());
375 repairList.put(item.getUuid(), item);
380 if (failures.size() > 0) {
381 throw new DataInconsistencyException(new ArrayList<>(repairList.values()),
382 "inventory list is not consistent;\n" + String.join("\n", failures));
389 * join base with parameters of toJoin (only non null values)
391 * @param base base object
392 * @param toJoin object with new property values
393 * @return new joined object
395 @SuppressWarnings("unused")
396 private NetworkElementConnectionEntity joinNe(NetworkElementConnectionEntity base,
397 NetworkElementConnectionEntity toJoin) {
401 NetworkElementConnectionBuilder builder = new NetworkElementConnectionBuilder(base);
402 if (toJoin != null) {
403 if (toJoin.requireIsRequired() != null) {
404 builder.setIsRequired(toJoin.requireIsRequired());
406 if (toJoin.getCoreModelCapability() != null) {
407 builder.setCoreModelCapability(toJoin.getCoreModelCapability());
409 if (toJoin.getDeviceType() != null) {
410 builder.setDeviceType(toJoin.getDeviceType());
412 if (toJoin.getHost() != null) {
413 builder.setHost(toJoin.getHost());
415 if (toJoin.getNodeDetails() != null) {
416 builder.setNodeDetails(toJoin.getNodeDetails());
418 if (toJoin.getPassword() != null) {
419 builder.setPassword(toJoin.getPassword());
421 if (toJoin.getPort() != null) {
422 builder.setPort(toJoin.getPort());
424 if (toJoin.getStatus() != null) {
425 builder.setStatus(toJoin.getStatus());
427 if (toJoin.getUsername() != null) {
428 builder.setUsername(toJoin.getUsername());
431 return builder.build();
436 * @param networkElementConnectionEntitiy to wirte to DB
437 * @param nodeId Id for this DB element
440 public boolean updateNetworkConnectionDeviceType(NetworkElementConnectionEntity networkElementConnectionEntitiy,
442 return this.networkelementConnectionDB.update(networkElementConnectionEntitiy, nodeId) != null;
443 // NetworkElementConnectionEntity e =
444 // this.networkelementConnectionDB.read(nodeId);
445 // this.networkelementConnectionDB.write(this.joinNe(e,
446 // networkElementConnectionEntitiy), nodeId);
450 * Update after new mountpoint registration
452 * @param networkElementConnectionEntitiy data
453 * @param nodeId of device (mountpoint name)
456 public boolean updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy,
458 LOG.debug("update networkelement-connection for {} with data {}", nodeId, networkElementConnectionEntitiy);
459 return this.networkelementConnectionDB.updateOrCreate(networkElementConnectionEntitiy, nodeId,
460 Arrays.asList("is-required", "username", "password")) != null;
461 // NetworkElementConnectionEntity e =
462 // this.networkelementConnectionDB.read(nodeId);
463 // this.networkelementConnectionDB.write(this.joinNe(e,
464 // networkElementConnectionEntitiy), nodeId);
468 /* please do not remove */
469 // public void cleanNetworkElementConnections() {
470 // this.networkelementConnectionDB.remove(QueryBuilders.matchQuery("is-required",
472 // CreateNetworkElementConnectionInput x = new
473 // CreateNetworkElementConnectionInputBuilder().setStatus(ConnectionLogStatus.Disconnected).build();
474 // this.networkelementConnectionDB.update(x,QueryBuilders.matchAllQuery());
478 public void removeNetworkConnection(String nodeId) {
480 NetworkElementConnectionEntity e = this.networkelementConnectionDB.read(nodeId);
481 if (e != null && (isRequired = e.requireIsRequired()) != null) {
483 LOG.debug("updating connection status for {} of required ne to disconnected", nodeId);
484 this.networkelementConnectionDB.update(new UpdateNetworkElementConnectionInputBuilder()
485 .setStatus(ConnectionLogStatus.Disconnected).build(), nodeId);
487 LOG.debug("remove networkelement-connection for {} entry because of non-required", nodeId);
488 this.networkelementConnectionDB.remove(nodeId);
491 LOG.warn("Unable to update connection-status. dbentry for {} not found in networkelement-connection",
499 public int doIndexClean(Date olderAreOutdated) {
501 String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
504 QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp);
505 removed += eventRWEventLogDevicemanager.remove(queryEventBase);
507 QueryBuilder queryFaultLog = EsFaultLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
508 removed += eventRWFaultLogDB.remove(queryFaultLog);
510 QueryBuilder queryCMLog = EsCMLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
511 removed += eventRWFCMLogDB.remove(queryCMLog);
517 public long getNumberOfOldObjects(Date olderAreOutdated) {
519 String netconfTimeStamp = NETCONFTIME_CONVERTER.getTimeStampAsNetconfString(olderAreOutdated);
520 int numberOfElements = 0;
522 QueryBuilder queryEventBase = EsEventBase.getQueryForTimeStamp(netconfTimeStamp);
523 numberOfElements += eventRWEventLogDevicemanager.doReadAll(queryEventBase).getTotal();
525 QueryBuilder queryFaultLog = EsFaultLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
526 numberOfElements += eventRWFaultLogDB.doReadAll(queryFaultLog).getTotal();
528 QueryBuilder queryCMLog = EsCMLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp);
529 numberOfElements += eventRWFCMLogDB.doReadAll(queryCMLog).getTotal();
531 return numberOfElements;
537 * Verify status of client
539 * @param event that is printed with message
540 * @return true if client is null
542 private boolean assertIfClientNull(Object event) {
543 return assertIfClientNull("No DB, can not write: {}", event);
546 private boolean assertIfClientNullForNodeName(Object object) {
547 return assertIfClientNull("No DB, can not handle node: {}", object);
551 * Verify status of client
553 * @param message to print including {} for object printout.
554 * @return true if client is null
556 private boolean assertIfClientNull(String message, Object object) {
557 if (client == null) {
558 LOG.debug(message, object);
566 private static class EsEventBase {
568 * Query to get older Elements
570 * @param netconfTimeStamp to identify older Elements
571 * @return QueryBuilder for older elements related to timestamp
573 private static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
574 return new RangeQueryBuilder("timestamp").lte(netconfTimeStamp);
578 private static class EsFaultLogDevicemanager {
582 * @param netconfTimeStamp to identify query elements older than this timestamp.
583 * @return QueryBuilder for related elements
585 public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
586 return new RangeQueryBuilder("timestamp").lte(netconfTimeStamp);
590 private static class EsCMLogDevicemanager {
594 * @param netconfTimeStamp to identify query elements older than this timestamp.
595 * @return QueryBuilder for related elements
597 public static QueryBuilder getQueryForTimeStamp(String netconfTimeStamp) {
598 return new RangeQueryBuilder("timestamp").lte(netconfTimeStamp);
602 public static class EsFaultCurrent {
604 * @param nodeName name of the node
605 * @return query builder
607 public static QueryBuilder getQueryForOneNode(String nodeName) {
608 return QueryBuilders.matchQuery("node-id", nodeName);
611 public static QueryBuilder getQueryForOneNodeAndObjectId(String nodeName, String objectId) {
612 BoolQueryBuilder bq = QueryBuilders.boolQuery();
613 bq.must(QueryBuilders.matchQuery("node-id", nodeName));
614 bq.must(QueryBuilders.matchQuery("object-id", objectId));
620 public List<NetworkElementConnectionEntity> getNetworkElementConnections() {
621 return this.networkelementConnectionDB.doReadAll().getHits();
625 public void doWritePerformanceData(List<PmdataEntity> list) {
627 list.forEach(elem -> {
628 GranularityPeriodType granularityPeriod = nnGetGranularityPeriodType(elem.getGranularityPeriod());
629 // _id": "Sim12600/LP-MWPS-TTP-01/2017-07-04T15:15:00.0+00:00"
630 StringBuffer id = new StringBuffer();
631 DateAndTime date = elem.getTimeStamp();
632 id.append(elem.getNodeName());
634 id.append(elem.getUuidInterface());
636 id.append(date != null ? date.getValue() : "null");
638 switch (granularityPeriod) {
640 pmData15mDB.write(elem, id.toString());
643 pmData24hDB.write(elem, id.toString());
647 LOG.debug("Unknown granularity {} id {}", granularityPeriod, id);
655 GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType granularityPeriod) {
656 return granularityPeriod != null ? granularityPeriod : GranularityPeriodType.Unknown;
660 public HtDatabaseClient getRawClient() {
665 public void writeGuiCutThroughData(Guicutthrough gcData, String nodeId) {
666 guiCutThroughDB.write(gcData, nodeId);
670 public int clearGuiCutThroughEntriesOfNode(String nodeName) {
671 guiCutThroughDB.remove(nodeName);