blob: 93b0054f9a5f81f9c77b4e801c7cf7e857cbd251 [file] [log] [blame]
yoshi0451f282013-11-22 15:48:55 -08001/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package net.onrc.onos.graph;
6
7import com.thinkaurelius.titan.core.TitanGraph;
8import com.tinkerpop.blueprints.impls.ramcloud.RamCloudGraph;
9import com.tinkerpop.frames.FramedGraph;
10import java.io.File;
11import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects;
12import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
13import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
14import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath;
15import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
16import net.onrc.onos.ofcontroller.util.FlowEntryId;
17import net.onrc.onos.ofcontroller.util.FlowId;
18import org.apache.commons.configuration.Configuration;
19
20/**
21 *
22 * @author nickkaranatsios
23 */
24public class RamCloudDBOperation extends DBOperation {
25
26 public RamCloudDBOperation() {
27 //Configuration configuration= getConfiguration(new File(dbConfigFile));
28 //final String coordinatorURL = configuration.getProperty("connect.coordinator");
29 }
30
31 @Override
32 public INetMapTopologyObjects.ISwitchObject searchSwitch(String dpid) {
33 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
34 }
35
36 @Override
37 public INetMapTopologyObjects.ISwitchObject searchActiveSwitch(String dpid) {
38 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
39 }
40
41 @Override
42 public Iterable<INetMapTopologyObjects.ISwitchObject> getActiveSwitches() {
43 return getActiveSwitches(conn.getFramedGraph());
44 }
45
46 @Override
47 public Iterable<INetMapTopologyObjects.ISwitchObject> getAllSwitches() {
48 return getAllSwitches(conn.getFramedGraph());
49 }
50
51 @Override
52 public Iterable<INetMapTopologyObjects.ISwitchObject> getInactiveSwitches() {
53 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
54 }
55
56 @Override
57 public Iterable<INetMapTopologyObjects.IFlowEntry> getAllSwitchNotUpdatedFlowEntries() {
58 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
59 }
60
61 @Override
62 public void removeSwitch(INetMapTopologyObjects.ISwitchObject sw) {
63 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
64 }
65
66 @Override
67 public INetMapTopologyObjects.IPortObject newPort(Short portNumber) {
68 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
69 }
70
71 @Override
72 public INetMapTopologyObjects.IPortObject newPort(String dpid, Short portNum) {
73 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
74 }
75
76 @Override
77 public IPortObject searchPort(String dpid, Short number) {
78 final FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
79 return searchPort(dpid, number, fg);
80 }
81
82 @Override
83 public void removePort(INetMapTopologyObjects.IPortObject port) {
84 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
85 if (fg != null) {
86 fg.removeVertex(port.asVertex());
87 }
88 }
89
90
91 @Override
92 public IDeviceObject searchDevice(String macAddr) {
93 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
94 return searchDevice(macAddr, fg);
95 }
96
97 @Override
98 public Iterable<IDeviceObject> getDevices() {
99 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
100 return fg != null ? fg.getVertices("type", "device", IDeviceObject.class) : null;
101 }
102
103 @Override
104 public void removeDevice(IDeviceObject dev) {
105 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
106 if (fg != null) {
107 fg.removeVertex(dev.asVertex());
108 }
109 }
110
111
112 @Override
113 public INetMapTopologyObjects.IFlowPath searchFlowPath(FlowId flowId) {
114 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
115 return searchFlowPath(flowId, fg);
116 }
117
118 @Override
119 public Iterable<IFlowPath> getAllFlowPaths() {
120 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
121 return getAllFlowPaths(fg);
122 }
123
124 @Override
125 public void removeFlowPath(INetMapTopologyObjects.IFlowPath flowPath) {
126 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
127 fg.removeVertex(flowPath.asVertex());
128 }
129
130 @Override
131 public IFlowEntry newFlowEntry() {
132 FramedGraph<RamCloudGraph> fg = conn.getFramedGraph();
133 return newFlowEntry(fg);
134 }
135
136 @Override
137 public INetMapTopologyObjects.IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) {
138 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
139 }
140
141 @Override
142 public Iterable<INetMapTopologyObjects.IFlowEntry> getAllFlowEntries() {
143 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
144 }
145
146 @Override
147 public void removeFlowEntry(INetMapTopologyObjects.IFlowEntry flowEntry) {
148 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
149 }
150
151 @Override
152 public IDBConnection getDBConnection() {
153 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
154 }
155
156 @Override
157 public void commit() {
158 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
159 }
160
161 @Override
162 public void rollback() {
163 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
164 }
165
166 @Override
167 public void close() {
168 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
169 }
170}