2 * Copyright (C) 2013 Red Hat, Inc.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 * Authors : Madhu Venugopal, Brent Salisbury
10 package org.opendaylight.ovsdb.plugin;
12 import org.opendaylight.controller.sal.core.ConstructionException;
13 import org.opendaylight.controller.sal.core.Node;
14 import org.opendaylight.ovsdb.lib.OvsdbClient;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 public class Connection {
20 private String identifier;
21 private OvsdbClient client;
23 public Long getIdCounter() {
27 public void setIdCounter(Long idCounter) {
28 this.idCounter = idCounter;
31 private Long idCounter;
33 private static final Logger logger = LoggerFactory.getLogger(Connection.class);
35 public Connection(String identifier, OvsdbClient client) {
39 this.identifier = identifier;
43 node = new Node("OVS", identifier);
44 } catch (ConstructionException e) {
45 logger.error("Error creating OVS node with identifier " + identifier, e);
49 public String getIdentifier() {
53 public void setIdentifier(String identifier) {
54 this.identifier = identifier;
57 public OvsdbClient getClient() {
61 public void setClient(OvsdbClient client) {
65 public Node getNode() {
69 public void setNode(Node node) {
73 public void disconnect() {
78 public int hashCode() {
81 result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
86 public boolean equals(Object obj) {
87 if (this == obj) return true;
88 if (obj == null) return false;
89 if (getClass() != obj.getClass()) return false;
90 Connection other = (Connection) obj;
91 if (identifier == null) {
92 if (other.identifier != null) return false;
93 } else if (!identifier.equals(other.identifier)) return false;