Assign image keyname and pubkey at vnf level
[ccsdk/apps.git] / sdnr / wireless-transport / code-Carbon-SR1 / apps / devicemanager / impl / src / main / java / org / opendaylight / mwtn / performancemanager / impl / PerformanceManagerImpl.java
1 package org.opendaylight.mwtn.performancemanager.impl;
2
3 import javax.annotation.Nullable;
4
5 import org.opendaylight.mwtn.base.netconf.ONFCoreNetworkElementRepresentation;
6 import org.opendaylight.mwtn.performancemanager.impl.database.service.MicrowaveHistoricalPerformanceWriterService;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
9
10 public class PerformanceManagerImpl implements AutoCloseable {
11
12     private static final Logger LOG = LoggerFactory.getLogger(PerformanceManagerImpl.class);
13
14     private @Nullable PerformanceManagerTask task;
15
16     public PerformanceManagerImpl(long seconds, MicrowaveHistoricalPerformanceWriterService databaseService) {
17
18         LOG.info("Construct begin {} with {} Seconds",PerformanceManagerImpl.class.getSimpleName(), seconds);
19
20         if (MicrowaveHistoricalPerformanceWriterService.isAvailable(databaseService)) {
21
22             LOG.info("Do start of PM task");
23             task = new PerformanceManagerTask(seconds, databaseService);
24             task.start();
25             LOG.info("PM task scheduled");
26
27         } else {
28             LOG.info("Database not available. Do not start PM task");
29         }
30
31         LOG.info("Construct end {}",PerformanceManagerImpl.class.getSimpleName());
32     }
33
34     public void close() {
35         LOG.info("Close {}", PerformanceManagerImpl.class.getSimpleName());
36         if (task != null) {
37             task.stop();
38         }
39     }
40
41     public void registration(String mountPointNodeName, ONFCoreNetworkElementRepresentation ne) {
42         LOG.debug("Register {}",mountPointNodeName);
43         if (task != null)
44                 task.registration(mountPointNodeName, ne);
45     }
46
47     public void deRegistration(String mountPointNodeName) {
48         LOG.debug("Deregister {}",mountPointNodeName);
49         if (task != null)
50                 task.deRegistration(mountPointNodeName);
51     }
52
53 }