CNlucius
Committed by Gerrit Code Review

ONOS-2161 Add OVSDB adapter api in south bound.

Change-Id: I01e2976769b225444ab6fb94cb2fe9d26921ba1f
Showing 21 changed files with 1277 additions and 0 deletions
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos-ovsdb</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
<artifactId>onos-ovsdb-api</artifactId>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${netty4.version}</version>
</dependency>
</dependencies>
</project>
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
/**
* Represents for a entity that carry important information for listener.
*/
public interface EventSubject {
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* The class representing a ovsdb bridge. This class is immutable.
*/
public final class OvsdbBridge {
private final OvsdbBridgeName bridgeName;
private final OvsdbDatapathId datapathId;
/**
* Constructor from a OvsdbBridgeName bridgeName and a OvsdbDatapathId
* datapathId.
*
* @param bridgeName the bridgeName to use
* @param datapathId the datapathId to use
*/
public OvsdbBridge(OvsdbBridgeName bridgeName, OvsdbDatapathId datapathId) {
checkNotNull(bridgeName, "bridgeName is not null");
checkNotNull(datapathId, "datapathId is not null");
this.bridgeName = bridgeName;
this.datapathId = datapathId;
}
/**
* Gets the bridge name of the bridge.
*
* @return the bridge name of the bridge
*/
public OvsdbBridgeName bridgeName() {
return bridgeName;
}
/**
* Gets the datapathId of the bridge.
*
* @return datapathId the datapathId to use
*/
public OvsdbDatapathId datapathId() {
return datapathId;
}
@Override
public int hashCode() {
return Objects.hash(bridgeName, datapathId);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbBridge) {
final OvsdbBridge otherOvsdbBridge = (OvsdbBridge) obj;
return Objects.equals(this.bridgeName, otherOvsdbBridge.bridgeName)
&& Objects.equals(this.datapathId,
otherOvsdbBridge.datapathId);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("bridgeName", bridgeName.value())
.add("datapathId", datapathId.value()).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* The class representing a bridge name. This class is immutable.
*/
public final class OvsdbBridgeName {
private final String value;
/**
* Constructor from a String bridge name.
*
* @param value the bridge name to use
*/
public OvsdbBridgeName(String value) {
checkNotNull(value, "value is not null");
this.value = value;
}
/**
* Gets the value of the bridge name.
*
* @return the value of the bridge name
*/
public String value() {
return value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbBridgeName) {
final OvsdbBridgeName otherBridgeName = (OvsdbBridgeName) obj;
return Objects.equals(this.value, otherBridgeName.value);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("value", value).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import java.util.Set;
import org.onlab.packet.IpAddress;
/**
* Represents to provider facing side of a node.
*/
public interface OvsdbClientService {
/**
* Gets the node identifier.
*
* @return node identifier
*/
OvsdbNodeId nodeId();
/**
* Creates the configuration for the tunnel.
*
* @param srcIp source IP address
* @param dstIp destination IP address
*/
void createTunnel(IpAddress srcIp, IpAddress dstIp);
/**
* Drops the configuration for the tunnel.
*
* @param srcIp source IP address
* @param dstIp destination IP address
*/
void dropTunnel(IpAddress srcIp, IpAddress dstIp);
/**
* Gets tunnels of the node.
*
* @return set of tunnels; empty if no tunnel is find
*/
Set<OvsdbTunnel> getTunnels();
/**
* Creates a bridge.
*
* @param bridgeName bridge name
*/
void createBridge(String bridgeName);
/**
* Drops a bridge.
*
* @param bridgeName bridge name
*/
void dropBridge(String bridgeName);
/**
* Gets bridges of the node.
*
* @return set of bridges; empty if no bridge is find
*/
Set<OvsdbBridge> getBridges();
/**
* Creates a port.
*
* @param bridgeName bridge name
* @param portName port name
*/
void createPort(String bridgeName, String portName);
/**
* Drops a port.
*
* @param bridgeName bridge name
* @param portName port name
*/
void dropPort(String bridgeName, String portName);
/**
* Gets ports of the bridge.
*
* @return set of ports; empty if no ports is find
*/
Set<OvsdbPort> getPorts();
/**
* Checks if the node is still connected.
*
* @return true if the node is still connected
*/
boolean isConnected();
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import java.util.List;
/**
* Abstraction of an ovsdb controller. Serves as a one stop shop for obtaining
* OvsdbNode and (un)register listeners on ovsdb events and ovsdb node events.
*/
public interface OvsdbController {
/**
* Adds Node Event Listener.
*
* @param listener node listener
*/
void addNodeListener(OvsdbNodeListener listener);
/**
* Removes Node Event Listener.
*
* @param listener node listener
*/
void removeNodeListener(OvsdbNodeListener listener);
/**
* Adds ovsdb event listener.
*
* @param listener event listener
*/
void addOvsdbEventListener(OvsdbEventListener listener);
/**
* Removes ovsdb event listener.
*
* @param listener event listener
*/
void removeOvsdbEventListener(OvsdbEventListener listener);
/**
* Gets all the nodes information.
*
* @return the list of node id
*/
List<OvsdbNodeId> getNodeIds();
/**
* Gets a ovsdb client by node identifier.
*
* @param nodeId node identifier
* @return OvsdbClient ovsdb node information
*/
OvsdbClientService getOvsdbClient(OvsdbNodeId nodeId);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* The class representing a datapathid. This class is immutable.
*/
public final class OvsdbDatapathId {
private final String value;
/**
* Constructor from a String datapathid.
*
* @param value the datapathid to use
*/
public OvsdbDatapathId(String value) {
checkNotNull(value, "value is not null");
this.value = value;
}
/**
* Gets the value of the datapathid.
*
* @return the value of the datapathid
*/
public String value() {
return value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbDatapathId) {
final OvsdbDatapathId otherDatapathId = (OvsdbDatapathId) obj;
return Objects.equals(this.value, otherDatapathId.value);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("value", value).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
/**
* The abstract event of ovsdb.
*/
public final class OvsdbEvent<S> {
public enum Type {
/**
* Signifies that a new ovs port update has been detected.
*/
PORT_ADDED,
/**
* Signifies that a ovs port has been removed.
*/
PORT_REMOVED
}
private final Type type;
private final S subject;
/**
* Creates an event of a given type and for the specified event subject.
*
* @param type event type
* @param subject event subject
*/
public OvsdbEvent(Type type, S subject) {
this.type = type;
this.subject = subject;
}
/**
* Returns the type of the event.
*
* @return event type
*/
public Type type() {
return type;
}
/**
* Returns the subject of the event.
*
* @return subject to which this event pertains
*/
public S subject() {
return subject;
}
@Override
public String toString() {
return toStringHelper(this).add("type", type())
.add("subject", subject()).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
/**
* Allows for providers interested in ovsdb events to be notified.
*/
public interface OvsdbEventListener {
/**
* Handles the ovsdb event.
*
* @param event ovsdb event
*/
void handle(OvsdbEvent<EventSubject> event);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* The class representing a OpenStack Compute or Network nodeId. This class is
* immutable.
*/
public final class OvsdbNodeId {
private static final String SCHEME = "ovsdb";
private final String nodeId;
private final String ipAddress;
/**
* Creates a new node identifier from a IpAddress ipAddress, a long port.
*
* @param ipAddress node IP address
* @param port node port
*/
public OvsdbNodeId(IpAddress ipAddress, long port) {
checkNotNull(ipAddress, "ipAddress is not null");
this.ipAddress = ipAddress.toString();
this.nodeId = ipAddress + ":" + port;
}
@Override
public int hashCode() {
return Objects.hash(nodeId);
}
@Override
public boolean equals(Object other) {
if (!(other instanceof OvsdbNodeId)) {
return false;
}
OvsdbNodeId otherNodeId = (OvsdbNodeId) other;
return Objects.equals(otherNodeId.nodeId, this.nodeId);
}
@Override
public String toString() {
return SCHEME + ":" + nodeId;
}
/**
* Gets the value of the NodeId.
*
* @return the value of the NodeId.
*/
public String nodeId() {
return SCHEME + ":" + nodeId;
}
/**
* Get the IP address of the node.
*
* @return the IP address of the node
*/
public String getIpAddress() {
return ipAddress;
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
/**
* Allows for providers interested in node events to be notified.
*/
public interface OvsdbNodeListener {
/**
* Notifies that the node was added.
*
* @param nodeId the node where the event occurred
*/
void nodeAdded(OvsdbNodeId nodeId);
/**
* Notifies that the node was removed.
*
* @param nodeId the node where the event occurred
*/
void nodeRemoved(OvsdbNodeId nodeId);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* The class representing a ovsdb port. This class is immutable.
*/
public final class OvsdbPort {
private final OvsdbPortNumber portNumber;
private final OvsdbPortName portName;
/**
* Constructor from a OvsdbPortNumber portNumber, OvsdbPortName portName.
*
* @param portNumber the portNumber to use
* @param portName the portName to use
*/
public OvsdbPort(OvsdbPortNumber portNumber, OvsdbPortName portName) {
checkNotNull(portNumber, "portNumber is not null");
checkNotNull(portName, "portName is not null");
this.portNumber = portNumber;
this.portName = portName;
}
/**
* Gets the port number of the port.
*
* @return the port number of the port
*/
public OvsdbPortNumber portNumber() {
return portNumber;
}
/**
* Gets the port name of the port.
*
* @return the port name of the port
*/
public OvsdbPortName portName() {
return portName;
}
@Override
public int hashCode() {
return Objects.hash(portNumber, portName);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbPort) {
final OvsdbPort otherOvsdbPort = (OvsdbPort) obj;
return Objects.equals(this.portNumber, otherOvsdbPort.portNumber)
&& Objects.equals(this.portName, otherOvsdbPort.portName);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this)
.add("portNumber", String.valueOf(portNumber.value()))
.add("portName", portName.value()).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* The class representing a port number. This class is immutable.
*/
public final class OvsdbPortName {
private final String value;
/**
* Constructor from a String port name.
*
* @param value the port name to use
*/
public OvsdbPortName(String value) {
checkNotNull(value, "value is not null");
this.value = value;
}
/**
* Gets the value of the port name.
*
* @return the value of the port name
*/
public String value() {
return value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbPortName) {
final OvsdbPortName otherOvsdbPortName = (OvsdbPortName) obj;
return Objects.equals(this.value, otherOvsdbPortName.value);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("value", value).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
* The class representing a port number. This class is immutable.
*/
public final class OvsdbPortNumber {
private final long value;
/**
* Constructor from a long port number.
*
* @param value the port number to use
*/
public OvsdbPortNumber(long value) {
this.value = value;
}
/**
* Gets the value of the port number.
*
* @return the value of the port number
*/
public long value() {
return value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbPortNumber) {
final OvsdbPortNumber ovsdbPortNumber = (OvsdbPortNumber) obj;
return Objects.equals(this.value, ovsdbPortNumber.value);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("value", value).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
import org.onlab.packet.IpAddress;
/**
* The class representing a ovsdb tunnel. This class is immutable.
*/
public final class OvsdbTunnel {
private final IpAddress localIp;
private final IpAddress remoteIp;
public enum Type {
VXLAN, GRE
}
private final Type tunnelType;
private final OvsdbTunnelName tunnelName;
/**
* Constructor from a IpAddress localIp, IpAddress remoteIp Type tunnelType,
* OvsdbTunnelName tunnelName.
*
* @param localIp the localIp to use
* @param remoteIp the remoteIp to use
* @param tunnelType the tunnelType to use
* @param tunnelName the tunnelName to use
*/
public OvsdbTunnel(IpAddress localIp, IpAddress remoteIp, Type tunnelType,
OvsdbTunnelName tunnelName) {
checkNotNull(localIp, "portName is not null");
checkNotNull(remoteIp, "portName is not null");
checkNotNull(tunnelName, "portName is not null");
this.localIp = localIp;
this.remoteIp = remoteIp;
this.tunnelType = tunnelType;
this.tunnelName = tunnelName;
}
/**
* Gets the local IP of the tunnel.
*
* @return the local IP of the tunnel
*/
public IpAddress localIp() {
return localIp;
}
/**
* Gets the remote IP of the tunnel.
*
* @return the remote IP of the tunnel
*/
public IpAddress remoteIp() {
return remoteIp;
}
/**
* Gets the tunnel type of the tunnel.
*
* @return the tunnel type of the tunnel
*/
public Type tunnelType() {
return tunnelType;
}
/**
* Gets the tunnel name of the tunnel.
*
* @return the tunnel name of the tunnel
*/
public OvsdbTunnelName tunnelName() {
return tunnelName;
}
@Override
public int hashCode() {
return Objects.hash(localIp, remoteIp, tunnelType, tunnelName);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbTunnel) {
final OvsdbTunnel otherOvsdbTunnel = (OvsdbTunnel) obj;
return Objects.equals(this.localIp, otherOvsdbTunnel.localIp)
&& Objects.equals(this.remoteIp, otherOvsdbTunnel.remoteIp)
&& Objects.equals(this.tunnelType,
otherOvsdbTunnel.tunnelType)
&& Objects.equals(this.tunnelName,
otherOvsdbTunnel.tunnelName);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("localIp", localIp.toString())
.add("remoteIp", remoteIp.toString())
.add("tunnelType", tunnelType).add("tunnelName", tunnelName)
.toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Objects;
/**
* The class representing a tunnel name. This class is immutable.
*/
public final class OvsdbTunnelName {
private final String value;
/**
* Constructor from a String tunnel name.
*
* @param value the tunnel name to use
*/
public OvsdbTunnelName(String value) {
checkNotNull(value, "value is not null");
this.value = value;
}
/**
* Gets the value of the tunnel name.
*
* @return the value of the tunnel name
*/
public String value() {
return value;
}
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof OvsdbTunnelName) {
final OvsdbTunnelName otherOvsdbTunnelName = (OvsdbTunnelName) obj;
return Objects.equals(this.value, otherOvsdbTunnelName.value);
}
return false;
}
@Override
public String toString() {
return toStringHelper(this).add("value", value).toString();
}
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller.driver;
import org.onosproject.ovsdb.controller.OvsdbNodeId;
import org.onosproject.ovsdb.controller.OvsdbClientService;
/**
* Responsible for keeping track of the current set of nodes connected to the
* system.
*/
public interface OvsdbAgent {
/**
* Add a node that has just connected to the system.
*
* @param nodeId the nodeId to add
* @param ovsdbClient the actual node object.
*/
void addConnectedNode(OvsdbNodeId nodeId, OvsdbClientService ovsdbClient);
/**
* Clear all state in controller node maps for a node that has disconnected
* from the local controller. Also release control for that node from the
* global repository. Notify node listeners.
*
* @param nodeId the node id to be removed.
*/
void removeConnectedNode(OvsdbNodeId nodeId);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ovsdb.controller.driver;
import io.netty.channel.Channel;
/**
* Represents the driver side of an ovsdb node. This interface should never be
* exposed to consumers.
*/
public interface OvsdbProviderService {
/**
* Sets the ovsdb agent to be used. This method can only be called once.
*
* @param agent the agent to set.
*/
void setAgent(OvsdbAgent agent);
/**
* Sets the associated Netty channel for this node.
*
* @param channel the Netty channel
*/
void setChannel(Channel channel);
/**
* Announces to the ovsdb agent that this node has added.
*/
void nodeAdded();
/**
* Announces to the ovsdb agent that this node has removed.
*/
void nodeRemoved();
/**
* Sets whether the node is connected.
*
* @param connected whether the node is connected
*/
void setConnection(boolean connected);
}
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Ovsdb controller node driver API.
*/
package org.onosproject.ovsdb.controller.driver;
\ No newline at end of file
/*
* Copyright 2015 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Ovsdb controller API.
*/
package org.onosproject.ovsdb.controller;
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onosproject</groupId>
<artifactId>onos</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
<artifactId>onos-ovsdb</artifactId>
<name>onos-ovsdb</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-misc</artifactId>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-junit</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
</plugin>
</plugins>
</build>
<modules>
<module>api</module>
</modules>
</project>
\ No newline at end of file