Naoki Shiota | 93ec171 | 2013-06-13 15:49:36 -0700 | [diff] [blame^] | 1 | package net.floodlightcontroller.linkdiscovery.internal; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.HashMap; |
| 5 | import java.util.List; |
| 6 | import java.util.Map; |
| 7 | |
| 8 | import org.codehaus.jackson.annotate.JsonIgnore; |
| 9 | import org.codehaus.jackson.annotate.JsonProperty; |
| 10 | import org.easymock.EasyMock; |
| 11 | import org.openflow.util.HexString; |
| 12 | |
| 13 | import com.tinkerpop.blueprints.Direction; |
| 14 | import com.tinkerpop.blueprints.Vertex; |
| 15 | import com.tinkerpop.frames.Adjacency; |
| 16 | import com.tinkerpop.frames.Incidence; |
| 17 | import com.tinkerpop.frames.Property; |
| 18 | import com.tinkerpop.frames.annotations.gremlin.GremlinGroovy; |
| 19 | import com.tinkerpop.frames.annotations.gremlin.GremlinParam; |
| 20 | |
| 21 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject; |
| 22 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry; |
| 23 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath; |
| 24 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject; |
| 25 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject; |
| 26 | import net.onrc.onos.ofcontroller.core.ISwitchStorage.SwitchState; |
| 27 | import net.onrc.onos.ofcontroller.util.FlowEntryId; |
| 28 | import net.onrc.onos.ofcontroller.util.FlowId; |
| 29 | import net.onrc.onos.util.GraphDBConnection; |
| 30 | import net.onrc.onos.util.GraphDBOperation; |
| 31 | import net.onrc.onos.util.IDBConnection; |
| 32 | |
| 33 | public class TestGraphDBOperation extends GraphDBOperation { |
| 34 | protected List<TestSwitchObject> switches; |
| 35 | protected List<TestPortObject> ports; |
| 36 | // protected List<TestDeviceObject> devices; |
| 37 | // protected List<TestFlowEntry> flows; |
| 38 | |
| 39 | protected List<TestSwitchObject> switchesToAdd; |
| 40 | protected List<TestPortObject> portsToAdd; |
| 41 | // protected List<TestDeviceObject> devicesToAdd; |
| 42 | // protected List<TestFlowEntry> flowsToAdd; |
| 43 | |
| 44 | protected List<TestSwitchObject> switchesToRemove; |
| 45 | protected List<TestPortObject> portsToRemove; |
| 46 | // protected List<TestDeviceObject> devicesToRemove; |
| 47 | // protected List<TestFlowEntry> flowsToRemove; |
| 48 | |
| 49 | |
| 50 | // Testable implementations of INetMapTopologyObject interfaces |
| 51 | |
| 52 | public static class TestSwitchObject implements ISwitchObject { |
| 53 | private String state,type,dpid; |
| 54 | private List<IPortObject> ports; |
| 55 | private List<IDeviceObject> devices; |
| 56 | private List<IFlowEntry> flows; |
| 57 | |
| 58 | private String stateToUpdate, typeToUpdate, dpidToUpdate; |
| 59 | private List<IPortObject> portsToAdd; |
| 60 | private List<IPortObject> portsToRemove; |
| 61 | |
| 62 | public TestSwitchObject() { |
| 63 | type = "switch"; |
| 64 | state = "ACTIVE"; |
| 65 | |
| 66 | ports = new ArrayList<IPortObject>(); |
| 67 | portsToAdd = new ArrayList<IPortObject>(); |
| 68 | portsToRemove = new ArrayList<IPortObject>(); |
| 69 | devices = new ArrayList<IDeviceObject>(); |
| 70 | flows = new ArrayList<IFlowEntry>(); |
| 71 | |
| 72 | clearUncommitedData(); |
| 73 | } |
| 74 | |
| 75 | public void commit() { |
| 76 | for(IPortObject port : portsToAdd) { |
| 77 | ports.add(port); |
| 78 | } |
| 79 | for(IPortObject port : portsToRemove) { |
| 80 | ports.remove(port); |
| 81 | } |
| 82 | if(stateToUpdate != null) { state = stateToUpdate; } |
| 83 | if(typeToUpdate != null) { type = typeToUpdate; } |
| 84 | if(dpidToUpdate != null) { dpid = dpidToUpdate; } |
| 85 | |
| 86 | clearUncommitedData(); |
| 87 | } |
| 88 | |
| 89 | public void rollback() { |
| 90 | clearUncommitedData(); |
| 91 | } |
| 92 | |
| 93 | public void clearUncommitedData() { |
| 94 | portsToAdd.clear(); |
| 95 | portsToRemove.clear(); |
| 96 | stateToUpdate = typeToUpdate = dpidToUpdate = null; |
| 97 | } |
| 98 | |
| 99 | public void setDpidForTest(String dpid) { this.dpid = dpid; } |
| 100 | public void setStateForTest(String state) { this.state = state; } |
| 101 | public void setTypeForTest(String type) { this.type = type; } |
| 102 | public void addPortForTest(TestPortObject port) { ports.add(port); } |
| 103 | |
| 104 | @Override |
| 105 | @JsonProperty("state") |
| 106 | @Property("state") |
| 107 | public String getState() { return state; } |
| 108 | |
| 109 | @Override |
| 110 | @Property("state") |
| 111 | public void setState(String state) { this.stateToUpdate = state; } |
| 112 | |
| 113 | @Override |
| 114 | @JsonIgnore |
| 115 | @Property("type") |
| 116 | public String getType() { return type ; } |
| 117 | |
| 118 | @Override |
| 119 | @Property("type") |
| 120 | public void setType(String type) { this.typeToUpdate = type; } |
| 121 | |
| 122 | // Not support for test |
| 123 | @Override |
| 124 | public Vertex asVertex() { return null; } |
| 125 | |
| 126 | @Override |
| 127 | @JsonProperty("dpid") |
| 128 | @Property("dpid") |
| 129 | public String getDPID() { return dpid; } |
| 130 | |
| 131 | @Override |
| 132 | @Property("dpid") |
| 133 | public void setDPID(String dpid) { this.dpidToUpdate = dpid; } |
| 134 | |
| 135 | @Override |
| 136 | @JsonProperty("ports") |
| 137 | @Adjacency(label = "on") |
| 138 | public Iterable<IPortObject> getPorts() { return ports; } |
| 139 | |
| 140 | @Override |
| 141 | @JsonIgnore |
| 142 | @GremlinGroovy("_().out('on').has('number',port_num)") |
| 143 | public IPortObject getPort(@GremlinParam("port_num") short port_num) { |
| 144 | for(IPortObject port : ports) { |
| 145 | if(port.getNumber() == port_num) { |
| 146 | return port; |
| 147 | } |
| 148 | } |
| 149 | return null; |
| 150 | } |
| 151 | |
| 152 | @Override |
| 153 | @Adjacency(label = "on") |
| 154 | public void addPort(IPortObject port) { portsToAdd.add(port); } |
| 155 | |
| 156 | @Override |
| 157 | @Adjacency(label = "on") |
| 158 | public void removePort(IPortObject port) { portsToRemove.add(port); } |
| 159 | |
| 160 | @Override |
| 161 | @JsonIgnore |
| 162 | @GremlinGroovy("_().out('on').out('host')") |
| 163 | public Iterable<IDeviceObject> getDevices() { return devices; } |
| 164 | |
| 165 | @Override |
| 166 | @JsonIgnore |
| 167 | @Incidence(label = "switch", direction = Direction.IN) |
| 168 | public Iterable<IFlowEntry> getFlowEntries() { return flows; } |
| 169 | } |
| 170 | |
| 171 | public static class TestPortObject implements IPortObject { |
| 172 | private String state,type,desc; |
| 173 | private Short number; |
| 174 | private Integer port_state; |
| 175 | private ISwitchObject sw; |
| 176 | private List<IPortObject> linkedPorts; |
| 177 | private List<IDeviceObject> devices; |
| 178 | private List<IFlowEntry> flows; |
| 179 | |
| 180 | private String stateToUpdate,typeToUpdate,descToUpdate; |
| 181 | private Short numberToUpdate; |
| 182 | private Integer port_stateToUpdate; |
| 183 | private List<IPortObject> linkedPortsToAdd; |
| 184 | private List<IPortObject> linkedPortsToRemove; |
| 185 | |
| 186 | |
| 187 | public TestPortObject() { |
| 188 | type = "port"; |
| 189 | state = "ACTIVE"; |
| 190 | |
| 191 | linkedPorts = new ArrayList<IPortObject>(); |
| 192 | linkedPortsToAdd = new ArrayList<IPortObject>(); |
| 193 | linkedPortsToRemove = new ArrayList<IPortObject>(); |
| 194 | devices = new ArrayList<IDeviceObject>(); |
| 195 | flows = new ArrayList<IFlowEntry>(); |
| 196 | |
| 197 | clearUncommitedData(); |
| 198 | } |
| 199 | |
| 200 | public void commit() { |
| 201 | for(IPortObject port : linkedPortsToAdd) { |
| 202 | linkedPorts.add(port); |
| 203 | } |
| 204 | for(IPortObject port : linkedPortsToRemove) { |
| 205 | linkedPorts.remove(port); |
| 206 | } |
| 207 | if(stateToUpdate != null) { state = stateToUpdate; } |
| 208 | if(typeToUpdate != null) { type = typeToUpdate; } |
| 209 | if(descToUpdate != null) { desc = descToUpdate; } |
| 210 | if(numberToUpdate != null) { number = numberToUpdate; } |
| 211 | if(port_stateToUpdate != null) { port_state = port_stateToUpdate; } |
| 212 | |
| 213 | clearUncommitedData(); |
| 214 | } |
| 215 | |
| 216 | public void rollback() { |
| 217 | clearUncommitedData(); |
| 218 | } |
| 219 | |
| 220 | public void clearUncommitedData() { |
| 221 | linkedPortsToAdd.clear(); |
| 222 | linkedPortsToRemove.clear(); |
| 223 | stateToUpdate = typeToUpdate = descToUpdate = null; |
| 224 | port_stateToUpdate = null; |
| 225 | numberToUpdate = null; |
| 226 | } |
| 227 | |
| 228 | public void setStateForTest(String state) { this.state = state; } |
| 229 | public void setTypeForTest(String type) { this.type = type; } |
| 230 | public void setDescForTest(String desc) { this.desc = desc; } |
| 231 | public void setNumberForTest(Short number) { this.number = number; } |
| 232 | public void setPortStateForTest(Integer state) { this.port_state = state; } |
| 233 | public void setSwitchForTest(ISwitchObject sw) { this.sw = sw; } |
| 234 | public void addLinkedPortForTest(TestPortObject port) { this.linkedPorts.add(port); } |
| 235 | |
| 236 | @Override |
| 237 | @JsonProperty("state") |
| 238 | @Property("state") |
| 239 | public String getState() { return state; } |
| 240 | |
| 241 | @Override |
| 242 | @Property("state") |
| 243 | public void setState(String state) { this.stateToUpdate = state; } |
| 244 | |
| 245 | @Override |
| 246 | @JsonIgnore |
| 247 | @Property("type") |
| 248 | public String getType() { return type; } |
| 249 | |
| 250 | @Override |
| 251 | @Property("type") |
| 252 | public void setType(String type) { this.typeToUpdate = type; } |
| 253 | |
| 254 | // not support for test |
| 255 | @Override |
| 256 | public Vertex asVertex() { |
| 257 | return null; |
| 258 | } |
| 259 | |
| 260 | @Override |
| 261 | @JsonProperty("number") |
| 262 | @Property("number") |
| 263 | public Short getNumber() { return number; } |
| 264 | |
| 265 | @Override |
| 266 | @Property("number") |
| 267 | public void setNumber(Short n) { this.numberToUpdate = n; } |
| 268 | |
| 269 | @Override |
| 270 | @JsonProperty("desc") |
| 271 | @Property("desc") |
| 272 | public String getDesc() { return desc; } |
| 273 | |
| 274 | @Override |
| 275 | @Property("desc") |
| 276 | public void setDesc(String s) { this.descToUpdate = s; } |
| 277 | |
| 278 | @Override |
| 279 | @JsonIgnore |
| 280 | @Property("port_state") |
| 281 | public Integer getPortState() { return port_state; } |
| 282 | |
| 283 | @Override |
| 284 | @Property("port_state") |
| 285 | public void setPortState(Integer s) { this.port_stateToUpdate = s; } |
| 286 | |
| 287 | @Override |
| 288 | @JsonIgnore |
| 289 | @Incidence(label = "on", direction = Direction.IN) |
| 290 | public ISwitchObject getSwitch() { return sw; } |
| 291 | |
| 292 | @Override |
| 293 | @JsonProperty("devices") |
| 294 | @Adjacency(label = "host") |
| 295 | public Iterable<IDeviceObject> getDevices() { return devices; } |
| 296 | |
| 297 | @Override |
| 298 | @Adjacency(label = "host") |
| 299 | public void setDevice(IDeviceObject device) { devices.add(device); } |
| 300 | |
| 301 | @Override |
| 302 | @Adjacency(label = "host") |
| 303 | public void removeDevice(IDeviceObject device) { devices.remove(device); } |
| 304 | |
| 305 | @Override |
| 306 | @JsonIgnore |
| 307 | @Incidence(label = "inport", direction = Direction.IN) |
| 308 | public Iterable<IFlowEntry> getInFlowEntries() { |
| 309 | // TODO Auto-generated method stub |
| 310 | return null; |
| 311 | } |
| 312 | |
| 313 | @Override |
| 314 | @JsonIgnore |
| 315 | @Incidence(label = "outport", direction = Direction.IN) |
| 316 | public Iterable<IFlowEntry> getOutFlowEntries() { |
| 317 | // TODO Auto-generated method stub |
| 318 | return null; |
| 319 | } |
| 320 | |
| 321 | @Override |
| 322 | @JsonIgnore |
| 323 | @Adjacency(label = "link") |
| 324 | public Iterable<IPortObject> getLinkedPorts() { return linkedPorts; } |
| 325 | |
| 326 | @Override |
| 327 | @Adjacency(label = "link") |
| 328 | public void removeLink(IPortObject dest_port) { linkedPortsToRemove.add(dest_port); } |
| 329 | |
| 330 | @Override |
| 331 | @Adjacency(label = "link") |
| 332 | public void setLinkPort(IPortObject dest_port) { linkedPortsToAdd.add(dest_port); } |
| 333 | } |
| 334 | |
| 335 | |
| 336 | public TestGraphDBOperation() { |
| 337 | super(EasyMock.createNiceMock(GraphDBConnection.class)); |
| 338 | |
| 339 | switches = new ArrayList<TestSwitchObject>(); |
| 340 | ports = new ArrayList<TestPortObject>(); |
| 341 | // devices = new ArrayList<TestDeviceObject>(); |
| 342 | // flows = new ArrayList<TestFlowEntry>(); |
| 343 | |
| 344 | switchesToAdd = new ArrayList<TestSwitchObject>(); |
| 345 | portsToAdd = new ArrayList<TestPortObject>(); |
| 346 | // devicesToAdd = new ArrayList<TestDeviceObject>(); |
| 347 | // flowsToAdd = new ArrayList<TestFlowEntry>(); |
| 348 | |
| 349 | switchesToRemove = new ArrayList<TestSwitchObject>(); |
| 350 | portsToRemove = new ArrayList<TestPortObject>(); |
| 351 | // devicesToRemove = new ArrayList<TestDeviceObject>(); |
| 352 | // flowsToRemove = new ArrayList<TestFlowEntry>(); |
| 353 | |
| 354 | clear(); |
| 355 | } |
| 356 | |
| 357 | private void clear() { |
| 358 | for(TestSwitchObject sw : switches) { |
| 359 | sw.clearUncommitedData(); |
| 360 | } |
| 361 | for(TestSwitchObject sw : switchesToAdd) { |
| 362 | sw.clearUncommitedData(); |
| 363 | } |
| 364 | |
| 365 | for(TestPortObject port : ports) { |
| 366 | port.clearUncommitedData(); |
| 367 | } |
| 368 | for(TestPortObject port : portsToAdd) { |
| 369 | port.clearUncommitedData(); |
| 370 | } |
| 371 | |
| 372 | switchesToAdd.clear(); |
| 373 | switchesToRemove.clear(); |
| 374 | portsToAdd.clear(); |
| 375 | portsToRemove.clear(); |
| 376 | } |
| 377 | |
| 378 | |
| 379 | // this.*ForTest() methods below are supposed to be used for creation of test topology. |
| 380 | /** |
| 381 | * |
| 382 | * @param dpid |
| 383 | * @return |
| 384 | */ |
| 385 | public TestSwitchObject createNewSwitchForTest(String dpid) { |
| 386 | for(TestSwitchObject sw_loop : switches) { |
| 387 | if(sw_loop.getDPID().equals(dpid)) { |
| 388 | // Already created |
| 389 | return sw_loop; |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | TestSwitchObject sw = new TestSwitchObject(); |
| 394 | |
| 395 | sw.setDpidForTest(dpid); |
| 396 | switches.add(sw); |
| 397 | |
| 398 | return sw; |
| 399 | } |
| 400 | |
| 401 | public TestPortObject createNewPortForTest(String dpid, Short number) { |
| 402 | TestSwitchObject sw = null; |
| 403 | |
| 404 | for(TestSwitchObject sw_loop : switches) { |
| 405 | if(sw_loop.getDPID().equals(dpid)) { |
| 406 | sw = sw_loop; |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | if(sw != null) { |
| 411 | TestPortObject port = new TestPortObject(); |
| 412 | port.setNumberForTest(number); |
| 413 | port.setSwitchForTest(sw); |
| 414 | |
| 415 | return port; |
| 416 | } else { |
| 417 | return null; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | public void setLinkBetweenPortsForTest(TestPortObject src, TestPortObject dst) { |
| 422 | src.addLinkedPortForTest(dst); |
| 423 | //dst.addLinkedPortForTest(src); |
| 424 | } |
| 425 | |
| 426 | // Overriding methods below are to mock GraphDBOperation class. |
| 427 | @Override |
| 428 | public ISwitchObject newSwitch(String dpid) { |
| 429 | TestSwitchObject sw = new TestSwitchObject(); |
| 430 | switchesToAdd.add(sw); |
| 431 | |
| 432 | return sw; |
| 433 | } |
| 434 | |
| 435 | @Override |
| 436 | public ISwitchObject searchSwitch(String dpid) { |
| 437 | for(ISwitchObject sw : switches) { |
| 438 | if(sw.getDPID().equals(dpid)) { |
| 439 | return sw; |
| 440 | } |
| 441 | } |
| 442 | return null; |
| 443 | } |
| 444 | |
| 445 | @Override |
| 446 | public ISwitchObject searchActiveSwitch(String dpid) { |
| 447 | for(ISwitchObject sw : switches) { |
| 448 | if(sw.getDPID().equals(dpid) && sw.getState().equals("ACTIVE")) { |
| 449 | return sw; |
| 450 | } |
| 451 | } |
| 452 | return null; |
| 453 | } |
| 454 | |
| 455 | @Override |
| 456 | public Iterable<ISwitchObject> getActiveSwitches() { |
| 457 | List<ISwitchObject> list = new ArrayList<ISwitchObject>(); |
| 458 | |
| 459 | for(ISwitchObject sw : switches) { |
| 460 | if(sw.getState().equals("ACTIVE")) { |
| 461 | list.add(sw); |
| 462 | } |
| 463 | } |
| 464 | return list.isEmpty() ? null : list; |
| 465 | } |
| 466 | |
| 467 | @Override |
| 468 | public Iterable<ISwitchObject> getAllSwitches() { |
| 469 | List<ISwitchObject> list = new ArrayList<ISwitchObject>(); |
| 470 | |
| 471 | for(ISwitchObject sw : switches) { |
| 472 | list.add(sw); |
| 473 | } |
| 474 | |
| 475 | return list.isEmpty() ? null : list; |
| 476 | } |
| 477 | |
| 478 | @Override |
| 479 | public Iterable<ISwitchObject> getInactiveSwitches() { |
| 480 | List<ISwitchObject> list = new ArrayList<ISwitchObject>(); |
| 481 | |
| 482 | for(ISwitchObject sw : switches) { |
| 483 | if(! sw.getState().equals("ACTIVE")) { |
| 484 | list.add(sw); |
| 485 | } |
| 486 | } |
| 487 | return list.isEmpty() ? null : list; |
| 488 | } |
| 489 | |
| 490 | @Override |
| 491 | public Iterable<IFlowEntry> getAllSwitchNotUpdatedFlowEntries() { |
| 492 | // TODO Auto-generated method stub |
| 493 | return null; |
| 494 | } |
| 495 | |
| 496 | @Override |
| 497 | public void removeSwitch(ISwitchObject sw) { |
| 498 | if(switches.contains(sw)) { |
| 499 | switchesToRemove.add((TestSwitchObject)sw); |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | @Override |
| 504 | public IPortObject newPort(Short portNumber) { |
| 505 | TestPortObject port = new TestPortObject(); |
| 506 | port.setNumber(portNumber); |
| 507 | |
| 508 | return port; |
| 509 | } |
| 510 | |
| 511 | public IPortObject newPort(Long dpid, Short portNumber) { |
| 512 | TestPortObject port = null; |
| 513 | TestSwitchObject sw = (TestSwitchObject)searchSwitch(HexString.toHexString(dpid)); |
| 514 | |
| 515 | if(sw != null) { |
| 516 | port = (TestPortObject)newPort(portNumber); |
| 517 | portsToAdd.add(port); |
| 518 | sw.addPort(port); |
| 519 | } |
| 520 | |
| 521 | return port; |
| 522 | } |
| 523 | |
| 524 | @Override |
| 525 | public IPortObject searchPort(String dpid_str, short number) { |
| 526 | for(TestSwitchObject sw : switches) { |
| 527 | if(sw.getDPID().equals(dpid_str)) { |
| 528 | for(IPortObject port : sw.getPorts()) { |
| 529 | if(port.getNumber().equals(number)) { |
| 530 | return port; |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | } |
| 535 | return null; |
| 536 | } |
| 537 | |
| 538 | @Override |
| 539 | public void removePort(IPortObject port) { |
| 540 | for(TestSwitchObject sw : switches) { |
| 541 | for(IPortObject pt : sw.getPorts()) { |
| 542 | if(pt.equals(port)) { |
| 543 | sw.removePort(port); |
| 544 | } |
| 545 | } |
| 546 | } |
| 547 | portsToRemove.add((TestPortObject)port); |
| 548 | } |
| 549 | |
| 550 | @Override |
| 551 | public IDeviceObject newDevice() { |
| 552 | // TODO Auto-generated method stub |
| 553 | return null; |
| 554 | } |
| 555 | |
| 556 | @Override |
| 557 | public IDeviceObject searchDevice(String macAddr) { |
| 558 | // TODO Auto-generated method stub |
| 559 | return null; |
| 560 | } |
| 561 | |
| 562 | @Override |
| 563 | public Iterable<IDeviceObject> getDevices() { |
| 564 | // TODO Auto-generated method stub |
| 565 | return null; |
| 566 | } |
| 567 | |
| 568 | @Override |
| 569 | public void removeDevice(IDeviceObject dev) { |
| 570 | // TODO Auto-generated method stub |
| 571 | |
| 572 | } |
| 573 | |
| 574 | @Override |
| 575 | public IFlowPath newFlowPath() { |
| 576 | // TODO Auto-generated method stub |
| 577 | return null; |
| 578 | } |
| 579 | |
| 580 | @Override |
| 581 | public IFlowPath searchFlowPath(FlowId flowId) { |
| 582 | // TODO Auto-generated method stub |
| 583 | return null; |
| 584 | } |
| 585 | |
| 586 | @Override |
| 587 | public IFlowPath getFlowPathByFlowEntry(IFlowEntry flowEntry) { |
| 588 | // TODO Auto-generated method stub |
| 589 | return null; |
| 590 | } |
| 591 | |
| 592 | @Override |
| 593 | public Iterable<IFlowPath> getAllFlowPaths() { |
| 594 | // TODO Auto-generated method stub |
| 595 | return null; |
| 596 | } |
| 597 | |
| 598 | @Override |
| 599 | public void removeFlowPath(IFlowPath flowPath) { |
| 600 | // TODO Auto-generated method stub |
| 601 | |
| 602 | } |
| 603 | |
| 604 | @Override |
| 605 | public IFlowEntry newFlowEntry() { |
| 606 | // TODO Auto-generated method stub |
| 607 | return null; |
| 608 | } |
| 609 | |
| 610 | @Override |
| 611 | public IFlowEntry searchFlowEntry(FlowEntryId flowEntryId) { |
| 612 | // TODO Auto-generated method stub |
| 613 | return null; |
| 614 | } |
| 615 | |
| 616 | @Override |
| 617 | public Iterable<IFlowEntry> getAllFlowEntries() { |
| 618 | // TODO Auto-generated method stub |
| 619 | return null; |
| 620 | } |
| 621 | |
| 622 | @Override |
| 623 | public void removeFlowEntry(IFlowEntry flowEntry) { |
| 624 | // TODO Auto-generated method stub |
| 625 | |
| 626 | } |
| 627 | |
| 628 | @Override |
| 629 | public IDBConnection getDBConnection() { |
| 630 | return super.getDBConnection(); |
| 631 | } |
| 632 | |
| 633 | @Override |
| 634 | public void commit() { |
| 635 | for(TestSwitchObject sw : switchesToAdd) { |
| 636 | switches.add(sw); |
| 637 | } |
| 638 | for(TestSwitchObject sw : switchesToRemove) { |
| 639 | sw.commit(); |
| 640 | switches.remove(sw); |
| 641 | } |
| 642 | for(TestSwitchObject sw : switches) { |
| 643 | sw.commit(); |
| 644 | } |
| 645 | |
| 646 | for(TestPortObject port : portsToAdd) { |
| 647 | ports.add(port); |
| 648 | } |
| 649 | for(TestPortObject port : portsToRemove) { |
| 650 | port.commit(); |
| 651 | ports.remove(port); |
| 652 | } |
| 653 | for(TestPortObject port : ports) { |
| 654 | port.commit(); |
| 655 | } |
| 656 | |
| 657 | clear(); |
| 658 | } |
| 659 | |
| 660 | @Override |
| 661 | public void rollback() { |
| 662 | clear(); |
| 663 | } |
| 664 | |
| 665 | @Override |
| 666 | public void close() { |
| 667 | // TODO Auto-generated method stub |
| 668 | |
| 669 | } |
| 670 | } |