Andrea Campanella
Committed by Gerrit Code Review

ONOS-3786 deletePort from specific bridge method and correct bridge name retrivi…

…al call in old add and delete ports of OsvdbBridgeConfig

Change-Id: Ib23b90f7793f3afc5d62250b9f1f318b8042ad77
......@@ -71,6 +71,7 @@ public interface BridgeConfig extends HandlerBehaviour {
/**
* Add a logical/virtual port.
* @deprecated version 1.5.0 - Falcon.
*
* @param port port number
*/
......@@ -87,12 +88,22 @@ public interface BridgeConfig extends HandlerBehaviour {
/**
* Delete a logical/virtual port.
* @deprecated version 1.5.0 - Falcon.
*
* @param port port number
*/
@Deprecated
void deletePort(PortDescription port);
/**
* Removes a port from a given bridge.
*
* @param bridgeName bridge name
* @param portName port name
*/
void deletePort(BridgeName bridgeName, String portName);
/**
* Delete a logical/virtual port.
*
* @return collection of port
......
......@@ -16,6 +16,7 @@
package org.onosproject.drivers.ovsdb;
import org.onlab.packet.IpAddress;
import org.onosproject.net.DefaultAnnotations;
import org.onosproject.net.DeviceId;
......@@ -41,6 +42,7 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* The implementation of BridageConfig.
*/
......@@ -92,6 +94,8 @@ public class OvsdbBridgeConfig extends AbstractHandlerBehaviour
.collect(Collectors.toSet());
}
//Deprecated from version 1.5.0 - Falcon
@Deprecated
@Override
public void addPort(PortDescription port) {
DriverHandler handler = handler();
......@@ -99,7 +103,7 @@ public class OvsdbBridgeConfig extends AbstractHandlerBehaviour
Set<OvsdbBridge> ovsdbSet = clientService.getBridges();
if (ovsdbSet != null && ovsdbSet.size() > 0) {
OvsdbBridge bridge = ovsdbSet.iterator().next();
clientService.createPort(bridge.bridgeName().toString(), port
clientService.createPort(bridge.bridgeName().value(), port
.portNumber().toString());
}
}
......@@ -111,6 +115,8 @@ public class OvsdbBridgeConfig extends AbstractHandlerBehaviour
clientService.createPort(bridgeName.name(), portName);
}
//Deprecated from version 1.5.0 - Falcon
@Deprecated
@Override
public void deletePort(PortDescription port) {
DriverHandler handler = handler();
......@@ -118,12 +124,19 @@ public class OvsdbBridgeConfig extends AbstractHandlerBehaviour
Set<OvsdbBridge> ovsdbSet = clientService.getBridges();
if (ovsdbSet != null && ovsdbSet.size() > 0) {
OvsdbBridge bridge = ovsdbSet.iterator().next();
clientService.dropPort(bridge.bridgeName().toString(), port
clientService.dropPort(bridge.bridgeName().value(), port
.portNumber().toString());
}
}
@Override
public void deletePort(BridgeName bridgeName, String portName) {
DriverHandler handler = handler();
OvsdbClientService clientService = getOvsdbClientService(handler);
clientService.dropPort(bridgeName.name(), portName);
}
@Override
public Collection<PortDescription> getPorts() {
DriverHandler handler = handler();
OvsdbClientService clientService = getOvsdbClientService(handler);
......