Initial Netty + JSON Deserializer + all the enhancements happening in many private...
[ovsdb.git] / ovsdb / src / main / java / org / opendaylight / ovsdb / plugin / InventoryService.java
1 package org.opendaylight.ovsdb.plugin;
2
3 import java.net.InetAddress;
4 import java.net.UnknownHostException;
5 import java.util.ArrayList;
6 import java.util.Date;
7 import java.util.Dictionary;
8 import java.util.HashMap;
9 import java.util.HashSet;
10 import java.util.List;
11 import java.util.Map;
12 import java.util.Set;
13 import java.util.concurrent.ConcurrentHashMap;
14 import java.util.concurrent.ConcurrentMap;
15
16 import org.apache.felix.dm.Component;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 import org.opendaylight.controller.sal.core.Actions;
21 import org.opendaylight.controller.sal.core.Bandwidth;
22 import org.opendaylight.controller.sal.core.Buffers;
23 import org.opendaylight.controller.sal.core.Capabilities;
24 import org.opendaylight.controller.sal.core.Capabilities.CapabilitiesType;
25 import org.opendaylight.controller.sal.core.ConstructionException;
26 import org.opendaylight.controller.sal.core.Node;
27 import org.opendaylight.controller.sal.core.NodeConnector;
28 import org.opendaylight.controller.sal.core.Property;
29 import org.opendaylight.controller.sal.core.State;
30 import org.opendaylight.controller.sal.core.Tables;
31 import org.opendaylight.controller.sal.core.TimeStamp;
32 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
33 import org.opendaylight.controller.sal.utils.NodeCreator;
34 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
35
36 /**
37  * Stub Implementation for IPluginInReadService used by SAL
38  *
39  *
40  */
41 public class InventoryService implements IPluginInInventoryService, InventoryServiceInternal {
42     private static final Logger logger = LoggerFactory
43             .getLogger(InventoryService.class);
44
45     private ConcurrentMap<Node, Map<String, Property>> nodeProps;
46     private ConcurrentMap<NodeConnector, Map<String, Property>> nodeConnectorProps;
47
48     /**
49      * Function called by the dependency manager when all the required
50      * dependencies are satisfied
51      *
52      */
53     void init() {
54         nodeProps = new ConcurrentHashMap<Node, Map<String, Property>>();
55         nodeConnectorProps = new ConcurrentHashMap<NodeConnector, Map<String, Property>>();
56         Node.NodeIDType.registerIDType("OVS", String.class);
57         NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
58     }
59
60
61     /**
62      * Function called by the dependency manager when at least one dependency
63      * become unsatisfied or when the component is shutting down because for
64      * example bundle is being stopped.
65      *
66      */
67     void destroy() {
68     }
69
70     /**
71      * Function called by dependency manager after "init ()" is called and after
72      * the services provided by the class are registered in the service registry
73      *
74      */
75     void start() {
76     }
77
78     /**
79      * Function called by the dependency manager before the services exported by
80      * the component are unregistered, this will be followed by a "destroy ()"
81      * calls
82      *
83      */
84     void stop() {
85     }
86
87     /**
88      * Retrieve nodes from openflow
89      */
90     @Override
91     public ConcurrentMap<Node, Map<String, Property>> getNodeProps() {
92         return nodeProps;
93     }
94
95     /**
96      * Retrieve nodeConnectors from openflow
97      */
98     @Override
99     public ConcurrentMap<NodeConnector, Map<String, Property>> getNodeConnectorProps(
100             Boolean refresh) {
101         return nodeConnectorProps;
102     }
103
104 }