import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.OvsdbConnection;
import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
public abstract class OvsdbIntegrationTestBase {
protected final static String IDENTIFIER = "TEST";
String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
String connectionType = props.getProperty(CONNECTION_TYPE, "active");
- IConnectionServiceInternal connection = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+ OvsdbConnectionService
+ connection = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
// If the connection type is active, controller connects to the ovsdb-server
if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
if (addressStr == null) {
@Override
public OvsdbClient call() throws Exception {
OvsdbConnection connection = (OvsdbConnection)ServiceHelper.getGlobalInstance(OvsdbConnection.class, this);
- connection.registerForPassiveConnection(this);
+ connection.registerConnectionListener(this);
while (client == null) {
Thread.sleep(500);
}
import org.opendaylight.ovsdb.lib.notation.Version;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
private BundleContext bc;
@Inject
- private OvsdbConfigService ovsdbConfigService;
+ private OvsdbConfigurationService ovsdbConfigurationService;
private Node node = null;
Component of10Provider;
@Inject
BridgeConfigurationManager bridgeConfigurationManager;
@Inject
- ConfigurationService configurationService;
+ org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService netVirtConfigurationService;
Boolean tearDownBridge = false;
Map<String, Row>
bridgeRows =
- ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
Assert.assertEquals(1, bridgeRows.size());
- Bridge bridgeRow = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRows.values().iterator().next());
- Assert.assertEquals(configurationService.getIntegrationBridgeName(), bridgeRow.getName());
+ Bridge bridgeRow = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRows.values().iterator().next());
+ Assert.assertEquals(netVirtConfigurationService.getIntegrationBridgeName(), bridgeRow.getName());
- String uuid = bridgeConfigurationManager.getBridgeUuid(node, configurationService.getIntegrationBridgeName());
+ String uuid = bridgeConfigurationManager.getBridgeUuid(node, netVirtConfigurationService.getIntegrationBridgeName());
Assert.assertEquals(uuid, bridgeRow.getUuid().toString());
tearDownBridge = true;
final String endpointAddress = "10.10.10.10";
- Map<String, Row> ovsRows = ovsdbConfigService.getRows(node,
- ovsdbConfigService.getTableName(node, OpenVSwitch.class));
- OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node,
+ Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
+ ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
+ OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node,
OpenVSwitch.class,
ovsRows.values().iterator().next());
- Assert.assertEquals(null, configurationService.getTunnelEndPoint(node));
+ Assert.assertEquals(null, netVirtConfigurationService.getTunnelEndPoint(node));
- ovsRow.setOtherConfig(ImmutableMap.of(configurationService.getTunnelEndpointKey(), endpointAddress));
- ovsdbConfigService.updateRow(node,
- ovsdbConfigService.getTableName(node, OpenVSwitch.class),
- null,
- ovsRow.getUuid().toString(),
- ovsRow.getRow());
+ ovsRow.setOtherConfig(ImmutableMap.of(netVirtConfigurationService.getTunnelEndpointKey(), endpointAddress));
+ ovsdbConfigurationService.updateRow(node,
+ ovsdbConfigurationService.getTableName(node, OpenVSwitch.class),
+ null,
+ ovsRow.getUuid().toString(),
+ ovsRow.getRow());
- Assert.assertEquals(InetAddress.getByName(endpointAddress), configurationService.getTunnelEndPoint(node));
+ Assert.assertEquals(InetAddress.getByName(endpointAddress), netVirtConfigurationService.getTunnelEndPoint(node));
}
@Test
Version ovsVersion = this.getOvsVersion();
if (ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) < 0) {
- Assert.assertEquals(Constants.OPENFLOW10, configurationService.getOpenflowVersion(node));
+ Assert.assertEquals(Constants.OPENFLOW10, netVirtConfigurationService.getOpenflowVersion(node));
} else {
- Assert.assertEquals(Constants.OPENFLOW13, configurationService.getOpenflowVersion(node));
+ Assert.assertEquals(Constants.OPENFLOW13, netVirtConfigurationService.getOpenflowVersion(node));
}
}
if (tearDownBridge) {
String uuid = bridgeConfigurationManager.getBridgeUuid(node,
- configurationService.getIntegrationBridgeName());
- ovsdbConfigService.deleteRow(node, ovsdbConfigService.getTableName(node, Bridge.class), uuid);
+ netVirtConfigurationService.getIntegrationBridgeName());
+ ovsdbConfigurationService.deleteRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), uuid);
tearDownBridge = false;
}
}
private Version getOvsVersion(){
- Map<String, Row> ovsRows = ovsdbConfigService.getRows(node,
- ovsdbConfigService.getTableName(node, OpenVSwitch.class));
- OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node,
+ Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
+ ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
+ OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node,
OpenVSwitch.class,
ovsRows.values().iterator().next());
return Version.fromString(ovsRow.getOvsVersionColumn().getData().iterator().next());
import org.opendaylight.ovsdb.lib.OvsdbClient;
import org.opendaylight.ovsdb.lib.OvsdbConnectionInfo;
import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.InventoryServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.Connection;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
private Logger log = LoggerFactory.getLogger(OvsdbPluginIT.class);
@Inject
private BundleContext bc;
- private OvsdbConfigService ovsdbConfigService = null;
+ private OvsdbConfigurationService ovsdbConfigurationService = null;
@Inject
- private InventoryServiceInternal inventoryService;
+ private OvsdbInventoryService ovsdbInventoryService;
private Node node = null;
private OvsdbClient client = null;
} catch (Exception e) {
fail("Exception : "+e.getMessage());
}
- this.ovsdbConfigService = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class, this);
+ this.ovsdbConfigurationService = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class, this);
}
@Test
public void apiTests() throws Exception {
Thread.sleep(5000);
- IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+ OvsdbConnectionService
+ connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
// Check for the ovsdb Connection as seen by the Plugin layer
assertNotNull(connectionService.getNodes());
if (connectionInfo.getType().equals(OvsdbConnectionInfo.ConnectionType.PASSIVE)) {
identifier = connectionInfo.getRemoteAddress().getHostAddress()+":"+connectionInfo.getRemotePort();
}
- assertEquals(Node.fromString("OVS|"+identifier), connectionService.getNodes().get(0));
+ assertEquals(Node.fromString("OVS|" + identifier), connectionService.getNodes().get(0));
System.out.println("Nodes = "+ connectionService.getNodes());
/*
* Test sequence :
Node newNode = Node.fromString("OVS:10.10.10.10:65342");
// Trigger event
- inventoryService.notifyNodeAdded(newNode);
+ ovsdbInventoryService.notifyNodeAdded(newNode);
Mockito.verify(listenerA, Mockito.times(1)).nodeAdded(newNode);
Mockito.verify(listenerB, Mockito.times(1)).nodeAdded(newNode);
// 3. Assert to make sure the bridge is created with a valid Uuid.
printCache();
Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
- Row bridgeRow = ovsdbConfigService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
+ Row bridgeRow = ovsdbConfigurationService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
assertNotNull(bridgeRow);
bridge = connection.getClient().getTypedRowWrapper(Bridge.class, bridgeRow);
assertEquals(bridge.getUuid(), status.getUuid());
// 4. Delete the bridge & Assert to make sure the return status is success.
- Status delStatus = ovsdbConfigService.deleteRow(node, bridge.getSchema().getName(), status.getUuid().toString());
+ Status delStatus = ovsdbConfigurationService.deleteRow(node, bridge.getSchema().getName(), status.getUuid().toString());
assertTrue(delStatus.isSuccess());
Thread.sleep(2000); // TODO : Remove this Sleep once the Select operation is resolved.
// 5. Assert to make sure the bridge is deleted
- bridgeRow = ovsdbConfigService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
+ bridgeRow = ovsdbConfigurationService.getRow(node, bridge.getSchema().getName(), status.getUuid().toString());
assertNull(bridgeRow);
}
bridge.setName("br_test1");
bridge.setStatus(ImmutableMap.of("key", "value"));
bridge.setFloodVlans(Sets.newHashSet(34L));
- return ovsdbConfigService.insertRow(node, bridge.getSchema().getName(), parentUuid, bridge.getRow());
+ return ovsdbConfigurationService.insertRow(node, bridge.getSchema().getName(), parentUuid, bridge.getRow());
}
public String getOpenVSwitchTableUUID(Connection connection) throws Exception {
OpenVSwitch openVSwitch = connection.getClient().getTypedRowWrapper(OpenVSwitch.class, null);
- ConcurrentMap<String, Row> row = ovsdbConfigService.getRows(node, openVSwitch.getSchema().getName());
+ ConcurrentMap<String, Row> row = ovsdbConfigurationService.getRows(node, openVSwitch.getSchema().getName());
if (row == null || row.size() == 0) return null;
return (String)row.keySet().toArray()[0];
}
public void printCache() throws Exception {
- List<String> tables = ovsdbConfigService.getTables(node);
+ List<String> tables = ovsdbConfigurationService.getTables(node);
System.out.println("Tables = "+tables);
assertNotNull(tables);
for (String table : tables) {
System.out.println("Table "+table);
- ConcurrentMap<String,Row> row = ovsdbConfigService.getRows(node, table);
+ ConcurrentMap<String,Row> row = ovsdbConfigurationService.getRows(node, table);
System.out.println(row);
}
}
- public class FakeListener implements OvsdbInventoryListener{
+ public class FakeListener implements OvsdbInventoryListener {
@Override
public void nodeAdded(Node node) {
com.sun.jersey.spi.container.servlet,
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.authorization,
- org.opendaylight.ovsdb.plugin,
+ org.opendaylight.ovsdb.plugin.api,
org.opendaylight.ovsdb.lib,
org.opendaylight.ovsdb.lib.jsonrpc,
org.opendaylight.ovsdb.lib.notation,
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.plugin.Connection;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsVswitchdSchemaConstants;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
throw new UnauthorizedException("User is not authorized to perform this operation");
}
- OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+ OvsdbConfigurationService
+ ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
this);
if (ovsdbTable == null) {
throw new ServiceUnavailableException("OVS Configuration Service " + RestMessages.SERVICEUNAVAILABLE.toString());
}
Node node = Node.fromString(nodeType, nodeId);
- IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
- Connection connection = connectionService.getConnection(node);
- OvsdbClient client = connection.getClient();
+ OvsdbConnectionService
+ connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+ OvsdbClient client = connectionService.getConnection(node).getClient();
OvsdbRow localRow = OvsdbRow.fromJsonNode(client, OvsVswitchdSchemaConstants.DATABASE_NAME, rowJson);
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
return Response.status(Response.Status.BAD_REQUEST).build();
}
- StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, bckCompatibleTableName, localRow.getParentUuid(), localRow.getRow());
+ StatusWithUuid
+ statusWithUuid = ovsdbTable.insertRow(node, bckCompatibleTableName, localRow.getParentUuid(), localRow.getRow());
if (statusWithUuid.isSuccess()) {
UUID uuid = statusWithUuid.getUuid();
throw new UnauthorizedException("User is not authorized to perform this operation");
}
- OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+ OvsdbConfigurationService
+ ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
this);
if (ovsdbTable == null) {
throw new ServiceUnavailableException("UserManager " + RestMessages.SERVICEUNAVAILABLE.toString());
}
Node node = Node.fromString(nodeType, nodeId);
- IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
- Connection connection = connectionService.getConnection(node);
- OvsdbClient client = connection.getClient();
+ OvsdbConnectionService
+ connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+ OvsdbClient client = connectionService.getConnection(node).getClient();
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
Row row = null;
throw new UnauthorizedException("User is not authorized to perform this operation");
}
- OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+ OvsdbConfigurationService
+ ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
this);
if (ovsdbTable == null) {
throw new ServiceUnavailableException("UserManager " + RestMessages.SERVICEUNAVAILABLE.toString());
}
Node node = Node.fromString(nodeType, nodeId);
- IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
- Connection connection = connectionService.getConnection(node);
- OvsdbClient client = connection.getClient();
+ OvsdbConnectionService
+ connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+ OvsdbClient client = connectionService.getConnection(node).getClient();
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
Map<String, Row> rows = null;
try {
throw new UnauthorizedException("User is not authorized to perform this operation");
}
- OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+ OvsdbConfigurationService
+ ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
this);
if (ovsdbTable == null) {
throw new ServiceUnavailableException("OVS Configuration Service " + RestMessages.SERVICEUNAVAILABLE.toString());
}
Node node = Node.fromString(nodeType, nodeId);
- IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
- Connection connection = connectionService.getConnection(node);
- OvsdbClient client = connection.getClient();
+ OvsdbConnectionService
+ connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+ OvsdbClient client = connectionService.getConnection(node).getClient();
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
OvsdbRow localRow = OvsdbRow.fromJsonNode(client, OvsVswitchdSchemaConstants.DATABASE_NAME, rowJson);
throw new UnauthorizedException("User is not authorized to perform this operation");
}
- OvsdbConfigService ovsdbTable = (OvsdbConfigService)ServiceHelper.getGlobalInstance(OvsdbConfigService.class,
+ OvsdbConfigurationService
+ ovsdbTable = (OvsdbConfigurationService)ServiceHelper.getGlobalInstance(OvsdbConfigurationService.class,
this);
if (ovsdbTable == null) {
throw new ServiceUnavailableException("OVS Configuration Service " + RestMessages.SERVICEUNAVAILABLE.toString());
}
Node node = Node.fromString(nodeType, nodeId);
- IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
- Connection connection = connectionService.getConnection(node);
- OvsdbClient client = connection.getClient();
+ OvsdbConnectionService
+ connectionService = (OvsdbConnectionService)ServiceHelper.getGlobalInstance(OvsdbConnectionService.class, this);
+ OvsdbClient client = connectionService.getConnection(node).getClient();
String bckCompatibleTableName = this.getBackwardCompatibleTableName(client, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
Status status = ovsdbTable.deleteRow(node, bckCompatibleTableName, uuid);
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.utils,
org.opendaylight.controller.sal.action,
- org.opendaylight.ovsdb.plugin,
+ org.opendaylight.ovsdb.plugin.api,
org.opendaylight.ovsdb.lib.notation,
org.opendaylight.controller.sal.binding.api,
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819,
import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
import org.opendaylight.controller.switchmanager.ISwitchManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
import org.apache.felix.dm.Component;
c.setInterface(NetworkingProvider.class.getName(), of10Properties);
c.add(createServiceDependency()
- .setService(ConfigurationService.class)
+ .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
.setRequired(true));
c.add(createServiceDependency()
.setService(BridgeConfigurationManager.class)
c.add(createServiceDependency()
.setService(TenantNetworkManager.class)
.setRequired(true));
- c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
- c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
c.add(createServiceDependency().
setService(IForwardingRulesManager.class).
setRequired(true));
c.setInterface(NetworkingProvider.class.getName(), of13Properties);
c.add(createServiceDependency()
- .setService(ConfigurationService.class)
+ .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
.setRequired(true));
c.add(createServiceDependency()
.setService(BridgeConfigurationManager.class)
c.add(createServiceDependency()
.setService(TenantNetworkManager.class)
.setRequired(true));
- c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
- c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
c.add(createServiceDependency().setService(MdsalConsumer.class).setRequired(true));
}
}
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
public static final int LLDP_PRIORITY = 1000;
public static final int NORMAL_PRIORITY = 0;
- private volatile ConfigurationService configurationService;
+ private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
private volatile BridgeConfigurationManager bridgeConfigurationManager;
private volatile TenantNetworkManager tenantNetworkManager;
- private volatile OvsdbConfigService ovsdbConfigService;
- private volatile IConnectionServiceInternal connectionService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
private volatile IForwardingRulesManager forwardingRulesManager;
private volatile ISwitchManager switchManager;
return;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
return;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
return;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
return;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
return;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
return;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brNetId);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brNetId);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
long patchOFPort = -1;
try {
- Map<String, Row> ifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> ifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (ifaces != null) {
for (Row row : ifaces.values()) {
- Interface patchiface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface patchiface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (patchiface.getName().equalsIgnoreCase(patchInt)) {
Set<Long> of_ports = patchiface.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
logger.warn("Could not find port associated with patch interface {} on node {}. No flow rules to program", patchInt, node);
}
for (Row row : ifaces.values()) {
- Interface tuniface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface tuniface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (tuniface.getName().equals(this.getTunnelName(tunnelType, segmentationId, dst))) {
Set<Long> of_ports = tuniface.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
long patchOFPort = -1;
try {
- Map<String, Row> ifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> ifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (ifaces != null) {
for (Row row : ifaces.values()) {
- Interface patchiface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface patchiface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (patchiface.getName().equalsIgnoreCase(patchInt)) {
Set<Long> of_ports = patchiface.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
// return; // keep going; we assume that removal of rules does not really need patchOFPort
}
for (Row row : ifaces.values()) {
- Interface tuniface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface tuniface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (tuniface.getName().equals(this.getTunnelName(tunnelType, segmentationId, dst))) {
Set<Long> of_ports = tuniface.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
public long getOFPort (Node node, String portName) {
long ofPort = -1;
try {
- Map<String, Row> ifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> ifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (ifaces != null) {
for (Row row : ifaces.values()) {
- Interface iface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (iface.getName().equalsIgnoreCase(portName)) {
Set<Long> of_ports = iface.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), brUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), brUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) {
return null;
try {
String portName = getTunnelName(tunnelType, key, dst);
- Map<String, Row> tunifaces = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> tunifaces = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (tunifaces != null) {
for (Row row : tunifaces.values()) {
- Interface tuniface = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface tuniface = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (tuniface.getName().equals(portName)) return tuniface;
}
}
private boolean isTunnelPresent(Node node, String tunnelName, String bridgeUUID) throws Exception {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
if (bridge != null) {
Set<UUID> ports = bridge.getPortsColumn().getData();
for (UUID portUUID : ports) {
- Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
if (port != null && port.getName().equalsIgnoreCase(tunnelName)) return true;
}
}
}
private String getPortUuid(Node node, String portName, String bridgeUUID) throws Exception {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
if (bridge != null) {
Set<UUID> ports = bridge.getPortsColumn().getData();
for (UUID portUUID : ports) {
- Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
if (port != null && port.getName().equalsIgnoreCase(portName)) return portUUID.toString();
}
}
try {
String bridgeUUID = null;
String tunnelBridgeName = configurationService.getNetworkBridgeName();
- Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable != null) {
for (String uuid : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
if (bridge.getName().equals(tunnelBridgeName)) {
bridgeUUID = uuid;
break;
return new Status(StatusCode.SUCCESS);
}
- Port tunnelPort = ovsdbConfigService.createTypedRow(node, Port.class);
+ Port tunnelPort = ovsdbConfigurationService.createTypedRow(node, Port.class);
tunnelPort.setName(portName);
- StatusWithUuid statusWithUuid = ovsdbConfigService.insertRow(node, ovsdbConfigService.getTableName(node, Port.class), bridgeUUID, tunnelPort.getRow());
+ StatusWithUuid statusWithUuid = ovsdbConfigurationService
+ .insertRow(node, ovsdbConfigurationService.getTableName(node, Port.class), bridgeUUID,
+ tunnelPort.getRow());
if (!statusWithUuid.isSuccess()) {
logger.error("Failed to insert Tunnel port {} in {}", portName, bridgeUUID);
return statusWithUuid;
String interfaceUUID = null;
int timeout = 6;
while ((interfaceUUID == null) && (timeout > 0)) {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), tunnelPortUUID);
- tunnelPort = ovsdbConfigService.getTypedRow(node, Port.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), tunnelPortUUID);
+ tunnelPort = ovsdbConfigurationService.getTypedRow(node, Port.class, row);
Set<UUID> interfaces = tunnelPort.getInterfacesColumn().getData();
if (interfaces == null || interfaces.size() == 0) {
// Wait for the OVSDB update to sync up the Local cache.
continue;
}
interfaceUUID = interfaces.toArray()[0].toString();
- Row ifaceRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), interfaceUUID);
- Interface iface = ovsdbConfigService.getTypedRow(node, Interface.class, ifaceRow);
+ Row ifaceRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), interfaceUUID);
+ Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, ifaceRow);
if (iface == null) interfaceUUID = null;
}
return new Status(StatusCode.INTERNALERROR);
}
- Interface tunInterface = ovsdbConfigService.createTypedRow(node, Interface.class);
+ Interface tunInterface = ovsdbConfigurationService.createTypedRow(node, Interface.class);
tunInterface.setType(tunnelType);
Map<String, String> options = Maps.newHashMap();
options.put("key", key);
options.put("local_ip", src.getHostAddress());
options.put("remote_ip", dst.getHostAddress());
tunInterface.setOptions(options);
- Status status = ovsdbConfigService.updateRow(node, ovsdbConfigService.getTableName(node, Interface.class), tunnelPortUUID, interfaceUUID, tunInterface.getRow());
+ Status status = ovsdbConfigurationService
+ .updateRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), tunnelPortUUID,
+ interfaceUUID, tunInterface.getRow());
logger.debug("Tunnel {} add status : {}", tunInterface, status);
return status;
} catch (Exception e) {
private Status deletePort(Node node, String bridgeName, String portName) {
try {
String bridgeUUID = null;
- Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable != null) {
for (String uuid : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
if (bridge.getName().equals(bridgeName)) {
bridgeUUID = uuid;
break;
String portUUID = this.getPortUuid(node, portName, bridgeUUID);
Status status = new Status(StatusCode.SUCCESS);
if (portUUID != null) {
- status = ovsdbConfigService.deleteRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID);
+ status = ovsdbConfigurationService
+ .deleteRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID);
if (!status.isSuccess()) {
logger.error("Failed to delete port {} in {} status : {}", portName, bridgeUUID, status);
return status;
}
try {
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUuid);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUuid);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return;
Long dpidLong = HexEncode.stringToLong((String) dpids.toArray()[0]);
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
private static final short TABLE_2_LOCAL_FORWARD = 20;
private static Long groupId = 1L;
- private volatile ConfigurationService configurationService;
+ private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
private volatile BridgeConfigurationManager bridgeConfigurationManager;
private volatile TenantNetworkManager tenantNetworkManager;
- private volatile OvsdbConfigService ovsdbConfigService;
- private volatile IConnectionServiceInternal connectionService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
private volatile MdsalConsumer mdsalConsumer;
public OF13Provider(){
}
private boolean isTunnelPresent(Node node, String tunnelName, String bridgeUUID) throws Exception {
- Preconditions.checkNotNull(ovsdbConfigService);
- Row bridgeRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
+ Row bridgeRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
if (bridge != null) {
Set<UUID> ports = bridge.getPortsColumn().getData();
for (UUID portUUID : ports) {
- Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
if (port != null && tunnelName.equalsIgnoreCase(port.getName())) return true;
}
}
}
private String getPortUuid(Node node, String name, String bridgeUUID) throws Exception {
- Preconditions.checkNotNull(ovsdbConfigService);
- Row bridgeRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
+ Row bridgeRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
if (bridge != null) {
Set<UUID> ports = bridge.getPortsColumn().getData();
for (UUID portUUID : ports) {
- Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID.toString());
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID.toString());
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
if (port != null && name.equalsIgnoreCase(port.getName())) return portUUID.toString();
}
}
}
private Status addTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
String bridgeUUID = null;
String tunnelBridgeName = configurationService.getIntegrationBridgeName();
- Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable != null) {
for (String uuid : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node,Bridge.class, bridgeTable.get(uuid));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node,Bridge.class, bridgeTable.get(uuid));
if (bridge.getName().equals(tunnelBridgeName)) {
bridgeUUID = uuid;
break;
return new Status(StatusCode.SUCCESS);
}
- Port tunnelPort = ovsdbConfigService.createTypedRow(node, Port.class);
+ Port tunnelPort = ovsdbConfigurationService.createTypedRow(node, Port.class);
tunnelPort.setName(portName);
- StatusWithUuid statusWithUuid = ovsdbConfigService.insertRow(node, ovsdbConfigService.getTableName(node, Port.class), bridgeUUID, tunnelPort.getRow());
+ StatusWithUuid statusWithUuid = ovsdbConfigurationService
+ .insertRow(node, ovsdbConfigurationService.getTableName(node, Port.class), bridgeUUID, tunnelPort.getRow());
if (!statusWithUuid.isSuccess()) {
logger.error("Failed to insert Tunnel port {} in {}", portName, bridgeUUID);
return statusWithUuid;
String interfaceUUID = null;
int timeout = 6;
while ((interfaceUUID == null) && (timeout > 0)) {
- Row portRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Port.class), tunnelPortUUID);
- tunnelPort = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Port.class), tunnelPortUUID);
+ tunnelPort = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
Set<UUID> interfaces = tunnelPort.getInterfacesColumn().getData();
if (interfaces == null || interfaces.size() == 0) {
// Wait for the OVSDB update to sync up the Local cache.
continue;
}
interfaceUUID = interfaces.toArray()[0].toString();
- Row intfRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), interfaceUUID);
- Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, intfRow);
+ Row intfRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), interfaceUUID);
+ Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, intfRow);
if (intf == null) interfaceUUID = null;
}
return new Status(StatusCode.INTERNALERROR);
}
- Interface tunInterface = ovsdbConfigService.createTypedRow(node, Interface.class);
+ Interface tunInterface = ovsdbConfigurationService.createTypedRow(node, Interface.class);
tunInterface.setType(tunnelType);
Map<String, String> options = Maps.newHashMap();
options.put("key", "flow");
options.put("local_ip", src.getHostAddress());
options.put("remote_ip", dst.getHostAddress());
tunInterface.setOptions(options);
- Status status = ovsdbConfigService.updateRow(node, ovsdbConfigService.getTableName(node, Interface.class), tunnelPortUUID, interfaceUUID, tunInterface.getRow());
+ Status status = ovsdbConfigurationService
+ .updateRow(node, ovsdbConfigurationService.getTableName(node, Interface.class), tunnelPortUUID, interfaceUUID, tunInterface.getRow());
logger.debug("Tunnel {} add status : {}", tunInterface, status);
return status;
} catch (Exception e) {
/* delete port from ovsdb port table */
private Status deletePort(Node node, String bridgeName, String portName) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
String bridgeUUID = null;
- Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable != null) {
for (String uuid : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(uuid));
if (bridge.getName().equals(bridgeName)) {
bridgeUUID = uuid;
break;
String portUUID = this.getPortUuid(node, portName, bridgeUUID);
Status status = new Status(StatusCode.SUCCESS);
if (portUUID != null) {
- status = ovsdbConfigService.deleteRow(node, ovsdbConfigService.getTableName(node, Port.class), portUUID);
+ status = ovsdbConfigurationService
+ .deleteRow(node, ovsdbConfigurationService.getTableName(node, Port.class), portUUID);
if (!status.isSuccess()) {
logger.error("Failed to delete port {} in {} status : {}", portName, bridgeUUID,
status);
segmentationId, ethPort, false);
}
private Long getDpid (Node node, String bridgeUuid) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
- Row bridgeRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUuid);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+ Row bridgeRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUuid);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
Set<String> dpids = bridge.getDatapathIdColumn().getData();
if (dpids == null || dpids.size() == 0) return 0L;
return HexEncode.stringToLong((String) dpids.toArray()[0]);
private void programTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
Interface intf, boolean local) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
return;
}
- Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (intfs != null) {
for (Row row : intfs.values()) {
- Interface tunIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface tunIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
of_ports = tunIntf.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
private void removeTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
Interface intf, boolean local, boolean isLastInstanceOnNode) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
Long dpid = this.getIntegrationBridgeOFDPID(node);
return;
}
- Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (intfs != null) {
for (Row row : intfs.values()) {
- Interface tunIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface tunIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
of_ports = tunIntf.getOpenFlowPortColumn().getData();
if (of_ports == null || of_ports.size() <= 0) {
}
private void programVlanRules (NeutronNetwork network, Node node, Interface intf) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
logger.debug("Program vlan rules for interface {}", intf.getName());
try {
return;
}
- Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (intfs != null) {
for (Row row : intfs.values()) {
- Interface ethIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface ethIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (ethIntf.getName().equalsIgnoreCase(bridgeConfigurationManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()))) {
of_ports = ethIntf.getOpenFlowPortColumn().getData();
timeout = 6;
private void removeVlanRules (NeutronNetwork network, Node node,
Interface intf, boolean isLastInstanceOnNode) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
logger.debug("Remove vlan rules for interface {}", intf.getName());
try {
return;
}
- Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (intfs != null) {
for (Row row : intfs.values()) {
- Interface ethIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface ethIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
if (ethIntf.getName().equalsIgnoreCase(bridgeConfigurationManager.getPhysicalInterfaceName(node,
network.getProviderPhysicalNetwork()))) {
of_ports = ethIntf.getOpenFlowPortColumn().getData();
}
private Status triggerInterfaceUpdates(Node node) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
- Map<String, Row> intfs = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> intfs = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (intfs != null) {
for (Row row : intfs.values()) {
- Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
logger.debug("Trigger Interface update for {}", intf);
if (network != null) {
}
private String getInternalBridgeUUID (Node node, String bridgeName) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
- Map<String, Row> bridgeTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ Map<String, Row> bridgeTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable == null) return null;
for (String key : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
if (bridge.getName().equals(bridgeName)) return key;
}
} catch (Exception e) {
org.opendaylight.controller.switchmanager,
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.utils,
- org.opendaylight.ovsdb.plugin,
+ org.opendaylight.ovsdb.plugin.api,
org.opendaylight.ovsdb.lib.notation,
org.apache.felix.dm,
org.slf4j,
import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
import org.opendaylight.controller.switchmanager.IInventoryListener;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.impl.ProviderNetworkManagerImpl;
import org.opendaylight.ovsdb.openstack.netvirt.impl.TenantNetworkManagerImpl;
import org.opendaylight.ovsdb.openstack.netvirt.impl.VlanConfigurationCacheImpl;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
import org.apache.felix.dm.Component;
public void configureInstance(Component c, Object imp,
String containerName) {
if (imp.equals(ConfigurationServiceImpl.class)) {
- c.setInterface(ConfigurationService.class.getName(), null);
- c.add(createServiceDependency().setService(OvsdbConfigService.class));
+ c.setInterface(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class.getName(), null);
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
}
if (imp.equals(BridgeConfigurationManagerImpl.class)) {
c.setInterface(BridgeConfigurationManager.class.getName(), null);
- c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(
+ org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class).setRequired(true));
c.add(createServiceDependency().setService(NetworkingProviderManager.class));
- c.add(createServiceDependency().setService(OvsdbConfigService.class));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
}
if (imp.equals(TenantNetworkManagerImpl.class)) {
c.setInterface(TenantNetworkManager.class.getName(), null);
c.add(createServiceDependency().setService(NetworkingProviderManager.class));
- c.add(createServiceDependency().setService(OvsdbConfigService.class));
- c.add(createServiceDependency().setService(IConnectionServiceInternal.class));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
+ c.add(createServiceDependency().setService(OvsdbConnectionService.class));
c.add(createServiceDependency().
setService(INeutronNetworkCRUD.class).
setRequired(true));
if (imp.equals(VlanConfigurationCacheImpl.class)) {
c.setInterface(VlanConfigurationCache.class.getName(), null);
- c.add(createServiceDependency().setService(OvsdbConfigService.class));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class));
c.add(createServiceDependency().setService(TenantNetworkManager.class));
}
c.setInterface(INeutronNetworkAware.class.getName(), null);
c.add(createServiceDependency().setService(TenantNetworkManager.class).setRequired(true));
c.add(createServiceDependency().setService(BridgeConfigurationManager.class).setRequired(true));
- c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
- c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
- c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+ c.add(createServiceDependency().setService(
+ org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
c.add(createServiceDependency().setService(INeutronNetworkCRUD.class).setRequired(true));
c.add(createServiceDependency().setService(OvsdbInventoryListener.class).setRequired(true));
}
if (imp.equals(PortHandler.class)) {
c.setInterface(INeutronPortAware.class.getName(), null);
- c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
- c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
c.add(createServiceDependency().setService(OvsdbInventoryListener.class).setRequired(true));
}
if (imp.equals(SouthboundHandler.class)) {
c.setInterface(new String[] {OvsdbInventoryListener.class.getName(),
IInventoryListener.class.getName()}, null);
- c.add(createServiceDependency().setService(ConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(
+ org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class).setRequired(true));
c.add(createServiceDependency().setService(BridgeConfigurationManager.class).setRequired(true));
c.add(createServiceDependency().setService(TenantNetworkManager.class).setRequired(true));
c.add(createServiceDependency().setService(NetworkingProviderManager.class).setRequired(true));
- c.add(createServiceDependency().setService(OvsdbConfigService.class).setRequired(true));
- c.add(createServiceDependency().setService(IConnectionServiceInternal.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true));
+ c.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true));
}
if (imp.equals(PortSecurityHandler.class)) {
if (imp.equals(ProviderNetworkManagerImpl.class)) {
c.setInterface(NetworkingProviderManager.class.getName(), null);
c.add(createServiceDependency()
- .setService(ConfigurationService.class)
+ .setService(org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService.class)
.setRequired(true));
c.add(createServiceDependency()
.setService(NetworkingProvider.class)
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
// The implementation for each of these services is resolved by the OSGi Service Manager
private volatile TenantNetworkManager tenantNetworkManager;
private volatile BridgeConfigurationManager bridgeConfigurationManager;
- private volatile ConfigurationService configurationService;
- private volatile OvsdbConfigService ovsdbConfigService;
- private volatile IConnectionServiceInternal connectionService;
+ private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
private volatile INeutronNetworkCRUD neutronNetworkCache;
- private volatile OvsdbInventoryListener inventoryListener;
+ private volatile OvsdbInventoryListener ovsdbInventoryListener;
/**
* Invoked when a network creation is requested
List<String> phyIfName = bridgeConfigurationManager.getAllPhysicalInterfaceNames(node);
try {
ConcurrentMap<String, Row> ports =
- this.ovsdbConfigService.getRows(node,
- ovsdbConfigService.getTableName(node, Port.class));
+ this.ovsdbConfigurationService.getRows(node,
+ ovsdbConfigurationService.getTableName(node, Port.class));
if (ports != null) {
for (Row portRow : ports.values()) {
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
for (UUID interfaceUuid : port.getInterfacesColumn().getData()) {
- Interface interfaceRow = (Interface) ovsdbConfigService
+ Interface interfaceRow = (Interface) ovsdbConfigurationService
.getRow(node,
- ovsdbConfigService.getTableName(node, Interface.class),
+ ovsdbConfigurationService.getTableName(node, Interface.class),
interfaceUuid.toString());
String interfaceType = interfaceRow.getTypeColumn().getData();
NetworkHandler.NETWORK_TYPE_GRE)) {
/* delete tunnel ports on this node */
logger.trace("Delete tunnel interface {}", interfaceRow);
- ovsdbConfigService.deleteRow(node,
- ovsdbConfigService.getTableName(node, Port.class),
+ ovsdbConfigurationService.deleteRow(node,
+ ovsdbConfigurationService.getTableName(node, Port.class),
port.getUuid().toString());
break;
} else if (!phyIfName.isEmpty() && phyIfName.contains(interfaceRow.getName())) {
logger.trace("Delete physical interface {}", interfaceRow);
- ovsdbConfigService.deleteRow(node,
- ovsdbConfigService.getTableName(node, Port.class),
+ ovsdbConfigurationService.deleteRow(node,
+ ovsdbConfigurationService.getTableName(node, Port.class),
port.getUuid().toString());
break;
}
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
*/
static final Logger logger = LoggerFactory.getLogger(PortHandler.class);
- private volatile OvsdbConfigService ovsdbConfigService;
- private volatile IConnectionServiceInternal connectionService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
private volatile OvsdbInventoryListener ovsdbInventoryListener;
/**
for (Node node : nodes) {
try {
ConcurrentMap<String, Row> portRows =
- this.ovsdbConfigService.getRows(node,
- ovsdbConfigService.getTableName(node, Port.class));
+ this.ovsdbConfigurationService.getRows(node,
+ ovsdbConfigurationService.getTableName(node, Port.class));
if (portRows != null) {
for (Row portRow : portRows.values()) {
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
for (UUID interfaceUuid : port.getInterfacesColumn().getData()) {
- Interface interfaceRow = (Interface) ovsdbConfigService
+ Interface interfaceRow = (Interface) ovsdbConfigurationService
.getRow(node,
- ovsdbConfigService.getTableName(node, Interface.class),
+ ovsdbConfigurationService.getTableName(node, Interface.class),
interfaceUuid.toString());
Map<String, String> externalIds = interfaceRow.getExternalIdsColumn().getData();
if (neutronPortId.equalsIgnoreCase(neutronPort.getPortUUID())) {
logger.trace("neutronPortDeleted: Delete interface {}", interfaceRow.getName());
- ovsdbConfigService.deleteRow(node,
- ovsdbConfigService.getTableName(node, Port.class),
+ ovsdbConfigurationService.deleteRow(node,
+ ovsdbConfigurationService.getTableName(node, Port.class),
port.getUuid().toString());
break;
}
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
List<Node> nodeCache;
// The implementation for each of these services is resolved by the OSGi Service Manager
- private volatile ConfigurationService configurationService;
+ private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
private volatile BridgeConfigurationManager bridgeConfigurationManager;
private volatile TenantNetworkManager tenantNetworkManager;
private volatile NetworkingProviderManager networkingProviderManager;
- private volatile OvsdbConfigService ovsdbConfigService;
- private volatile IConnectionServiceInternal connectionService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
void init() {
eventHandler = Executors.newSingleThreadExecutor();
private boolean isUpdateOfInterest(Node node, Row oldRow, Row newRow) {
if (oldRow == null) return true;
- if (newRow.getTableSchema().getName().equals(ovsdbConfigService.getTableName(node, Interface.class))) {
+ if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, Interface.class))) {
// We are NOT interested in Stats only updates
- Interface oldIntf = ovsdbConfigService.getTypedRow(node, Interface.class, oldRow);
+ Interface oldIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, oldRow);
if (oldIntf.getName() == null && oldIntf.getExternalIdsColumn() == null && oldIntf.getMacColumn() == null &&
oldIntf.getOpenFlowPortColumn() == null && oldIntf.getOptionsColumn() == null && oldIntf.getOtherConfigColumn() == null &&
oldIntf.getTypeColumn() == null) {
logger.trace("IGNORING Interface Update: node {}, row: {}", node, newRow);
return false;
}
- } else if (newRow.getTableSchema().getName().equals(ovsdbConfigService.getTableName(node, Port.class))) {
+ } else if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, Port.class))) {
// We are NOT interested in Stats only updates
- Port oldPort = ovsdbConfigService.getTypedRow(node, Port.class, oldRow);
+ Port oldPort = ovsdbConfigurationService.getTypedRow(node, Port.class, oldRow);
if (oldPort.getName() == null && oldPort.getExternalIdsColumn() == null && oldPort.getMacColumn() == null &&
oldPort.getInterfacesColumn() == null && oldPort.getTagColumn() == null && oldPort.getTrunksColumn() == null) {
logger.trace("IGNORING Port Update: node {}, row: {}", node, newRow);
return false;
}
- } else if (newRow.getTableSchema().getName().equals(ovsdbConfigService.getTableName(node, OpenVSwitch.class))) {
- OpenVSwitch oldOpenvSwitch = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, oldRow);
+ } else if (newRow.getTableSchema().getName().equals(ovsdbConfigurationService.getTableName(node, OpenVSwitch.class))) {
+ OpenVSwitch oldOpenvSwitch = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, oldRow);
if (oldOpenvSwitch.getOtherConfigColumn()== null) {
/* we are only interested in other_config field change */
return false;
private void processRowUpdate(Node node, String tableName, String uuid, Row row,
Object context, SouthboundEvent.Action action) {
if (action == SouthboundEvent.Action.DELETE) {
- if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, Interface.class))) {
+ if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
logger.debug("Processing update of {}. Deleted node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
- Interface deletedIntf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface deletedIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
NeutronNetwork network = null;
if (context == null) {
network = tenantNetworkManager.getTenantNetwork(deletedIntf);
logger.debug("Processing update of {}:{} node {} intf {} network {}",
tableName, action, node, uuid, network.getNetworkUUID());
try {
- ConcurrentMap<String, Row> interfaces = this.ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ ConcurrentMap<String, Row> interfaces = this.ovsdbConfigurationService
+ .getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (interfaces != null) {
boolean isLastInstanceOnNode = true;
for (String intfUUID : interfaces.keySet()) {
if (intfUUID.equals(uuid)) continue;
- Interface intf = this.ovsdbConfigService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
+ Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
NeutronNetwork neutronNetwork = tenantNetworkManager.getTenantNetwork(intf);
if (neutronNetwork != null && neutronNetwork.equals(network)) isLastInstanceOnNode = false;
}
}
}
}
- else if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, Interface.class))) {
+ else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
logger.debug("Processing update of {}:{} node: {}, interface uuid: {}, row: {}",
tableName, action, node, uuid, row);
- Interface intf = this.ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
if (network != null && !network.getRouterExternal()) {
if (networkingProviderManager.getProvider(node).hasPerTenantTunneling()) {
}
this.handleInterfaceUpdate(node, uuid, intf);
}
- } else if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, Port.class))) {
+
+ } else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Port.class))) {
logger.debug("Processing update of {}:{} node: {}, port uuid: {}, row: {}", tableName, action, node, uuid, row);
- Port port = this.ovsdbConfigService.getTypedRow(node, Port.class, row);
+ Port port = this.ovsdbConfigurationService.getTypedRow(node, Port.class, row);
Set<UUID> interfaceUUIDs = port.getInterfacesColumn().getData();
for (UUID intfUUID : interfaceUUIDs) {
logger.trace("Scanning interface "+intfUUID);
try {
- Row intfRow = this.ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), intfUUID.toString());
- Interface intf = this.ovsdbConfigService.getTypedRow(node, Interface.class, intfRow);
+ Row intfRow = this.ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class),
+ intfUUID.toString());
+ Interface intf = this.ovsdbConfigurationService.getTypedRow(node, Interface.class, intfRow);
NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
if (network != null && !network.getRouterExternal()) {
logger.debug("Processing update of {}:{} node {} intf {} network {}",
logger.error("Failed to process row update", e);
}
}
- } else if (tableName.equalsIgnoreCase(ovsdbConfigService.getTableName(node, OpenVSwitch.class))) {
+ } else if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, OpenVSwitch.class))) {
logger.debug("Processing update of {}:{} node: {}, ovs uuid: {}, row: {}", tableName, action, node, uuid, row);
try {
- ConcurrentMap<String, Row> interfaces = this.ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ ConcurrentMap<String, Row> interfaces = this.ovsdbConfigurationService
+ .getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (interfaces != null) {
for (String intfUUID : interfaces.keySet()) {
- Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
+ Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, interfaces.get(intfUUID));
this.handleInterfaceUpdate(node, intfUUID, intf);
}
}
private String getPortIdForInterface (Node node, String uuid, Interface intf) {
try {
- Map<String, Row> ports = this.ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Port.class));
+ Map<String, Row> ports = this.ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Port.class));
if (ports == null) return null;
for (String portUUID : ports.keySet()) {
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, ports.get(portUUID));
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, ports.get(portUUID));
Set<UUID> interfaceUUIDs = port.getInterfacesColumn().getData();
logger.trace("Scanning Port {} to identify interface : {} ",port, uuid);
for (UUID intfUUID : interfaceUUIDs) {
if (nodes == null) return;
for (Node node : nodes) {
try {
- List<String> tableNames = ovsdbConfigService.getTables(node);
+ List<String> tableNames = ovsdbConfigurationService.getTables(node);
if (tableNames == null) continue;
for (String tableName : tableNames) {
- Map<String, Row> rows = ovsdbConfigService.getRows(node, tableName);
+ Map<String, Row> rows = ovsdbConfigurationService.getRows(node, tableName);
if (rows == null) continue;
for (String uuid : rows.keySet()) {
Row row = rows.get(uuid);
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
static final Logger logger = LoggerFactory.getLogger(BridgeConfigurationManagerImpl.class);
// The implementation for each of these services is resolved by the OSGi Service Manager
- private volatile ConfigurationService configurationService;
+ private volatile org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService configurationService;
private volatile NetworkingProviderManager networkingProviderManager;
- private volatile OvsdbConfigService ovsdbConfigService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
public BridgeConfigurationManagerImpl() {
}
@Override
public String getBridgeUuid(Node node, String bridgeName) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
Map<String, Row> bridgeTable =
- ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable == null) return null;
for (String key : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
if (bridge.getName().equals(bridgeName)) return key;
}
} catch (Exception e) {
@Override
public boolean isNodeOverlayReady(Node node) {
- Preconditions.checkNotNull(configurationService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
return this.isNodeNeutronReady(node)
&& this.getBridgeUuid(node, configurationService.getNetworkBridgeName()) != null;
}
@Override
public boolean isPortOnBridge (Node node, Bridge bridge, String portName) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
for (UUID portsUUID : bridge.getPortsColumn().getData()) {
try {
- Row portRow = ovsdbConfigService.getRow(node,
- ovsdbConfigService.getTableName(node, Port.class),
+ Row portRow = ovsdbConfigurationService.getRow(node,
+ ovsdbConfigurationService.getTableName(node, Port.class),
portsUUID.toString());
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
if ((port != null) && port.getName().equalsIgnoreCase(portName)) {
return true;
}
@Override
public boolean isNodeVlanReady(Node node, NeutronNetwork network) {
- Preconditions.checkNotNull(configurationService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
Preconditions.checkNotNull(networkingProviderManager);
/* is br-int created */
String phyIf = null;
try {
Map<String, Row> ovsTable =
- ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+ ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
if (ovsTable == null) {
logger.error("OpenVSwitch table is null for Node {} ", node);
// The specification does not restrict the number of rows so we choose the first we find.
for (Row row : ovsTable.values()) {
String providerMaps;
- OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+ OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
Map<String, String> configs = ovsRow.getOtherConfigColumn().getData();
if (configs == null) {
try {
Map<String, Row> ovsTable =
- ovsdbConfigService.getRows(node,ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+ ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
if (ovsTable == null) {
logger.error("OpenVSwitch table is null for Node {} ", node);
// While there is only one entry in the HashMap, we can't access it by index...
for (Row row : ovsTable.values()) {
String bridgeMaps;
- OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+ OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
Map<String, String> configs = ovsRow.getOtherConfigColumn().getData();
if (configs == null) {
* Returns the Bridge for a given node and bridgeName
*/
public Bridge getBridge (Node node, String bridgeName) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
try {
Map<String, Row> bridgeTable =
- ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Bridge.class));
+ ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Bridge.class));
if (bridgeTable != null) {
for (String key : bridgeTable.keySet()) {
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeTable.get(key));
if (bridge.getName().equals(bridgeName)) {
return bridge;
}
* Returns true if a patch port exists between the Integration Bridge and Network Bridge
*/
private boolean isNetworkPatchCreated (Node node, Bridge intBridge, Bridge netBridge) {
- Preconditions.checkNotNull(configurationService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
boolean isPatchCreated = false;
* Creates the Integration Bridge
*/
private void createIntegrationBridge (Node node) throws Exception {
- Preconditions.checkNotNull(configurationService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
String brInt = configurationService.getIntegrationBridgeName();
type: internal
*/
private boolean createBridges(Node node, NeutronNetwork network) throws Exception {
- Preconditions.checkNotNull(configurationService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
Preconditions.checkNotNull(networkingProviderManager);
Status status;
* Add a Port to a Bridge
*/
private Status addPortToBridge (Node node, String bridgeName, String portName) throws Exception {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
logger.debug("addPortToBridge: Adding port: {} to Bridge {}, Node {}", portName, bridgeName, node);
}
/* Check if the port already exists. */
- Row row = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, row);
+ Row row = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
if (bridge != null) {
if (isPortOnBridge(node, bridge, portName)) {
logger.debug("addPortToBridge: Port {} already in Bridge {}, Node {}", portName, bridgeName, node);
return new Status(StatusCode.NOTFOUND, "Could not find "+portName+" in "+bridgeName);
}
- Port port = ovsdbConfigService.createTypedRow(node, Port.class);
+ Port port = ovsdbConfigurationService.createTypedRow(node, Port.class);
port.setName(portName);
StatusWithUuid statusWithUuid =
- ovsdbConfigService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
+ ovsdbConfigurationService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
if (!statusWithUuid.isSuccess()) {
logger.error("addPortToBridge: Failed to add Port {} in Bridge {}, Node {}", portName, bridgeName, node);
return statusWithUuid;
String interfaceUUID = null;
int timeout = 6;
while ((interfaceUUID == null) && (timeout > 0)) {
- Row portRow = ovsdbConfigService.getRow(node, port.getSchema().getName(), portUUID);
- port = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService.getRow(node, port.getSchema().getName(), portUUID);
+ port = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
Set<UUID> interfaces = port.getInterfacesColumn().getData();
if (interfaces == null || interfaces.size() == 0) {
// Wait for the OVSDB update to sync up the Local cache.
continue;
}
interfaceUUID = interfaces.toArray()[0].toString();
- Row intf =ovsdbConfigService.getRow(node,
- ovsdbConfigService.getTableName(node, Interface.class), interfaceUUID);
+ Row intf = ovsdbConfigurationService.getRow(node,
+ ovsdbConfigurationService.getTableName(node, Interface.class), interfaceUUID);
if (intf == null) {
interfaceUUID = null;
}
* Add a Patch Port to a Bridge
*/
private Status addPatchPort (Node node, String bridgeUUID, String portName, String peerPortName) throws Exception {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
logger.debug("addPatchPort: node: {}, bridgeUUID: {}, port: {}, peer: {}",
node, bridgeUUID, portName, peerPortName);
/* Check if the port already exists. */
- Row bridgeRow = ovsdbConfigService.getRow(node,
- ovsdbConfigService.getTableName(node, Bridge.class), bridgeUUID);
- Bridge bridge = ovsdbConfigService.getTypedRow(node, Bridge.class, bridgeRow);
+ Row bridgeRow = ovsdbConfigurationService.getRow(node,
+ ovsdbConfigurationService.getTableName(node, Bridge.class), bridgeUUID);
+ Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, bridgeRow);
if (bridge != null) {
if (isPortOnBridge(node, bridge, portName)) {
logger.debug("addPatchPort: Port {} already in Bridge, Node {}", portName, node);
return new Status(StatusCode.NOTFOUND, "Could not find "+portName+" in Bridge");
}
- Port patchPort = ovsdbConfigService.createTypedRow(node, Port.class);
+ Port patchPort = ovsdbConfigurationService.createTypedRow(node, Port.class);
patchPort.setName(portName);
// Create patch port and interface
StatusWithUuid statusWithUuid =
- ovsdbConfigService.insertRow(node, patchPort.getSchema().getName(), bridgeUUID, patchPort.getRow());
+ ovsdbConfigurationService.insertRow(node, patchPort.getSchema().getName(), bridgeUUID, patchPort.getRow());
if (!statusWithUuid.isSuccess()) return statusWithUuid;
String patchPortUUID = statusWithUuid.getUuid().toString();
String interfaceUUID = null;
int timeout = 6;
while ((interfaceUUID == null) && (timeout > 0)) {
- Row portRow = ovsdbConfigService.getRow(node, patchPort.getSchema().getName(), patchPortUUID);
- patchPort = ovsdbConfigService.getTypedRow(node, Port.class, portRow);
+ Row portRow = ovsdbConfigurationService.getRow(node, patchPort.getSchema().getName(), patchPortUUID);
+ patchPort = ovsdbConfigurationService.getTypedRow(node, Port.class, portRow);
Set<UUID> interfaces = patchPort.getInterfacesColumn().getData();
if (interfaces == null || interfaces.size() == 0) {
// Wait for the OVSDB update to sync up the Local cache.
return new Status(StatusCode.INTERNALERROR);
}
- Interface intf = ovsdbConfigService.createTypedRow(node, Interface.class);
+ Interface intf = ovsdbConfigurationService.createTypedRow(node, Interface.class);
intf.setType("patch");
Map<String, String> options = Maps.newHashMap();
options.put("peer", peerPortName);
intf.setOptions(options);
- return ovsdbConfigService.updateRow(node,
+ return ovsdbConfigurationService.updateRow(node,
intf.getSchema().getName(),
patchPortUUID,
interfaceUUID,
*/
private Status addBridge(Node node, String bridgeName,
String localPatchName, String remotePatchName) throws Exception {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
String bridgeUUID = this.getBridgeUuid(node, bridgeName);
- Bridge bridge = ovsdbConfigService.createTypedRow(node, Bridge.class);
+ Bridge bridge = ovsdbConfigurationService.createTypedRow(node, Bridge.class);
Set<String> failMode = new HashSet<>();
failMode.add("secure");
bridge.setFailMode(failMode);
if (bridgeUUID == null) {
bridge.setName(bridgeName);
- StatusWithUuid statusWithUuid = ovsdbConfigService.insertRow(node,
+ StatusWithUuid statusWithUuid = ovsdbConfigurationService.insertRow(node,
bridge.getSchema().getName(),
null,
bridge.getRow());
if (!statusWithUuid.isSuccess()) return statusWithUuid;
bridgeUUID = statusWithUuid.getUuid().toString();
- Port port = ovsdbConfigService.createTypedRow(node, Port.class);
+ Port port = ovsdbConfigurationService.createTypedRow(node, Port.class);
port.setName(bridgeName);
- Status status = ovsdbConfigService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
+ Status status = ovsdbConfigurationService.insertRow(node, port.getSchema().getName(), bridgeUUID, port.getRow());
logger.debug("addBridge: Inserting Bridge {} {} with protocols {} and status {}",
bridgeName, bridgeUUID, protocols, status);
} else {
- Status status = ovsdbConfigService.updateRow(node,
+ Status status = ovsdbConfigurationService.updateRow(node,
bridge.getSchema().getName(),
null,
bridgeUUID,
bridgeName, bridgeUUID, protocols, status);
}
- ovsdbConfigService.setOFController(node, bridgeUUID);
+ ovsdbConfigurationService.setOFController(node, bridgeUUID);
if (localPatchName != null &&
remotePatchName != null &&
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.Version;
-import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.Set;
-public class ConfigurationServiceImpl implements ConfigurationService {
+public class ConfigurationServiceImpl implements org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService {
static final Logger logger = LoggerFactory.getLogger(ConfigurationServiceImpl.class);
- private volatile OvsdbConfigService ovsdbConfigService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
private String integrationBridgeName;
private String networkBridgeName;
public InetAddress getTunnelEndPoint(Node node) {
InetAddress address = null;
try {
- Map<String, Row> ovsTable = ovsdbConfigService.getRows(node,
- ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+ Map<String, Row> ovsTable = ovsdbConfigurationService.getRows(node,
+ ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
if (ovsTable == null) {
logger.error("OpenVSwitch table is null for Node {} ", node);
// While there is only one entry in the HashMap, we can't access it by index...
for (Row row : ovsTable.values()) {
- OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+ OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
Map<String, String> configs = ovsRow.getOtherConfigColumn().getData();
if (configs == null) {
}
}
- Map<String, Row> ovsRows = ovsdbConfigService.getRows(node,
- ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+ Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
+ ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
if (ovsRows == null) {
logger.info("The OVS node {} has no Open_vSwitch rows", node.toString());
Version ovsVersion = null;
// While there is only one entry in the HashMap, we can't access it by index...
for (Row row : ovsRows.values()) {
- OpenVSwitch ovsRow = ovsdbConfigService.getTypedRow(node, OpenVSwitch.class, row);
+ OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
Set<String> versionSet = ovsRow.getOvsVersionColumn().getData();
if (versionSet != null && versionSet.iterator().hasNext()) {
ovsVersion = Version.fromString(versionSet.iterator().next());
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
// The implementation for each of these services is resolved by the OSGi Service Manager
private volatile NetworkingProviderManager networkingProviderManager;
- private volatile OvsdbConfigService ovsdbConfigService;
- private volatile IConnectionServiceInternal connectionService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
private volatile INeutronNetworkCRUD neutronNetworkCache;
private volatile INeutronPortCRUD neutronPortCache;
private volatile VlanConfigurationCache vlanConfigurationCache;
@Override
public void programInternalVlan(Node node, String portUUID, NeutronNetwork network) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
int vlan = vlanConfigurationCache.getInternalVlan(node, network.getID());
logger.debug("Programming Vlan {} on {}", vlan, portUUID);
return;
}
- Port port = ovsdbConfigService.createTypedRow(node, Port.class);
+ Port port = ovsdbConfigurationService.createTypedRow(node, Port.class);
OvsdbSet<Long> tags = new OvsdbSet<>();
tags.add((long) vlan);
port.setTag(tags);
- ovsdbConfigService.updateRow(node, port.getSchema().getName(), null, portUUID, port.getRow());
+ ovsdbConfigurationService.updateRow(node, port.getSchema().getName(), null, portUUID, port.getRow());
}
@Override
public boolean isTenantNetworkPresentInNode(Node node, String segmentationId) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
String networkId = this.getNetworkId(segmentationId);
if (networkId == null) {
}
*/
// External-id based more accurate VM Location identification
- Map<String, Row> ifTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Interface.class));
+ Map<String, Row> ifTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Interface.class));
if (ifTable == null) {
logger.debug("Interface table is null for Node {} ", node);
return false;
}
for (Row row : ifTable.values()) {
- Interface intf = ovsdbConfigService.getTypedRow(node, Interface.class, row);
+ Interface intf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
Map<String, String> externalIds = intf.getExternalIdsColumn().getData();
if (externalIds != null && externalIds.get(Constants.EXTERNAL_ID_INTERFACE_ID) != null) {
if (this.isInterfacePresentInTenantNetwork(externalIds.get(Constants.EXTERNAL_ID_INTERFACE_ID), networkId)) {
import org.opendaylight.ovsdb.openstack.netvirt.NodeConfiguration;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
-import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
import org.opendaylight.ovsdb.schema.openvswitch.Port;
private Map<String, NodeConfiguration> configurationCache = Maps.newConcurrentMap();
private volatile TenantNetworkManager tenantNetworkManager;
- private volatile OvsdbConfigService ovsdbConfigService;
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
private NodeConfiguration getNodeConfiguration(Node node){
String nodeUuid = getNodeUUID(node);
}
private String getNodeUUID(Node node) {
- Preconditions.checkNotNull(ovsdbConfigService);
+ Preconditions.checkNotNull(ovsdbConfigurationService);
String nodeUuid = new String();
try {
- Map<String, Row> ovsTable = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, OpenVSwitch.class));
+ Map<String, Row> ovsTable = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
nodeUuid = (String)ovsTable.keySet().toArray()[0];
}
catch (Exception e) {
String networkId = null;
try {
- Map<String, Row> portRows = ovsdbConfigService.getRows(node, ovsdbConfigService.getTableName(node, Port.class));
+ Map<String, Row> portRows = ovsdbConfigurationService.getRows(node, ovsdbConfigurationService.getTableName(node, Port.class));
if (portRows == null){
logger.debug("Port table is null for Node {}", node);
}
for (Row row : portRows.values()) {
- Port port = ovsdbConfigService.getTypedRow(node, Port.class, row);
+ Port port = ovsdbConfigurationService.getTypedRow(node, Port.class, row);
if (port.getTagColumn() == null) continue;
Set<Long> tags = port.getTagColumn().getData();
}
for (UUID ifaceId : port.getInterfacesColumn().getData()) {
- Row ifaceRow = ovsdbConfigService.getRow(node, ovsdbConfigService.getTableName(node, Interface.class), ifaceId.toString());
- Interface iface = ovsdbConfigService.getTypedRow(node, Interface.class, ifaceRow);
+ Row ifaceRow = ovsdbConfigurationService
+ .getRow(node, ovsdbConfigurationService.getTableName(node, Interface.class),
+ ifaceId.toString());
+ Interface iface = ovsdbConfigurationService.getTypedRow(node, Interface.class, ifaceRow);
if (iface == null) {
logger.debug("Interface table is null");
<extensions>true</extensions>
<configuration>
<instructions>
- <Import-Package>org.opendaylight.controller.sal.packet,
- org.opendaylight.controller.sal.action,
- org.opendaylight.controller.sal.discovery,
- org.opendaylight.controller.sal.topology,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.flowprogrammer,
- org.opendaylight.controller.sal.reader,
- org.opendaylight.controller.sal.inventory,
- org.opendaylight.controller.sal.match,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.sal.connection,
- org.opendaylight.controller.clustering.services,
- org.opendaylight.controller.sal.networkconfig.bridgedomain,
- org.opendaylight.ovsdb.lib.error,
- org.opendaylight.ovsdb.lib.notation,
- org.opendaylight.ovsdb.lib.operations,
- org.opendaylight.ovsdb.lib.message,
- org.opendaylight.ovsdb.schema.openvswitch,
- org.apache.commons.lang3.builder,
- org.apache.commons.lang3.tuple,
- org.apache.felix.dm,
- org.slf4j,
- org.eclipse.osgi.framework.console,
- org.osgi.framework,
- javax.net.ssl,
- *</Import-Package>
+ <Import-Package>
+ org.opendaylight.controller.sal.packet,
+ org.opendaylight.controller.sal.action,
+ org.opendaylight.controller.sal.discovery,
+ org.opendaylight.controller.sal.topology,
+ org.opendaylight.controller.sal.core,
+ org.opendaylight.controller.sal.flowprogrammer,
+ org.opendaylight.controller.sal.reader,
+ org.opendaylight.controller.sal.inventory,
+ org.opendaylight.controller.sal.match,
+ org.opendaylight.controller.sal.utils,
+ org.opendaylight.controller.sal.connection,
+ org.opendaylight.controller.clustering.services,
+ org.opendaylight.controller.sal.networkconfig.bridgedomain,
+ org.opendaylight.ovsdb.lib.error,
+ org.opendaylight.ovsdb.lib.notation,
+ org.opendaylight.ovsdb.lib.operations,
+ org.opendaylight.ovsdb.lib.message,
+ org.opendaylight.ovsdb.schema.openvswitch,
+ org.apache.commons.lang3.builder,
+ org.apache.commons.lang3.tuple,
+ org.apache.felix.dm,
+ org.slf4j,
+ org.eclipse.osgi.framework.console,
+ org.osgi.framework,
+ javax.net.ssl,
+ *
+ </Import-Package>
<Embed-Dependency>httpclient,commons-codec,httpcore-nio,javax.servlet-api,portlet-api,commons-collections;type=!pom;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
- <Bundle-Activator>org.opendaylight.ovsdb.plugin.Activator</Bundle-Activator>
- <Export-Package>org.opendaylight.ovsdb.plugin</Export-Package>
+ <Bundle-Activator>org.opendaylight.ovsdb.plugin.internal.Activator</Bundle-Activator>
+ <Private-Package>
+ org.opendaylight.ovsdb.plugin.impl,
+ org.opendaylight.ovsdb.plugin.internal
+ </Private-Package>
+ <Export-Package>
+ <!-- ToDo: Remove this line after the deprecated APIs have been removed -->
+ org.opendaylight.ovsdb.plugin,
+ org.opendaylight.ovsdb.plugin.api
+ </Export-Package>
</instructions>
<manifestLocation>${project.basedir}/META-INF</manifestLocation>
</configuration>
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.opendaylight.controller.sal.core.Node;
-
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelFutureListener;
-
-public class ChannelConnectionHandler implements ChannelFutureListener {
- Node node;
- ConnectionService connectionService;
- public Node getNode() {
- return node;
- }
- public void setNode(Node node) {
- this.node = node;
- }
- public ConnectionService getConnectionService() {
- return connectionService;
- }
- public void setConnectionService(ConnectionService connectionService) {
- this.connectionService = connectionService;
- }
- @Override
- public void operationComplete(ChannelFuture arg0) throws Exception {
- connectionService.channelClosed(node);
- }
-}
import org.opendaylight.controller.sal.core.ConstructionException;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.OvsdbClient;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class Connection {
+/**
+ * OVSDB Plugin Connection
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.Connection}
+ */
+@Deprecated public class Connection {
private Node node;
private String identifier;
private OvsdbClient client;
*/
package org.opendaylight.ovsdb.plugin;
-import java.util.List;
-import java.util.Map;
-
import org.opendaylight.controller.sal.connection.ConnectionConstants;
import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.plugin.api.Connection;
-public interface IConnectionServiceInternal {
+import java.util.List;
+import java.util.Map;
+
+/**
+ * OVSDB Plugin Connection Service
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService}
+ */
+@Deprecated public interface IConnectionServiceInternal {
public Connection getConnection(Node node);
public List<Node> getNodes();
public Node connect(String identifier, Map<ConnectionConstants, String> params);
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import java.util.Map;\r
-import com.fasterxml.jackson.annotation.JsonProperty;\r
-\r
-public class InsertRequest {\r
- public String op;\r
- public String table;\r
- @JsonProperty("uuid-name")\r
- public Object uuidName;\r
- public Map<String, Object> row;\r
-\r
- public InsertRequest(String op, String table, String uuidName, Map<String, Object> row){\r
- this.op = op;\r
- this.table = table;\r
- this.uuidName = uuidName;\r
- this.row = row;\r
- }\r
-}\r
*/
package org.opendaylight.ovsdb.plugin;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.Property;
import org.opendaylight.controller.sal.core.UpdateType;
import org.opendaylight.ovsdb.lib.message.TableUpdates;
import org.opendaylight.ovsdb.lib.notation.Row;
-public interface InventoryServiceInternal extends IPluginInInventoryService {
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * OVSDB Plugin Inventory Service
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService }
+ */
+@Deprecated public interface InventoryServiceInternal extends IPluginInInventoryService {
public ConcurrentMap<String, ConcurrentMap<String, Row>> getCache(Node n, String databaseName);
public ConcurrentMap<String, Row> getTableCache(Node n, String databaseName, String tableName);
public Row getRow (Node n, String databaseName, String tableName, String uuid);
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import java.util.List;\r
-\r
-public class MutateRequest {\r
- public String op = "mutate";\r
- public String table;\r
- public List<Object> where;\r
- public List<Object> mutations;\r
-\r
- public MutateRequest(String table, List<Object> where, List<Object> mutations){\r
- this.table = table;\r
- this.where = where;\r
- this.mutations = mutations;\r
- }\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
-import org.opendaylight.controller.sal.core.Node;
-
-public class NodeConnectorFactory implements INodeConnectorFactory
- {
- void init() {
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
-
- public NodeConnector fromStringNoNode(String typeStr, String IDStr,
- Node n){
- if(typeStr.equals("OVS")){
- try {
- return new NodeConnector(typeStr, IDStr, n);
- } catch (Exception ex) {
- return null;
- }
- }
- return null;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.utils.INodeFactory;
-import org.opendaylight.controller.sal.core.Node;
-
-public class NodeFactory implements INodeFactory
- {
- void init() {
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
-
- public Node fromString(String nodeType, String nodeId){
- if(nodeType.equals("OVS"))
- try{
- return new Node("OVS", nodeId);
- } catch(ConstructionException e)
- {
- return null;
- }
- return null;
- }
-}
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
package org.opendaylight.ovsdb.plugin;
-import java.util.Map;
import com.google.common.collect.Maps;
-public class OvsVswitchdSchemaConstants {
+
+import java.util.Map;
+
+/**
+ * Open vSwitch Schema Constants
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants }
+ */
+@Deprecated public class OvsVswitchdSchemaConstants {
public static String DATABASE_NAME = "Open_vSwitch";
private static final String OVSDB_AUTOCONFIGURECONTROLLER = "ovsdb.autoconfigurecontroller";
*/
package org.opendaylight.ovsdb.plugin;
-import java.util.List;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
-public interface OvsdbConfigService {
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+
+/**
+ * OVSDB Plugin Configuration Service
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService }
+ */
+@Deprecated public interface OvsdbConfigService {
/**
* This version of insertRow is a short-term replacement for the older & now deprecated method of the same name.
* @param rowUuid UUID of the row that is being updated
* @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
*/
- public Status updateRow (Node node, String tableName, String parentUuid, String rowUuid, Row row);
+ public Status updateRow(Node node, String tableName, String parentUuid, String rowUuid, Row row);
/**
* This version of deleteRow is a short-term replacement for the older & now deprecated method of the same name.
* @param rowUuid UUID of the row that is being deleted
*/
- public Status deleteRow (Node node, String tableName, String rowUUID);
+ public Status deleteRow(Node node, String tableName, String rowUUID);
/**
* This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
* @return Boolean representing success or failure of the operation.
*
* @throws InterruptedException
- * @throws ExecutionException
+ * @throws java.util.concurrent.ExecutionException
*/
public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.notation.Row;
-public interface OvsdbInventoryListener {
+/**
+ * OVSDB Plugin Inventory Listener
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener }
+ */
+@Deprecated public interface OvsdbInventoryListener {
public void nodeAdded(Node node);
public void nodeRemoved(Node node);
public void rowAdded(Node node, String tableName, String uuid, Row row);
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import java.util.Random;\r
-\r
-public class OvsdbMessage {\r
- String methodName;\r
- Object[] argument;\r
- String id;\r
-\r
- public OvsdbMessage(String method, Object[] arg){\r
- this.methodName = method;\r
- this.argument = arg;\r
- Random x = new Random();\r
- this.id = Integer.toString(x.nextInt(10000));\r
- }\r
-}\r
+++ /dev/null
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Brent Salisbury, Evan Zeller
- */
-package org.opendaylight.ovsdb.plugin;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.sal.action.Action;
-import org.opendaylight.controller.sal.action.Controller;
-import org.opendaylight.controller.sal.action.Drop;
-import org.opendaylight.controller.sal.action.Flood;
-import org.opendaylight.controller.sal.action.FloodAll;
-import org.opendaylight.controller.sal.action.HwPath;
-import org.opendaylight.controller.sal.action.Loopback;
-import org.opendaylight.controller.sal.action.Output;
-import org.opendaylight.controller.sal.action.PopVlan;
-import org.opendaylight.controller.sal.action.PushVlan;
-import org.opendaylight.controller.sal.action.SetDlDst;
-import org.opendaylight.controller.sal.action.SetDlSrc;
-import org.opendaylight.controller.sal.action.SetDlType;
-import org.opendaylight.controller.sal.action.SetNwDst;
-import org.opendaylight.controller.sal.action.SetNwSrc;
-import org.opendaylight.controller.sal.action.SetNwTos;
-import org.opendaylight.controller.sal.action.SetTpDst;
-import org.opendaylight.controller.sal.action.SetTpSrc;
-import org.opendaylight.controller.sal.action.SetVlanCfi;
-import org.opendaylight.controller.sal.action.SetVlanId;
-import org.opendaylight.controller.sal.action.SetVlanPcp;
-import org.opendaylight.controller.sal.action.SwPath;
-import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.NodeTable;
-import org.opendaylight.controller.sal.flowprogrammer.Flow;
-import org.opendaylight.controller.sal.match.Match;
-import org.opendaylight.controller.sal.match.MatchType;
-import org.opendaylight.controller.sal.reader.FlowOnNode;
-import org.opendaylight.controller.sal.reader.IPluginInReadService;
-import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
-import org.opendaylight.controller.sal.reader.NodeDescription;
-import org.opendaylight.controller.sal.reader.NodeTableStatistics;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-/**
- * Stub Implementation for IPluginInReadService used by SAL
- *
- *
- */
-public class ReadService implements IPluginInReadService {
- private static final Logger logger = LoggerFactory
- .getLogger(ReadService.class);
-
- /**
- * Function called by the dependency manager when all the required
- * dependencies are satisfied
- *
- */
- void init() {
- }
-
- /**
- * Function called by the dependency manager when at least one dependency
- * become unsatisfied or when the component is shutting down because for
- * example bundle is being stopped.
- *
- */
- void destroy() {
- }
-
- /**
- * Function called by dependency manager after "init ()" is called and after
- * the services provided by the class are registered in the service registry
- *
- */
- void start() {
- }
-
- /**
- * Function called by the dependency manager before the services exported by
- * the component are unregistered, this will be followed by a "destroy ()"
- * calls
- *
- */
- void stop() {
- }
-
- @Override
- public FlowOnNode readFlow(Node node, Flow flow, boolean cached) {
- FlowOnNode fn1 = new FlowOnNode(flow);
- fn1.setByteCount(100);
- fn1.setDurationNanoseconds(400);
- fn1.setDurationSeconds(40);
- fn1.setTableId((byte) 0x1);
- fn1.setPacketCount(200);
- return fn1;
- }
-
- @Override
- public List<FlowOnNode> readAllFlow(Node node, boolean cached) {
-
- ArrayList<FlowOnNode> list = new ArrayList<FlowOnNode>();
- ArrayList<Action> actionList = new ArrayList<Action>();
- actionList.add(new Drop()); //IT assumes this is first element
- actionList.add(new Loopback());
- actionList.add(new Flood());
- actionList.add(new FloodAll());
- actionList.add(new Controller());
- actionList.add(new SwPath());
- actionList.add(new HwPath());
- try {
- actionList.add(new Output(new NodeConnector("STUB", 0xCAFE, node)));
- } catch (ConstructionException e) {
-
- }
- byte dst[] = { (byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5 };
- byte src[] = { (byte) 5, (byte) 4, (byte) 3, (byte) 2, (byte) 1 };
- actionList.add(new SetDlSrc(src));
- actionList.add(new SetDlDst(dst));
- actionList.add(new SetDlType(10));
-
- actionList.add(new SetVlanId(2));
- actionList.add(new SetVlanPcp(3));
- actionList.add(new SetVlanCfi(1));
-
- actionList.add(new PopVlan());
- actionList.add(new PushVlan(0x8100, 1, 1, 1234));
-
- try {
- actionList.add(new SetNwSrc(InetAddress.getByName("2.2.2.2")));
- actionList.add(new SetNwDst(InetAddress.getByName("1.1.1.1")));
- } catch (UnknownHostException e) {
-
- }
- actionList.add(new SetNwTos(0x10));
- actionList.add(new SetTpSrc(4201));
- actionList.add(new SetTpDst(8080));
-
- short priority = 3500; //IT assumes this value
- for (Action a : actionList) {
- Flow flow = new Flow();
- Match match = new Match();
- try {
- match.setField(MatchType.NW_DST,
- InetAddress.getByName("1.1.1.1"));
- } catch (UnknownHostException e) {
-
- }
- flow.setMatch(match);
- List<Action> actions = new ArrayList<Action>();
- actions.add(a);
- flow.setActions(actions);
- flow.setPriority(priority++);
- flow.setIdleTimeout((short) 1000);
- flow.setHardTimeout((short) 2000);
- flow.setId(12345);
-
- FlowOnNode fn1 = new FlowOnNode(flow);
- fn1.setByteCount(100);
- fn1.setDurationNanoseconds(400);
- fn1.setDurationSeconds(40);
- fn1.setTableId((byte) 0x1);
- fn1.setPacketCount(200);
-
- list.add(fn1);
- }
- return list;
- }
-
- @Override
- public NodeDescription readDescription(Node node, boolean cached) {
- NodeDescription desc = new NodeDescription();
- desc.setDescription("This is a sample node description");
- desc.setHardware("stub hardware");
- desc.setSoftware("stub software");
- desc.setSerialNumber("123");
- desc.setManufacturer("opendaylight");
- return desc;
- }
-
- @Override
- public NodeConnectorStatistics readNodeConnector(NodeConnector connector,
- boolean cached) {
- NodeConnectorStatistics stats = new NodeConnectorStatistics();
- stats.setNodeConnector(connector);
- stats.setCollisionCount(4);
- stats.setReceiveByteCount(1000);
- stats.setReceiveCRCErrorCount(1);
- stats.setReceiveDropCount(2);
- stats.setReceiveErrorCount(3);
- stats.setReceiveFrameErrorCount(5);
- stats.setReceiveOverRunErrorCount(6);
- stats.setReceivePacketCount(250);
- stats.setTransmitByteCount(5000);
- stats.setTransmitDropCount(50);
- stats.setTransmitErrorCount(10);
- stats.setTransmitPacketCount(500);
-
- return stats;
- }
-
- @Override
- public List<NodeConnectorStatistics> readAllNodeConnector(Node node,
- boolean cached) {
- NodeConnectorStatistics stats = new NodeConnectorStatistics();
- try {
- NodeConnector nc = new NodeConnector("STUB", 0xCAFE, node);
- stats.setNodeConnector(nc);
- } catch (ConstructionException e) {
- // couldn't create nodeconnector.
- }
- stats.setCollisionCount(4);
- stats.setReceiveByteCount(1000);
- stats.setReceiveCRCErrorCount(1);
- stats.setReceiveDropCount(2);
- stats.setReceiveErrorCount(3);
- stats.setReceiveFrameErrorCount(5);
- stats.setReceiveOverRunErrorCount(6);
- stats.setReceivePacketCount(250);
- stats.setTransmitByteCount(5000);
- stats.setTransmitDropCount(50);
- stats.setTransmitErrorCount(10);
- stats.setTransmitPacketCount(500);
-
- List<NodeConnectorStatistics> result = new ArrayList<NodeConnectorStatistics>();
- result.add(stats);
- return result;
- }
-
- @Override
- public long getTransmitRate(NodeConnector connector) {
- return 100;
- }
-
- @Override
- public NodeTableStatistics readNodeTable(NodeTable table, boolean b) {
- NodeTableStatistics stats = new NodeTableStatistics();
- stats.setNodeTable(table);
- stats.setActiveCount(4);
- stats.setLookupCount(4);
- stats.setMatchedCount(4);
-
- return stats;
- }
-
- @Override
- public List<NodeTableStatistics> readAllNodeTable(Node node, boolean cached) {
- NodeTableStatistics stats = new NodeTableStatistics();
- try {
- NodeTable nt = new NodeTable(NodeTable.NodeTableIDType.OPENFLOW, Byte.valueOf("10"), node);
- stats.setNodeTable(nt);
- } catch (ConstructionException e) {
- // couldn't create nodetable.
- }
-
- stats.setActiveCount(4);
- stats.setLookupCount(4);
- stats.setMatchedCount(4);
-
- List<NodeTableStatistics> result = new ArrayList<NodeTableStatistics>();
- result.add(stats);
- return result;
- }
-}
/**
* Extends the Status class to allow functions to return a uuid
+ * @deprecated as of release 1.0.0, replaced by {@link org.opendaylight.ovsdb.plugin.api.StatusWithUuid }
*/
-public class StatusWithUuid extends Status {
+@Deprecated public class StatusWithUuid extends Status {
private static final long serialVersionUID = -5413085099514964003L;
private UUID uuid;
+++ /dev/null
-/*
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.plugin;\r
-\r
-\r
-import java.util.ArrayList;\r
-import java.util.Map;\r
-\r
-public class UpdateRequest {\r
- public String op;\r
- public String table;\r
- public ArrayList<Object> where;\r
- public Map<String, Object> row;\r
-\r
- public UpdateRequest(String op, String table, ArrayList<Object> where, Map<String, Object> row){\r
- this.op = op;\r
- this.table = table;\r
- this.where = where;\r
- this.row = row;\r
- }\r
-}\r
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Connection {
+ private Node node;
+ private String identifier;
+ private OvsdbClient client;
+
+ public Long getIdCounter() {
+ return idCounter;
+ }
+
+ public void setIdCounter(Long idCounter) {
+ this.idCounter = idCounter;
+ }
+
+ private Long idCounter;
+
+ private static final Logger logger = LoggerFactory.getLogger(Connection.class);
+
+ public Connection(String identifier, OvsdbClient client) {
+
+ super();
+
+ this.identifier = identifier;
+ this.client = client;
+ this.idCounter = 0L;
+ try {
+ node = new Node("OVS", identifier);
+ } catch (ConstructionException e) {
+ logger.error("Error creating OVS node with identifier " + identifier, e);
+ }
+ }
+
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ public OvsdbClient getClient() {
+ return this.client;
+ }
+
+ public void setClient(OvsdbClient client) {
+ this.client = client;
+ }
+
+ public Node getNode() {
+ return node;
+ }
+
+ public void setNode(Node node) {
+ this.node = node;
+ }
+
+ public void disconnect() {
+ client.disconnect();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null) return false;
+ if (getClass() != obj.getClass()) return false;
+ Connection other = (Connection) obj;
+ if (identifier == null) {
+ if (other.identifier != null) return false;
+ } else if (!identifier.equals(other.identifier)) return false;
+ return true;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+public final class OvsVswitchdSchemaConstants {
+ public static String DATABASE_NAME = "Open_vSwitch";
+
+ private static final String OVSDB_AUTOCONFIGURECONTROLLER = "ovsdb.autoconfigurecontroller";
+ private static final boolean defaultAutoConfigureController = true;
+ private static boolean autoConfigureController = defaultAutoConfigureController;
+
+ private static Map<String, String[]> columnToMutate = Maps.newHashMap();
+ public static String[] getParentColumnToMutate(String childTabletoInsert) {
+ return columnToMutate.get(childTabletoInsert);
+ }
+ private static void addParentColumnToMutate(String childTable, String parentTable, String columnName) {
+ String[] parentColumn = {parentTable, columnName};
+ columnToMutate.put(childTable, parentColumn);
+ }
+
+ static {
+ addParentColumnToMutate("Bridge", "Open_vSwitch", "bridges");
+ addParentColumnToMutate("Port", "Bridge", "ports");
+ addParentColumnToMutate("Interface", "Port", "interfaces");
+ addParentColumnToMutate("SSL", "Open_vSwitch", "ssl");
+ addParentColumnToMutate("IPFIX", "Bridge", "ipfix");
+ addParentColumnToMutate("sFlow", "Bridge", "sflow");
+ addParentColumnToMutate("Flow_Table", "Bridge", "flow_tables");
+ addParentColumnToMutate("QoS", "Port", "qos");
+ addParentColumnToMutate("NetFlow", "Bridge", "netflow");
+ addParentColumnToMutate("Mirror", "Bridge", "mirrors");
+ addParentColumnToMutate("Manager", "Open_vSwitch", "manager_options");
+ addParentColumnToMutate("Controller", "Bridge", "controller");
+ // Keep the default value if the property is not set
+ if (System.getProperty(OVSDB_AUTOCONFIGURECONTROLLER) != null)
+ autoConfigureController = Boolean.getBoolean(OVSDB_AUTOCONFIGURECONTROLLER);
+ }
+
+ public static boolean shouldConfigureController (String databaseName, String tableName) {
+ if (autoConfigureController && databaseName.equals(DATABASE_NAME) && tableName.equals("Bridge")) return true;
+ return false;
+ }
+
+ public enum PortType {
+ VLAN("vlan"),
+ TUNNEL("Tunnel"),
+ BONDING("Bonding"),
+ PATCH("patch"),
+ INTERNAL("internal");
+
+ private PortType(String name) {
+ this.name = name;
+ }
+
+ private String name;
+
+ @Override
+ public String toString() {
+ return name;
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+
+public interface OvsdbConfigurationService {
+
+ /**
+ * This version of insertRow is a short-term replacement for the older & now deprecated method of the same name.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node OVSDB Node
+ * @param tableName Table on which the row is inserted
+ * @param parentUuid UUID of the parent table to which this operation will result in attaching/mutating.
+ * @param row Row of table Content to be inserted
+ * @return UUID of the inserted Row
+ */
+ public StatusWithUuid insertRow(Node node, String tableName, String parentUuid, Row<GenericTableSchema> row);
+
+ /**
+ * This version of updateRow is a short-term replacement for the older & now deprecated method of the same name.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node OVSDB Node
+ * @param tableName Table on which the row is Updated
+ * @param parentUuid UUID of the parent row on which this operation might result in mutating.
+ * @param rowUuid UUID of the row that is being updated
+ * @param row Row of table Content to be Updated. Include just those columns that needs to be updated.
+ */
+ public Status updateRow (Node node, String tableName, String parentUuid, String rowUuid, Row row);
+
+ /**
+ * This version of deleteRow is a short-term replacement for the older & now deprecated method of the same name.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node OVSDB Node
+ * @param tableName Table on which the row is Updated
+ * @param rowUuid UUID of the row that is being deleted
+ */
+
+ public Status deleteRow (Node node, String tableName, String rowUUID);
+
+ /**
+ * This version of getRow is a short-term replacement for the older & now deprecated method of the same name.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node OVSDB Node
+ * @param tableName Table Name
+ * @param rowUuid UUID of the row being queried
+ * @return a row with a list of Column data that corresponds to an unique Row-identifier called uuid in a given table.
+ */
+
+ public Row getRow(Node node, String tableName, String uuid);
+
+ /**
+ * This version of getRows is a short-term replacement for the older & now deprecated method of the same name.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node OVSDB Node
+ * @param tableName Table Name
+ * @return List of rows that makes the entire Table.
+ */
+
+ public ConcurrentMap<String, Row> getRows(Node node, String tableName);
+
+ /**
+ * Returns all the Tables in a given Ndoe.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node OVSDB node
+ * @return List of Table Names that make up Open_vSwitch schema.
+ */
+ public List<String> getTables(Node node);
+
+ /**
+ * setOFController is a convenience method used by existing applications to setup Openflow Controller on
+ * a Open_vSwitch Bridge.
+ * This API assumes an Open_vSwitch database Schema.
+ *
+ * @param node Node
+ * @param bridgeUUID uuid of the Bridge for which the ip-address of Openflow Controller should be programmed.
+ * @return Boolean representing success or failure of the operation.
+ *
+ * @throws InterruptedException
+ * @throws ExecutionException
+ */
+ public Boolean setOFController(Node node, String bridgeUUID) throws InterruptedException, ExecutionException;
+
+ public <T extends TypedBaseTable<?>> String getTableName(Node node, Class<T> typedClass);
+ public <T extends TypedBaseTable<?>> T getTypedRow(Node node, Class<T> typedClass, Row row);
+ public <T extends TypedBaseTable<?>> T createTypedRow(Node node, Class<T> typedClass);
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.core.Node;
+
+public interface OvsdbConnectionService {
+ public Connection getConnection(Node node);
+ public List<Node> getNodes();
+ public Node connect(String identifier, Map<ConnectionConstants, String> params);
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.lib.notation.Row;
+
+public interface OvsdbInventoryListener {
+ public void nodeAdded(Node node);
+ public void nodeRemoved(Node node);
+ public void rowAdded(Node node, String tableName, String uuid, Row row);
+ public void rowUpdated(Node node, String tableName, String uuid, Row old, Row row);
+ public void rowRemoved(Node node, String tableName, String uuid, Row row, Object context);
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.core.UpdateType;
+import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.notation.Row;
+
+public interface OvsdbInventoryService extends IPluginInInventoryService {
+ public ConcurrentMap<String, ConcurrentMap<String, Row>> getCache(Node n, String databaseName);
+ public ConcurrentMap<String, Row> getTableCache(Node n, String databaseName, String tableName);
+ public Row getRow (Node n, String databaseName, String tableName, String uuid);
+ public void updateRow(Node n, String databaseName, String tableName, String uuid, Row row);
+ public void removeRow(Node n, String databaseName, String tableName, String uuid);
+ public void processTableUpdates(Node n, String databaseName,TableUpdates tableUpdates);
+ public void printCache(Node n);
+
+ public void addNode(Node n, Set<Property> props);
+ public void notifyNodeAdded(Node n);
+ public void removeNode(Node n);
+ public void addNodeProperty(Node node, UpdateType type, Set<Property> props);
+}
\ No newline at end of file
--- /dev/null
+/*
+ * [[ Authors will Fill in the Copyright header ]]
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Hugo Trippaers
+ */
+package org.opendaylight.ovsdb.plugin.api;
+
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+
+/**
+ * Extends the Status class to allow functions to return a uuid
+ */
+public class StatusWithUuid extends Status {
+ private static final long serialVersionUID = -5413085099514964003L;
+ private UUID uuid;
+
+ public StatusWithUuid(StatusCode errorCode) {
+ super(errorCode);
+ }
+
+ public StatusWithUuid(StatusCode errorCode, String description) {
+ super(errorCode, description);
+ }
+
+ public StatusWithUuid(StatusCode errorCode, long requestId) {
+ super(errorCode, requestId);
+ }
+
+ public StatusWithUuid(StatusCode errorCode, UUID uuid) {
+ super(errorCode);
+ this.uuid = uuid;
+ }
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+}
*
* Authors : Madhu Venugopal, Brent Salisbury, Keith Burns
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.impl;
import static org.opendaylight.ovsdb.lib.operations.Operations.op;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.TableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.TypedBaseTable;
+import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.Connection;
+import org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants;
+import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import org.opendaylight.ovsdb.schema.openvswitch.Controller;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.ListenableFuture;
-public class ConfigurationService implements IPluginInBridgeDomainConfigService, OvsdbConfigService,
- CommandProvider
+public class ConfigurationServiceImpl implements IPluginInBridgeDomainConfigService,
+ OvsdbConfigurationService,
+ OvsdbConfigService,
+ CommandProvider
{
private static final Logger logger = LoggerFactory
- .getLogger(ConfigurationService.class);
+ .getLogger(ConfigurationServiceImpl.class);
- IConnectionServiceInternal connectionService;
- InventoryServiceInternal inventoryServiceInternal;
+ OvsdbConnectionService connectionService;
+ OvsdbInventoryService ovsdbInventoryService;
boolean forceConnect = false;
protected static final String OPENFLOW_10 = "1.0";
protected static final String OPENFLOW_13 = "1.3";
void stop() {
}
- public void setConnectionServiceInternal(IConnectionServiceInternal connectionService) {
+ public void setConnectionServiceInternal(OvsdbConnectionService connectionService) {
this.connectionService = connectionService;
}
- public void unsetConnectionServiceInternal(IConnectionServiceInternal connectionService) {
+ public void unsetConnectionServiceInternal(OvsdbConnectionService connectionService) {
if (this.connectionService == connectionService) {
this.connectionService = null;
}
}
- public void setInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
- this.inventoryServiceInternal = inventoryServiceInternal;
+ public void setOvsdbInventoryService(OvsdbInventoryService ovsdbInventoryService) {
+ this.ovsdbInventoryService = ovsdbInventoryService;
}
- public void unsetInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
- if (this.inventoryServiceInternal == inventoryServiceInternal) {
- this.inventoryServiceInternal = null;
+ public void unsetInventoryServiceInternal(OvsdbInventoryService ovsdbInventoryService) {
+ if (this.ovsdbInventoryService == ovsdbInventoryService) {
+ this.ovsdbInventoryService = null;
}
}
@Override
public ConcurrentMap<String, Row> getRows(Node node, String tableName) {
- ConcurrentMap<String, Row> ovsTable = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
+ ConcurrentMap<String, Row> ovsTable = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
return ovsTable;
}
@Override
public Row getRow(Node node, String tableName, String uuid) {
- Map<String, Row> ovsTable = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
+ Map<String, Row> ovsTable = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, tableName);
if (ovsTable == null) return null;
return ovsTable.get(uuid);
}
@Override
public List<String> getTables(Node node) {
- ConcurrentMap<String, ConcurrentMap<String, Row>> cache = inventoryServiceInternal.getCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME);
+ ConcurrentMap<String, ConcurrentMap<String, Row>> cache = ovsdbInventoryService.getCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME);
if (cache == null) return null;
return new ArrayList<String>(cache.keySet());
}
}
- Boolean setBridgeOFController(Node node, String bridgeIdentifier) {
+ public Boolean setBridgeOFController(Node node, String bridgeIdentifier) {
if (connectionService == null) {
logger.error("Couldn't refer to the ConnectionService");
return false;
Connection connection = connectionService.getConnection(node);
Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
- Map<String, Row> brTableCache = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
+ Map<String, Row> brTableCache = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
for (String uuid : brTableCache.keySet()) {
bridge = connection.getClient().getTypedRowWrapper(Bridge.class, brTableCache.get(uuid));
if (bridge.getName().contains(bridgeIdentifier)) {
ci.println("Invalid Node");
return;
}
- inventoryServiceInternal.printCache(node);
+ ovsdbInventoryService.printCache(node);
}
public void _forceConnect (CommandInterpreter ci) {
Connection connection = connectionService.getConnection(node);
Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
List<String> brlist = new ArrayList<String>();
- Map<String, Row> brTableCache = inventoryServiceInternal.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
+ Map<String, Row> brTableCache = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
if(brTableCache != null){
for (String uuid : brTableCache.keySet()) {
bridge = connection.getClient().getTypedRowWrapper(Bridge.class, brTableCache.get(uuid));
*
* Authors : Madhu Venugopal, Brent Salisbury, Evan Zeller
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.impl;
import io.netty.channel.ChannelHandler;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.TableSchema;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.api.Connection;
+import org.opendaylight.ovsdb.plugin.internal.IPAddressProperty;
+import org.opendaylight.ovsdb.plugin.internal.L4PortProperty;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* Represents the openflow plugin component in charge of programming the flows
* the flow programming and relay them to functional modules above SAL.
*/
-public class ConnectionService implements IPluginInConnectionService, IConnectionServiceInternal, OvsdbConnectionListener {
- protected static final Logger logger = LoggerFactory.getLogger(ConnectionService.class);
+public class ConnectionServiceImpl implements IPluginInConnectionService,
+ OvsdbConnectionService,
+ IConnectionServiceInternal,
+ OvsdbConnectionListener {
+ protected static final Logger logger = LoggerFactory.getLogger(ConnectionServiceImpl.class);
// Properties that can be set in config.ini
private static final Integer defaultOvsdbPort = 6640;
- private OvsdbConnection connectionLib;
+
private ConcurrentMap<String, Connection> ovsdbConnections = new ConcurrentHashMap<String, Connection>();
private List<ChannelHandler> handlers = null;
- private InventoryServiceInternal inventoryServiceInternal;
-
- public InventoryServiceInternal getInventoryServiceInternal() {
- return inventoryServiceInternal;
- }
- public void setInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
- this.inventoryServiceInternal = inventoryServiceInternal;
- }
-
- public void unsetInventoryServiceInternal(InventoryServiceInternal inventoryServiceInternal) {
- if (this.inventoryServiceInternal == inventoryServiceInternal) {
- this.inventoryServiceInternal = null;
- }
- }
+ private volatile OvsdbInventoryService ovsdbInventoryService;
+ private volatile OvsdbConnection connectionLib;
- public void setOvsdbConnection(OvsdbConnection connectionService) {
- connectionLib = connectionService;
- // It is not correct to register the service here. Rather, we should depend on the
- // Service created by createServiceDependency() and hook to it via Apache DM.
- // Using this temporarily till the Service Dependency is resolved.
- connectionLib.registerForPassiveConnection(this);
+ public void setOvsdbInventoryService(OvsdbInventoryService inventoryService) {
+ this.ovsdbInventoryService = inventoryService;
}
- public void unsetOvsdbConnection(OvsdbConnection connectionService) {
- connectionLib = null;
+ public void setOvsdbConnection(OvsdbConnection ovsdbConnection) {
+ this.connectionLib = ovsdbConnection;
}
public void init() {
if (connection != null) {
ovsdbConnections.remove(identifier);
connection.disconnect();
- inventoryServiceInternal.removeNode(node);
+ ovsdbInventoryService.removeNode(node);
return new Status(StatusCode.SUCCESS);
} else {
return new Status(StatusCode.NOTFOUND);
@Override
public void run() {
try {
+ logger.info("Initialize inventory for {}", connection.toString());
initializeInventoryForNewNode(connection);
} catch (InterruptedException | ExecutionException | IOException e) {
logger.error("Failed to initialize inventory for node with identifier " + identifier, e);
public void channelClosed(Node node) throws Exception {
logger.info("Connection to Node : {} closed", node);
disconnect(node);
- inventoryServiceInternal.removeNode(node);
+ ovsdbInventoryService.removeNode(node);
}
private void initializeInventoryForNewNode (Connection connection) throws InterruptedException, ExecutionException, IOException {
Set<Property> props = new HashSet<Property>();
props.add(addressProp);
props.add(l4Port);
- inventoryServiceInternal.addNode(connection.getNode(), props);
+ logger.info("Add node to ovsdb inventory service {}", connection.getNode().toString());
+ ovsdbInventoryService.addNode(connection.getNode(), props);
List<String> databases = client.getDatabases().get();
if (databases == null) {
for (String database : databases) {
DatabaseSchema dbSchema = client.getSchema(database).get();
TableUpdates updates = this.monitorTables(connection.getNode(), dbSchema);
- inventoryServiceInternal.processTableUpdates(connection.getNode(), dbSchema.getName(), updates);
+ ovsdbInventoryService.processTableUpdates(connection.getNode(), dbSchema.getName(), updates);
}
- inventoryServiceInternal.notifyNodeAdded(connection.getNode());
+ logger.info("Notifying Inventory Listeners for Node Added: {}", connection.getNode().toString());
+ ovsdbInventoryService.notifyNodeAdded(connection.getNode());
}
public TableUpdates monitorTables(Node node, DatabaseSchema dbSchema) throws ExecutionException, InterruptedException, IOException {
@Override
public void update(TableUpdates result, DatabaseSchema dbSchema) {
- inventoryServiceInternal.processTableUpdates(node, dbSchema.getName(), result);
+ ovsdbInventoryService.processTableUpdates(node, dbSchema.getName(), result);
}
@Override
*
* Authors : Madhu Venugopal, Brent Salisbury
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.impl;
import java.util.Collections;
import java.util.HashMap;
import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
import org.opendaylight.controller.sal.utils.HexEncode;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
import org.opendaylight.ovsdb.lib.message.TableUpdate;
import org.opendaylight.ovsdb.lib.message.TableUpdates;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.plugin.InventoryServiceInternal;
+import org.opendaylight.ovsdb.plugin.internal.NodeDatabase;
+import org.opendaylight.ovsdb.plugin.api.OvsVswitchdSchemaConstants;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
import com.google.common.collect.Sets;
*
*
*/
-public class InventoryService implements IPluginInInventoryService, InventoryServiceInternal {
+public class InventoryServiceImpl implements IPluginInInventoryService,
+ OvsdbInventoryService,
+ InventoryServiceInternal {
private static final Logger logger = LoggerFactory
- .getLogger(InventoryService.class);
+ .getLogger(InventoryServiceImpl.class);
private final Set<IPluginOutInventoryService> pluginOutInventoryServices =
new CopyOnWriteArraySet<IPluginOutInventoryService>();
private ConcurrentMap<Node, Map<String, Property>> nodeProps = new ConcurrentHashMap<Node, Map<String, Property>>();
private ConcurrentMap<NodeConnector, Map<String, Property>> nodeConnectorProps = new ConcurrentHashMap<NodeConnector, Map<String, Property>>();
- private ConcurrentMap<Node, NodeDB> dbCache = Maps.newConcurrentMap();
+ private ConcurrentMap<Node, NodeDatabase> dbCache = Maps.newConcurrentMap();
private ScheduledExecutorService executor;
- private OvsdbConfigService configurationService;
+ private OvsdbConfigurationService ovsdbConfigurationService;
+
+ private volatile IPluginOutInventoryService salInventoryService;
private Set<OvsdbInventoryListener> ovsdbInventoryListeners = Sets.newCopyOnWriteArraySet();
this.pluginOutInventoryServices.remove(service);
}
- public void setConfigurationService(OvsdbConfigService service) {
- configurationService = service;
+ public void setOvsdbConfigurationService(OvsdbConfigurationService service) {
+ ovsdbConfigurationService = service;
}
- public void unsetConfigurationService(OvsdbConfigService service) {
- configurationService = null;
+ public void unsetConfigurationService(OvsdbConfigurationService service) {
+ ovsdbConfigurationService = null;
}
@Override
@Override
public ConcurrentMap<String, ConcurrentMap<String, Row>> getCache(Node n, String databaseName) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db == null) return null;
return db.getDatabase(databaseName);
}
@Override
public ConcurrentMap<String, Row> getTableCache(Node n, String databaseName, String tableName) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db == null) return null;
return db.getTableCache(databaseName, tableName);
}
@Override
public Row getRow(Node n, String databaseName, String tableName, String uuid) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db == null) return null;
return db.getRow(databaseName, tableName, uuid);
}
@Override
public void updateRow(Node n, String databaseName, String tableName, String uuid, Row row) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db == null) {
- db = new NodeDB();
+ db = new NodeDatabase();
dbCache.put(n, db);
}
db.updateRow(databaseName, tableName, uuid, row);
@Override
public void removeRow(Node n, String databaseName, String tableName, String uuid) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db != null) db.removeRow(databaseName, tableName, uuid);
}
@Override
public void processTableUpdates(Node n, String databaseName, TableUpdates tableUpdates) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db == null) {
- db = new NodeDB();
+ db = new NodeDatabase();
dbCache.put(n, db);
}
@Override
public void run() {
try {
- if (configurationService != null) configurationService.setOFController(node, uuid.toString());
+ if (ovsdbConfigurationService != null) ovsdbConfigurationService.setOFController(node, uuid.toString());
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
Set<Property> props = new HashSet<Property>();
props.add(descProp);
- IPluginOutInventoryService salInventoryService = (IPluginOutInventoryService) ServiceHelper.getInstance(
- IPluginOutInventoryService.class, "default", this);
if (salInventoryService != null) {
logger.debug("Updating Bridge Name {} on OF node {}", bridgeName, ofNode);
salInventoryService.updateNode(ofNode, UpdateType.CHANGED, props);
@Override
public void printCache(Node n) {
- NodeDB db = dbCache.get(n);
+ NodeDatabase db = dbCache.get(n);
if (db != null) db.printTableCache();
}
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.impl;
+
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
+import org.opendaylight.controller.sal.core.Node;
+
+public class NodeConnectorFactory implements INodeConnectorFactory {
+ public NodeConnector fromStringNoNode(String typeStr, String IDStr,
+ Node n){
+ if(typeStr.equals("OVS")){
+ try {
+ return new NodeConnector(typeStr, IDStr, n);
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+ return null;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury
+ */
+package org.opendaylight.ovsdb.plugin.impl;
+
+import org.opendaylight.controller.sal.core.ConstructionException;
+import org.opendaylight.controller.sal.utils.INodeFactory;
+import org.opendaylight.controller.sal.core.Node;
+
+public class NodeFactory implements INodeFactory {
+
+ public Node fromString(String nodeType, String nodeId){
+ if(nodeType.equals("OVS"))
+ try{
+ return new Node("OVS", nodeId);
+ } catch(ConstructionException e)
+ {
+ return null;
+ }
+ return null;
+ }
+}
*
* Authors : Madhu Venugopal, Brent Salisbury
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
import java.util.Dictionary;
import java.util.Hashtable;
import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
import org.opendaylight.controller.sal.utils.INodeFactory;
import org.opendaylight.ovsdb.lib.OvsdbConnection;
+import org.opendaylight.ovsdb.lib.OvsdbConnectionListener;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.InventoryServiceInternal;
+import org.opendaylight.ovsdb.plugin.OvsdbConfigService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryService;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.NodeConnectorFactory;
+import org.opendaylight.ovsdb.plugin.impl.NodeFactory;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
@Override
public Object[] getGlobalImplementations() {
- Object[] res = { ConnectionService.class, ConfigurationService.class, NodeFactory.class, NodeConnectorFactory.class, InventoryService.class };
+ Object[] res = { ConnectionServiceImpl.class, ConfigurationServiceImpl.class, NodeFactory.class, NodeConnectorFactory.class, InventoryServiceImpl.class };
return res;
}
@Override
public void configureGlobalInstance(Component c, Object imp){
- if (imp.equals(ConfigurationService.class)) {
+ if (imp.equals(ConfigurationServiceImpl.class)) {
// export the service to be used by SAL
Dictionary<String, Object> props = new Hashtable<String, Object>();
// Set the protocolPluginType property which will be used
// by SAL
props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
c.setInterface(new String[] { IPluginInBridgeDomainConfigService.class.getName(),
+ OvsdbConfigurationService.class.getName(),
OvsdbConfigService.class.getName()}, props);
c.add(createServiceDependency()
- .setService(IConnectionServiceInternal.class)
- .setCallbacks("setConnectionServiceInternal", "unsetConnectionServiceInternal")
+ .setService(OvsdbConnectionService.class)
.setRequired(true));
c.add(createServiceDependency()
- .setService(InventoryServiceInternal.class)
- .setCallbacks("setInventoryServiceInternal", "unsetInventoryServiceInternal")
+ .setService(OvsdbInventoryService.class)
.setRequired(true));
c.add(createServiceDependency()
.setService(IClusterGlobalServices.class)
.setRequired(false));
}
- if (imp.equals(ConnectionService.class)) {
+ if (imp.equals(ConnectionServiceImpl.class)) {
// export the service to be used by SAL
Dictionary<String, Object> props = new Hashtable<String, Object>();
// Set the protocolPluginType property which will be used
props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
c.setInterface(
new String[] {IPluginInConnectionService.class.getName(),
+ OvsdbConnectionService.class.getName(),
+ OvsdbConnectionListener.class.getName(),
IConnectionServiceInternal.class.getName()}, props);
-
c.add(createServiceDependency()
- .setService(InventoryServiceInternal.class)
- .setCallbacks("setInventoryServiceInternal", "unsetInventoryServiceInternal")
+ .setService(OvsdbInventoryService.class)
.setRequired(true));
c.add(createServiceDependency()
.setService(OvsdbConnection.class)
- .setCallbacks("setOvsdbConnection", "unsetOvsdbConnection")
.setRequired(true));
}
- if (imp.equals(InventoryService.class)) {
- Dictionary<String, Object> props = new Hashtable<String, Object>();
+ if (imp.equals(InventoryServiceImpl.class)) {
+ Dictionary<String, Object> props = new Hashtable<>();
props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
props.put("scope", "Global");
c.setInterface(
- new String[] {IPluginInInventoryService.class.getName(),
- InventoryServiceInternal.class.getName()}, props);
+ new String[]{IPluginInInventoryService.class.getName(),
+ OvsdbInventoryService.class.getName(),
+ InventoryServiceInternal.class.getName()}, props);
c.add(createServiceDependency()
- .setService(IPluginOutInventoryService.class, "(scope=Global)")
- .setCallbacks("setPluginOutInventoryServices",
- "unsetPluginOutInventoryServices")
- .setRequired(true));
+ .setService(IPluginOutInventoryService.class, "(scope=Global)")
+ .setCallbacks("setPluginOutInventoryServices",
+ "unsetPluginOutInventoryServices")
+ .setRequired(true));
c.add(createServiceDependency()
.setService(OvsdbInventoryListener.class)
.setCallbacks("listenerAdded", "listenerRemoved"));
c.add(createServiceDependency()
- .setService(OvsdbConfigService.class)
- .setCallbacks("setConfigurationService", "unsetConfigurationService")
+ .setService(OvsdbConfigurationService.class)
.setRequired(false));
}
*
* Authors : Brent Salisbury, Evan Zeller
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
public enum Encapsulation {
* Authors : Madhu Venugopal, Brent Salisbury
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
import java.net.InetAddress;
import javax.xml.bind.annotation.XmlAccessType;
* Authors : Madhu Venugopal, Brent Salisbury
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
*
* Authors : Madhu Venugopal, Brent Salisbury
*/
-package org.opendaylight.ovsdb.plugin;
+package org.opendaylight.ovsdb.plugin.internal;
import java.util.Collection;
import java.util.Map;
import com.google.common.collect.Maps;
-public class NodeDB {
+public class NodeDatabase {
ConcurrentMap<String, TableDB> dbCache = Maps.newConcurrentMap();
public ConcurrentMap<String, ConcurrentMap<String, Row>> getDatabase(String dbName) {
import org.junit.Test;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public void addBridge() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
Node node = testObjects.node;
/**
* @param node Node serving this configuration service
* @param bridgeDomainIdentifier String representation of a Bridge Domain
*/
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.createBridgeDomain(node, BRIDGE_NAME, null);
}
public void getBridgeDomains() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
- InventoryService inventoryService = testObjects.inventoryService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
+ InventoryServiceImpl inventoryService = testObjects.inventoryService;
Node node = testObjects.node;
/**
* @param node Node serving this configuration service
*
*/
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
List<String> ls = configurationService.getBridgeDomains(node);
}
TestObjects testObjects = getTestConnection();
Node node = testObjects.node;
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.setBridgeOFController(node, BRIDGE_NAME);
}
@Test
public void setBridgeConfig() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
Node node = testObjects.node;
Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
//Will accept multiple array pairs. Pairs must be arrays not maps.
configs.put(ConfigConstants.CUSTOM, exterIDPairs);
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.addBridgeDomainConfig(node, BRIDGE_NAME, configs);
}
import org.junit.Test;
import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @param String with IP and connection type ex. type:ip:port
*
*/
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.setManager(node, manager);
}
-}
+}
\ No newline at end of file
import org.junit.Test;
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.internal.Encapsulation;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Test
public void addPort() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
Node node = testObjects.node;
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.addPort(node, BRIDGE_NAME, PORT_NAME, null);
}
@Test
public void addPortVlan() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
Node node = testObjects.node;
int vlanid = 100;
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
configs.put(ConfigConstants.TYPE, "VLAN");
configs.put(ConfigConstants.VLAN, vlanid+"");
String tunencap = encap.toString();
String tunnelendpoint = FAKE_IP;
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
configs.put(ConfigConstants.TYPE, "TUNNEL");
configs.put(ConfigConstants.TUNNEL_TYPE, tunencap);
@Test
public void deletePort() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
Node node = testObjects.node;
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
}
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
public abstract class PluginTestBase {
private final static String identifier = "TEST";
}
public class TestObjects {
- public final ConnectionService connectionService;
- public final InventoryService inventoryService;
- public final ConfigurationService configurationService;
+ public final ConnectionServiceImpl connectionService;
+ public final InventoryServiceImpl inventoryService;
+ public final ConfigurationServiceImpl configurationService;
public final Node node;
- public TestObjects(ConnectionService connectionService, Node node, InventoryService inventoryService, ConfigurationService configurationService) {
+ public TestObjects(ConnectionServiceImpl connectionService, Node node, InventoryServiceImpl inventoryService, ConfigurationServiceImpl configurationService) {
this.connectionService = connectionService;
this.inventoryService = inventoryService;
this.configurationService = configurationService;
Node.NodeIDType.registerIDType("OVS", String.class);
NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class,
"OVS");
- InventoryService inventoryService = new InventoryService();
+ InventoryServiceImpl inventoryService = new InventoryServiceImpl();
inventoryService.init();
- ConnectionService connectionService = new ConnectionService();
+ ConnectionServiceImpl connectionService = new ConnectionServiceImpl();
connectionService.init();
- InventoryService inventory = new InventoryService();
+ InventoryServiceImpl inventory = new InventoryServiceImpl();
inventory.init();
- connectionService.setInventoryServiceInternal(inventory);
+ connectionService.setOvsdbInventoryService(inventory);
connectionService.setOvsdbConnection(OvsdbConnectionService.getService());
- ConfigurationService configurationService = new ConfigurationService();
+ ConfigurationServiceImpl configurationService = new ConfigurationServiceImpl();
configurationService.setConnectionServiceInternal(connectionService);
- configurationService.setInventoryServiceInternal(inventory);
- inventory.setConfigurationService(configurationService);
+ configurationService.setOvsdbInventoryService(inventory);
+ inventory.setOvsdbConfigurationService(configurationService);
Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
import org.junit.Test;
import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
+import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public void deleteBridge() throws Throwable{
TestObjects testObjects = getTestConnection();
- ConnectionService connectionService = testObjects.connectionService;
+ ConnectionServiceImpl connectionService = testObjects.connectionService;
Node node = testObjects.node;
- ConfigurationService configurationService = testObjects.configurationService;
+ ConfigurationServiceImpl configurationService = testObjects.configurationService;
configurationService.deleteBridgeDomain(node, BRIDGE_NAME);
}