*/
package org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.connection;
+import java.net.ConnectException;
+import java.net.UnknownHostException;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionManager;
import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.ReconciliationManager;
import org.opendaylight.ovsdb.hwvtepsouthbound.reconciliation.ReconciliationTask;
import org.opendaylight.ovsdb.lib.OvsdbClient;
-import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.net.ConnectException;
-import java.net.UnknownHostException;
-import java.util.concurrent.atomic.AtomicInteger;
-
/**
- * Copied from org.opendaylight.ovsdb.southbound.reconciliation.connection.ConnectionReconciliationTask
+ * Copied from org.opendaylight.ovsdb.southbound.reconciliation.connection.ConnectionReconciliationTask.
*
+ * <p>
* Created by Anil Vishnoi (avishnoi@Brocade.com) on 3/9/16.
*/
public class ConnectionReconciliationTask extends ReconciliationTask {
boolean result = false;
connectionAttempt.incrementAndGet();
InstanceIdentifier<Node> nIid = (InstanceIdentifier<Node>) nodeIid;
- HwvtepGlobalAugmentation hwvtepNode = (HwvtepGlobalAugmentation)configData;
+ HwvtepGlobalAugmentation hwvtepNode = (HwvtepGlobalAugmentation) configData;
LOG.info("Retry({}) connection to Ovsdb Node {} ", connectionAttempt.get(), hwvtepNode.getConnectionInfo());
OvsdbClient client = null;
connectionAttempt.get(), hwvtepNode.getConnectionInfo());
}
} catch (UnknownHostException | ConnectException e) {
- LOG.warn("Connection retry({}) failed with exception. ",connectionAttempt.get(), e);
+ LOG.warn("Connection retry({}) failed with exception. ", connectionAttempt.get(), e);
}
return result;
}
@Override
public void doRetry(boolean wasLastAttemptSuccessful) {
- if( !wasLastAttemptSuccessful && connectionAttempt.get() <= MAX_ATTEMPT ) {
+ if (!wasLastAttemptSuccessful && connectionAttempt.get() <= MAX_ATTEMPT) {
reconciliationManager.enqueueForRetry(ConnectionReconciliationTask.this);
} else {
reconciliationManager.dequeue(this);
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractTransactCommand<T extends Identifiable, Aug extends Augmentation<Node>> implements TransactCommand<T> {
+public abstract class AbstractTransactCommand<T extends Identifiable, A extends Augmentation<Node>>
+ implements TransactCommand<T> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractTransactCommand.class);
protected static final UUID TXUUID = new UUID("TXUUID");
}
void processDependencies(final UnMetDependencyGetter<T> unMetDependencyGetter,
- final TransactionBuilder transaction,
- final InstanceIdentifier<Node> nodeIid,
- final InstanceIdentifier key,
- final T data, final Object... extraData) {
+ final TransactionBuilder transaction,
+ final InstanceIdentifier<Node> nodeIid,
+ final InstanceIdentifier key,
+ final T data, final Object... extraData) {
this.threadLocalDeviceTransaction.set(transaction);
HwvtepDeviceInfo deviceInfo = getOperationalState().getDeviceInfo();
}
Type type = getClass().getGenericSuperclass();
- Type classType = ((ParameterizedType)type).getActualTypeArguments()[0];
+ Type classType = ((ParameterizedType) type).getActualTypeArguments()[0];
//If this key itself is in transit wait for the response of this key itself
if (deviceInfo.isKeyInTransit((Class<? extends Identifiable>) classType, key)) {
inTransitDependencies.put(classType, Collections.singletonList(key));
}
- if (HwvtepSouthboundUtil.isEmptyMap(confingDependencies) && HwvtepSouthboundUtil.isEmptyMap(inTransitDependencies)) {
+ if (HwvtepSouthboundUtil.isEmptyMap(confingDependencies) && HwvtepSouthboundUtil.isEmptyMap(
+ inTransitDependencies)) {
doDeviceTransaction(transaction, nodeIid, data, key, extraData);
if (isRemoveCommand()) {
getDeviceInfo().clearConfigData((Class<? extends Identifiable>) classType, key);
@Override
public void onDependencyResolved(HwvtepOperationalState operationalState,
- TransactionBuilder transactionBuilder) {
+ TransactionBuilder transactionBuilder) {
AbstractTransactCommand.this.threadLocalOperationalState.set(operationalState);
AbstractTransactCommand.this.threadLocalDeviceTransaction.set(transactionBuilder);
onConfigUpdate(transactionBuilder, nodeIid, data, key, extraData);
@Override
public void onDependencyResolved(HwvtepOperationalState operationalState,
- TransactionBuilder transactionBuilder) {
+ TransactionBuilder transactionBuilder) {
//data would have got deleted by , push the data only if it is still in configds
threadLocalOperationalState.set(operationalState);
threadLocalDeviceTransaction.set(transactionBuilder);
- T data = (T)new MdsalUtils(operationalState.getDataBroker()).read(
+ T data = (T) new MdsalUtils(operationalState.getDataBroker()).read(
LogicalDatastoreType.CONFIGURATION, key);
if (data != null) {
onConfigUpdate(transactionBuilder, nodeIid, data, key, extraData);
}
public void doDeviceTransaction(TransactionBuilder transaction, InstanceIdentifier<Node> nodeIid, T data,
- InstanceIdentifier key, Object... extraData) {
+ InstanceIdentifier key, Object... extraData) {
//tobe removed as part of refactoring patch
}
public void onConfigUpdate(TransactionBuilder transaction, InstanceIdentifier<Node> nodeIid, T data,
- InstanceIdentifier key, Object... extraData) {
+ InstanceIdentifier key, Object... extraData) {
//tobe removed as part of refactoring patch
}
- protected Aug getAugmentation(Node node) {
+ protected A getAugmentation(Node node) {
if (node == null) {
return null;
}
ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
- Class<? extends Augmentation<Node>> augType = (Class<? extends Augmentation<Node>>) parameterizedType.getActualTypeArguments()[1];
+ Class<? extends Augmentation<Node>> augType =
+ (Class<? extends Augmentation<Node>>) parameterizedType.getActualTypeArguments()[1];
Augmentation<Node> augmentation = node.getAugmentation(augType);
- return (Aug)augmentation;
+ return (A) augmentation;
}
- protected List<T> getData(Aug augmentation) {
+ protected List<T> getData(A augmentation) {
return Collections.EMPTY_LIST;
}
protected List<T> getData(Node node) {
- Aug augmentation = getAugmentation(node);
+ A augmentation = getAugmentation(node);
if (augmentation != null) {
List<T> data = getData(augmentation);
if (data != null) {
return result;
}
- List<T> getCascadeDeleteData(DataTreeModification<Node> change) {
+ List<T> getCascadeDeleteData(DataTreeModification<Node> change) {
if (!cascadeDelete()) {
return Collections.EMPTY_LIST;
}
List<T> updatedData = getData(updatedNode);
Set<InstanceIdentifier> deleted = getOperationalState().getDeletedKeysInCurrentTx(LogicalSwitches.class);
UnMetDependencyGetter dependencyGetter = getDependencyGetter();
- if (!HwvtepSouthboundUtil.isEmpty(deleted) && !HwvtepSouthboundUtil.isEmpty(updatedData) && dependencyGetter != null) {
+ if (!HwvtepSouthboundUtil.isEmpty(deleted) && !HwvtepSouthboundUtil.isEmpty(updatedData)
+ && dependencyGetter != null) {
List<T> removed = new ArrayList<>();
for (T ele : updatedData) {
if (deleted.containsAll(dependencyGetter.getLogicalSwitchDependencies(ele))) {
Iterator<T> it1 = list1.iterator();
- while(it1.hasNext()) {
+ while (it1.hasNext()) {
T ele = it1.next();
Iterator<T> it2 = list2.iterator();
boolean found = false;
while (it2.hasNext()) {
- T other = it2.next();
+ T other = it2.next();
found = compareKeyOnly ? Objects.equals(ele.getKey(), other.getKey()) : areEqual(ele, other);
- if ( found ) {
+ if (found) {
it2.remove();
break;
}
protected Type getClassType() {
Type type = getClass().getGenericSuperclass();
- Type classType = ((ParameterizedType)type).getActualTypeArguments()[0];
+ Type classType = ((ParameterizedType) type).getActualTypeArguments()[0];
return classType;
}
- protected boolean areEqual(T a , T b) {
+ protected boolean areEqual(T a, T b) {
return a.getKey().equals(b.getKey());
}
/**
* Tells if this object needs to be deleted if its dependent object gets deleted
* Ex : LocalUcastMac and LocalMacstMac
+ *
* @return true if this object needs to be deleted if its dependent object gets deleted
*/
protected boolean cascadeDelete() {
return;
}
for (MdsalUpdate mdsalUpdate : updates.get(deviceTransaction)) {
- getDeviceInfo().clearInTransit((Class<? extends Identifiable>)mdsalUpdate.getClass(), mdsalUpdate.getKey());
+ getDeviceInfo().clearInTransit((Class<? extends Identifiable>) mdsalUpdate.getClass(),
+ mdsalUpdate.getKey());
}
onCommandFailed();
}
import java.util.Map;
/**
- * Utility class to retrieve the unmet dependencies (config/operational) of the given object
+ * Utility class to retrieve the unmet dependencies (config/operational) of the given object.
+ *
* @param <T>
*/
public abstract class UnMetDependencyGetter<T extends Identifiable> {
/**
* Returns the iids this data depends upon
- * which are already intransit in the previous transaction if any
- * @param opState The operatonal state
- * @param data The data object
- * @return The depenencies
+ * which are already intransit in the previous transaction if any.
+ *
+ * @param opState The operatonal state
+ * @param data The data object
+ * @return The depenencies
*/
public Map<Class<? extends Identifiable>, List<InstanceIdentifier>> getInTransitDependencies(
HwvtepOperationalState opState, T data) {
/**
* Returns the iids this data depends upon
- * which are not yet present in the config data store if any
- * @param opState The operatonal state
- * @param data The data object
+ * which are not yet present in the config data store if any.
+ *
+ * @param opState The operatonal state
+ * @param data The data object
* @return the depenencies
*/
public Map<Class<? extends Identifiable>, List<InstanceIdentifier>> getUnMetConfigDependencies(
}
abstract boolean isDependencyMet(HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo,
- Class<? extends Identifiable> cls, InstanceIdentifier<? extends DataObject> key);
+ Class<? extends Identifiable> cls, InstanceIdentifier<? extends DataObject> key);
}
class ConfigDependencyGetter extends DependencyGetter {
boolean isDependencyMet(HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo,
- Class<? extends Identifiable> cls, InstanceIdentifier<? extends DataObject> key) {
+ Class<? extends Identifiable> cls, InstanceIdentifier<? extends DataObject> key) {
return deviceInfo.isConfigDataAvailable(cls, key) || isConfigDataAvailable(opState, key);
}
class InTransitDependencyGetter extends DependencyGetter {
boolean isDependencyMet(HwvtepOperationalState opState, HwvtepDeviceInfo deviceInfo,
- Class<? extends Identifiable> cls, InstanceIdentifier<? extends DataObject> key) {
+ Class<? extends Identifiable> cls, InstanceIdentifier<? extends DataObject> key) {
return opState.isKeyPartOfCurrentTx(cls, key) || !deviceInfo.isKeyInTransit(cls, key);
}
}
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepDeviceInfo;
import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfo;
import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.Identifiable;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public abstract class AbstractTransactionCommand<T extends DataObject> implements TransactionCommand{
+public abstract class AbstractTransactionCommand<T extends DataObject> implements TransactionCommand {
private TableUpdates updates;
private DatabaseSchema dbSchema;
return key;
}
- public AbstractTransactionCommand(HwvtepConnectionInstance key,TableUpdates updates, DatabaseSchema dbSchema) {
+ public AbstractTransactionCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
this.updates = updates;
this.dbSchema = dbSchema;
this.key = key;
package org.opendaylight.ovsdb.hwvtepsouthbound;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
+import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
+import static org.powermock.api.support.membermodification.MemberMatcher.field;
+import static org.powermock.api.support.membermodification.MemberModifier.suppress;
+
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.util.concurrent.ListenableFuture;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.InetAddress;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.After;
import org.junit.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.net.InetAddress;
-import java.util.List;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION;
-import static org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL;
-import static org.powermock.api.support.membermodification.MemberMatcher.field;
-import static org.powermock.api.support.membermodification.MemberModifier.suppress;
-
public class DataChangeListenerTestBase extends AbstractDataBrokerTest {
static Logger LOG = LoggerFactory.getLogger(DataChangeListenerTestBase.class);
entityOwnershipService = mock(EntityOwnershipService.class);
nodeUuid = java.util.UUID.randomUUID().toString();
nodeIid = createInstanceIdentifier(nodeUuid);
- ls0Iid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
- child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName("ls0")));
- ls1Iid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
- child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName("ls1")));
+ ls0Iid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(LogicalSwitches.class,
+ new LogicalSwitchesKey(new HwvtepNodeName("ls0")));
+ ls1Iid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(LogicalSwitches.class,
+ new LogicalSwitchesKey(new HwvtepNodeName("ls1")));
loadSchema();
mockConnectionInstance();
mockConnectionManager();
}
void setFinalStatic(Class cls, String fieldName, Object newValue) throws Exception {
- Field fields[] = FieldUtils.getAllFields(cls);
+ Field[] fields = FieldUtils.getAllFields(cls);
for (Field field : fields) {
if (fieldName.equals(field.getName())) {
field.setAccessible(true);
}
void loadSchema() {
- try (InputStream resourceAsStream = DataChangeListenerTestBase.class.getResourceAsStream("hwvtep_schema.json")) {
+ try (InputStream resourceAsStream = DataChangeListenerTestBase.class.getResourceAsStream(
+ "hwvtep_schema.json")) {
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree(resourceAsStream);
dbSchema = DatabaseSchema.fromJson(HwvtepSchemaConstants.HARDWARE_VTEP,
jsonNode.get("result"));
listenableDbSchema = mock(ListenableFuture.class);
doReturn(dbSchema).when(listenableDbSchema).get();
- } catch (Exception e) {
+ } catch (IOException | ExecutionException | InterruptedException e) {
LOG.error("Failed to load schema", e);
}
}
hwvtepConnectionManager = PowerMockito.mock(HwvtepConnectionManager.class, Mockito.CALLS_REAL_METHODS);
field(HwvtepConnectionManager.class, "db").set(hwvtepConnectionManager, dataBroker);
field(HwvtepConnectionManager.class, "txInvoker").set(hwvtepConnectionManager, transactionInvoker);
- field(HwvtepConnectionManager.class, "entityOwnershipService").set(hwvtepConnectionManager, entityOwnershipService);
- suppress(PowerMockito.method(HwvtepConnectionManager.class, "getConnectionInstance", HwvtepPhysicalSwitchAttributes.class));
+ field(HwvtepConnectionManager.class, "entityOwnershipService").set(hwvtepConnectionManager,
+ entityOwnershipService);
+ suppress(PowerMockito.method(HwvtepConnectionManager.class, "getConnectionInstance",
+ HwvtepPhysicalSwitchAttributes.class));
suppress(PowerMockito.method(HwvtepConnectionManager.class, "getConnectionInstanceFromNodeIid",
InstanceIdentifier.class));
doReturn(connectionInstance).when(
doReturn(true).when(ovsdbClient).isActive();
doReturn(connectionInfo).when(ovsdbClient).getConnectionInfo();
- transactionInvoker = new TransactionInvokerImpl(dataBroker);
+ transactionInvoker = new TransactionInvokerImpl(dataBroker);
connectionInstance = PowerMockito.mock(HwvtepConnectionInstance.class, Mockito.CALLS_REAL_METHODS);
field(HwvtepConnectionInstance.class, "instanceIdentifier").set(connectionInstance, nodeIid);
doReturn(listenableDbSchema).when(connectionInstance).getSchema(anyString());
doReturn(dataBroker).when(connectionInstance).getDataBroker();
doReturn(nodeIid).when(connectionInstance).getInstanceIdentifier();
- field(HwvtepConnectionInstance.class, "deviceInfo").set(connectionInstance, new HwvtepDeviceInfo(connectionInstance));
+ field(HwvtepConnectionInstance.class, "deviceInfo").set(connectionInstance,
+ new HwvtepDeviceInfo(connectionInstance));
connectionInstance.createTransactInvokers();
}
}
/**
- * resets the captures so that we can validate the captors of the immediate next execution
+ * Resets the captures so that we can validate the captors of the immediate next execution.
*/
void resetOperations() {
insertOpCapture = ArgumentCaptor.forClass(TypedBaseTable.class);
- Update update = mock(Update.class);
- Insert insert = mock(Insert.class);
Delete delete = mock(Delete.class);
Where where = mock(Where.class);
doReturn(where).when(delete).where(any());
+ Insert insert = mock(Insert.class);
doReturn(insert).when(insert).withId(any(String.class));
Operations.op = PowerMockito.mock(Operations.class);
doReturn(insert).when(Operations.op).insert(insertOpCapture.capture());
+ Update update = mock(Update.class);
doReturn(update).when(Operations.op).update(insertOpCapture.capture());
doReturn(where).when(update).where(any());
doReturn(delete).when(Operations.op).delete(any());
}
Node addData(LogicalDatastoreType logicalDatastoreType, Class<? extends DataObject> dataObject,
- String[]... data) {
+ String[]... data) {
NodeBuilder nodeBuilder = prepareNode(nodeIid);
HwvtepGlobalAugmentationBuilder builder = new HwvtepGlobalAugmentationBuilder();
if (LogicalSwitches.class == dataObject) {
}
void deleteData(LogicalDatastoreType logicalDatastoreType, Class<? extends DataObject> dataObject,
- String[]... data) {
+ String[]... data) {
NodeBuilder nodeBuilder = prepareNode(nodeIid);
ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
HwvtepGlobalAugmentationBuilder builder = new HwvtepGlobalAugmentationBuilder();
List<LogicalSwitches> logicalSwitches = TestBuilders.addLogicalSwitches(builder, data);
for (LogicalSwitches ls : logicalSwitches) {
- InstanceIdentifier<LogicalSwitches> key = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
- child(LogicalSwitches.class, ls.getKey());
+ InstanceIdentifier<LogicalSwitches> key =
+ nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(LogicalSwitches.class, ls.getKey());
tx.delete(logicalDatastoreType, key);
}
}
if (RemoteUcastMacs.class == dataObject) {
List<RemoteUcastMacs> macs = TestBuilders.addRemoteUcastMacs(nodeIid, builder, data);
for (RemoteUcastMacs mac : macs) {
- InstanceIdentifier<RemoteUcastMacs> key = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
- child(RemoteUcastMacs.class, mac.getKey());
+ InstanceIdentifier<RemoteUcastMacs> key =
+ nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(RemoteUcastMacs.class, mac.getKey());
tx.delete(logicalDatastoreType, key);
}
}
if (RemoteMcastMacs.class == dataObject) {
List<RemoteMcastMacs> macs = TestBuilders.addRemoteMcastMacs(nodeIid, builder, data);
for (RemoteMcastMacs mac : macs) {
- InstanceIdentifier<RemoteMcastMacs> key = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
- child(RemoteMcastMacs.class, mac.getKey());
+ InstanceIdentifier<RemoteMcastMacs> key =
+ nodeIid.augmentation(HwvtepGlobalAugmentation.class).child(RemoteMcastMacs.class, mac.getKey());
tx.delete(logicalDatastoreType, key);
}
}
Map<Class<? extends Identifiable>, List<InstanceIdentifier>> unMetDependencies;
void setupForTest() {
- MCAST_MAC_DATA_VALIDATOR = Whitebox.getInternalState(McastMacsRemoteUpdateCommand.class, UnMetDependencyGetter.class);
+ MCAST_MAC_DATA_VALIDATOR =
+ Whitebox.getInternalState(McastMacsRemoteUpdateCommand.class, UnMetDependencyGetter.class);
opState = new HwvtepOperationalState(connectionInstance);
- mac = TestBuilders.buildRemoteMcastMacs(nodeIid,"FF:FF:FF:FF:FF:FF", "ls0",
- new String[]{"192.168.122.20", "192.168.122.30"});
+ mac = TestBuilders.buildRemoteMcastMacs(nodeIid, "FF:FF:FF:FF:FF:FF", "ls0",
+ new String[] {"192.168.122.20", "192.168.122.30"});
lsIid = nodeIid.augmentation(HwvtepGlobalAugmentation.class).
child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName("ls0")));
}
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Function;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import org.opendaylight.ovsdb.lib.operations.Operation;
import org.opendaylight.ovsdb.lib.operations.OperationResult;
-public class FutureTransformUtils {
+public final class FutureTransformUtils {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private FutureTransformUtils() {
}
- public static final ListenableFuture<List<OperationResult>> transformTransactResponse(
+ public static ListenableFuture<List<OperationResult>> transformTransactResponse(
ListenableFuture<List<JsonNode>> transactResponseFuture, final List<Operation> operations) {
OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- return Futures.transform(transactResponseFuture,
- (Function<List<JsonNode>, List<OperationResult>>) jsonNodes -> {
- final List<OperationResult> operationResults = new ArrayList<>();
- for (int index = 0; index < jsonNodes.size(); index++) {
- JsonNode jsonNode = jsonNodes.get(index);
- OperationResult or;
- if (jsonNode != null && jsonNode.size() > 0) {
- /*
- * As per RFC 7047, section 4.1.3 :
- * "In general, "result" contains some number of successful results,
- * possibly followed by an error, in turn followed by enough JSON null
- * values to match the number of elements in "params". There is one
- * exception: if all of the operations succeed, but the results cannot
- * be committed, then "result" will have one more element than "params",
- * with the additional element being an <error>."
- *
- * Hence, it is possible for a transaction response to contain more
- * json elements than the transaction operation request.
- * Also handle that case by checking for i < operations.size().
- */
- if (index < operations.size()) {
- Operation op = operations.get(index);
- switch (op.getOp()) {
- case "select":
- or = new OperationResult();
- or.setRows(op.getTableSchema().createRows(jsonNode));
- break;
+ return Futures.transform(transactResponseFuture, jsonNodes -> {
+ final List<OperationResult> operationResults = new ArrayList<>();
+ for (int index = 0; index < jsonNodes.size(); index++) {
+ JsonNode jsonNode = jsonNodes.get(index);
+ OperationResult or;
+ if (jsonNode != null && jsonNode.size() > 0) {
+ /*
+ * As per RFC 7047, section 4.1.3 :
+ * "In general, "result" contains some number of successful results,
+ * possibly followed by an error, in turn followed by enough JSON null
+ * values to match the number of elements in "params". There is one
+ * exception: if all of the operations succeed, but the results cannot
+ * be committed, then "result" will have one more element than "params",
+ * with the additional element being an <error>."
+ *
+ * Hence, it is possible for a transaction response to contain more
+ * json elements than the transaction operation request.
+ * Also handle that case by checking for i < operations.size().
+ */
+ if (index < operations.size()) {
+ Operation op = operations.get(index);
+ switch (op.getOp()) {
+ case "select":
+ or = new OperationResult();
+ or.setRows(op.getTableSchema().createRows(jsonNode));
+ break;
- default:
- or = OBJECT_MAPPER.convertValue(jsonNode, OperationResult.class);
+ default:
+ or = OBJECT_MAPPER.convertValue(jsonNode, OperationResult.class);
- break;
- }
- } else {
- or = OBJECT_MAPPER.convertValue(jsonNode, OperationResult.class);
+ break;
}
} else {
- or = new OperationResult();
+ or = OBJECT_MAPPER.convertValue(jsonNode, OperationResult.class);
}
- operationResults.add(or);
+ } else {
+ or = new OperationResult();
}
+ operationResults.add(or);
+ }
- return operationResults;
- });
+ return operationResults;
+ });
}
}
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
-public class JsonUtils {
+public final class JsonUtils {
private static ObjectMapper mapper = new ObjectMapper();
private static ObjectWriter prettyWriter = mapper.writerWithDefaultPrettyPrinter();
return this;
}
- public MonitorRequestBuilder<E> addColumns(Collection<String> columns) {
- this.columns.addAll(columns);
+ public MonitorRequestBuilder<E> addColumns(Collection<String> extraColumns) {
+ this.columns.addAll(extraColumns);
return this;
}
- public MonitorRequestBuilder<E> addColumns(List<ColumnSchema<E, ?>> columns) {
- for (ColumnSchema<E, ?> schema : columns) {
+ public MonitorRequestBuilder<E> addColumns(List<ColumnSchema<E, ?>> extraColumns) {
+ for (ColumnSchema<E, ?> schema : extraColumns) {
this.addColumn(schema);
}
return this;
return this.columns;
}
- public MonitorRequestBuilder<E> with(MonitorSelect select) {
- this.select = select;
+ public MonitorRequestBuilder<E> with(MonitorSelect what) {
+ this.select = what;
return this;
}
import org.opendaylight.ovsdb.lib.notation.OvsdbSet;
import org.opendaylight.ovsdb.lib.notation.UUID;
-public class Converter {
+public final class Converter {
static AtomDeser atomDeser = new AtomDeser();
static MapDeser mapDeser = new MapDeser();
/**
* Utility methods for typed OVSDB schema data.
*/
-public class TyperUtils {
+public final class TyperUtils {
private static final String GET_STARTS_WITH = "get";
private static final String SET_STARTS_WITH = "set";
* @param to The maximum supported version.
* @throws SchemaVersionMismatchException if the schema version isn't supported.
*/
+ // We extract the real cause, which “loses” the original cause, but that’s fine
+ @SuppressWarnings("checkstyle:AvoidHidingCauseException")
private void callCheckVersion(Version schema, Version from, Version to) throws SchemaVersionMismatchException {
try {
Method method =
* VersionIncompatibleBridge is used to test the Version Compatibility logic in the Library
* with an absurdly low fromVersion and untilVersion which will fail for all the OVS versions.
*/
-@TypedTable(name="Bridge", database="Open_vSwitch", fromVersion="0.0.1", untilVersion="0.0.2")
+@TypedTable(name = "Bridge", database = "Open_vSwitch", fromVersion = "0.0.1", untilVersion = "0.0.2")
public interface VersionIncompatibleBridge extends TypedBaseTable {
}
package org.opendaylight.ovsdb.schema.hardwarevtep;
import java.util.Map;
-
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-@TypedTable(name="ACL", database="hardware_vtep", fromVersion="1.4.0")
+@TypedTable(name = "ACL", database = "hardware_vtep", fromVersion = "1.4.0")
public interface ACL extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="acl_name", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_name", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, String> getAclNameColumn();
- @TypedColumn(name="acl_name", method=MethodType.GETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_name", method = MethodType.GETDATA, fromVersion = "1.4.0")
String getAclName();
- @TypedColumn(name="acl_name", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_name", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setAclName(String aclName);
- @TypedColumn(name="acl_entries", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_entries", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, UUID> getAclEntriesColumn();
- @TypedColumn(name="acl_entries", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_entries", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setAclEntry(UUID aclEntry);
- @TypedColumn(name="acl_fault_status", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_fault_status", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Map<String, String>> getAclFaultStatusColumn();
- @TypedColumn(name="acl_fault_status", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "acl_fault_status", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setAclFaultStatus(Map<String, String> aclFaultStatus);
}
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-@TypedTable(name="ACL_entry", database="hardware_vtep", fromVersion="1.4.0")
+@TypedTable(name = "ACL_entry", database = "hardware_vtep", fromVersion = "1.4.0")
public interface ACLEntry extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="sequence", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "sequence", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Long> getSequenceColumn();
- @TypedColumn(name="sequence", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "sequence", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setSequence(Long sequence);
- @TypedColumn(name="source_mac", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "source_mac", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getSourceMacColumn();
- @TypedColumn(name="source_mac", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "source_mac", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setSourceMac(Set<String> sourceMac);
- @TypedColumn(name="dest_mac", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_mac", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getDestMacColumn();
- @TypedColumn(name="dest_mac", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_mac", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setDestMac(Set<String> destMac);
- @TypedColumn(name="ethertype", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "ethertype", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getEtherTypeColumn();
- @TypedColumn(name="ethertype", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "ethertype", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setEtherType(Set<String> etherType);
- @TypedColumn(name="source_ip", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "source_ip", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getSourceIpColumn();
- @TypedColumn(name="source_ip", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "source_ip", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setSourceIp(Set<String> sourceIp);
- @TypedColumn(name="source_mask", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "source_mask", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getSourceMaskColumn();
- @TypedColumn(name="source_mask", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "source_mask", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setSourceMask(Set<String> sourceMask);
- @TypedColumn(name="dest_ip", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_ip", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getDestIpColumn();
- @TypedColumn(name="dest_ip", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_ip", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setDestIp(Set<String> destIp);
- @TypedColumn(name="dest_mask", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_mask", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getDestMaskColumn();
- @TypedColumn(name="dest_mask", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_mask", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setDestMask(Set<String> destMask);
- @TypedColumn(name="protocol", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "protocol", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getProtocolColumn();
- @TypedColumn(name="protocol", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "protocol", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setProtocol(Set<Long> protocol);
- @TypedColumn(name="source_port_min", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "source_port_min", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getSourcePortMinColumn();
- @TypedColumn(name="source_port_min", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "source_port_min", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setSourcePortMin(Set<Long> sourcePortMin);
- @TypedColumn(name="source_port_max", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "source_port_max", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getSourcePortMaxColumn();
- @TypedColumn(name="source_port_max", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "source_port_max", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setSourcePortMax(Set<Long> sourcePortMax);
- @TypedColumn(name="dest_port_min", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_port_min", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getDestPortMinColumn();
- @TypedColumn(name="dest_port_min", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_port_min", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setDestPortMin(Set<Long> destPortMin);
- @TypedColumn(name="dest_port_max", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_port_max", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getDestPortMaxColumn();
- @TypedColumn(name="dest_port_max", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "dest_port_max", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setDestPortMax(Set<Long> destPortMax);
- @TypedColumn(name="tcp_flags", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "tcp_flags", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getTcpFlagsColumn();
- @TypedColumn(name="tcp_flags", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "tcp_flags", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setTcpFlags(Set<Long> tcpFlags);
- @TypedColumn(name="tcp_flags_mask", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "tcp_flags_mask", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getTcpFlagsMaskColumn();
- @TypedColumn(name="tcp_flags_mask", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "tcp_flags_mask", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setTcpFlagsMask(Set<Long> tcpFlagsMask);
- @TypedColumn(name="icmp_code", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "icmp_code", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getIcmpCodeColumn();
- @TypedColumn(name="icmp_code", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "icmp_code", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setIcmpCode(Set<Long> icmpCode);
- @TypedColumn(name="icmp_type", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "icmp_type", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<Long>> getIcmpTypeColumn();
- @TypedColumn(name="icmp_type", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "icmp_type", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setIcmpType(Set<Long> icmpType);
- @TypedColumn(name="direction", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "direction", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getDirectionColumn();
- @TypedColumn(name="direction", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "direction", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setDirection(Set<String> direction);
- @TypedColumn(name="action", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "action", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Set<String>> getActionColumn();
- @TypedColumn(name="action", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "action", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setAction(Set<String> action);
- @TypedColumn(name="acle_fault_status", method=MethodType.GETCOLUMN, fromVersion="1.4.0")
+ @TypedColumn(name = "acle_fault_status", method = MethodType.GETCOLUMN, fromVersion = "1.4.0")
Column<GenericTableSchema, Map<String, String>> getAcleFaultStatusColumn();
- @TypedColumn(name="acle_fault_status", method=MethodType.SETDATA, fromVersion="1.4.0")
+ @TypedColumn(name = "acle_fault_status", method = MethodType.SETDATA, fromVersion = "1.4.0")
void setAcleFaultStatus(Map<String, String> acleFaultStatus);
}
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-@TypedTable(name="Arp_Sources_Local", database="hardware_vtep", fromVersion="1.2.0")
+@TypedTable(name = "Arp_Sources_Local", database = "hardware_vtep", fromVersion = "1.2.0")
public interface ArpSourcesLocal extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="src_mac", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+ @TypedColumn(name = "src_mac", method = MethodType.GETCOLUMN, fromVersion = "1.2.0")
Column<GenericTableSchema, String> getSrcMacColumn();
- @TypedColumn(name="src_mac", method=MethodType.GETDATA, fromVersion="1.2.0")
+ @TypedColumn(name = "src_mac", method = MethodType.GETDATA, fromVersion = "1.2.0")
String getSrcMac();
- @TypedColumn(name="src_mac", method=MethodType.SETDATA, fromVersion="1.2.0")
+ @TypedColumn(name = "src_mac", method = MethodType.SETDATA, fromVersion = "1.2.0")
void setSrcMac(String srcMac);
- @TypedColumn(name="locator", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+ @TypedColumn(name = "locator", method = MethodType.GETCOLUMN, fromVersion = "1.2.0")
Column<GenericTableSchema, UUID> getLocatorColumn();
- @TypedColumn(name="locator", method=MethodType.SETDATA, fromVersion="1.2.0")
+ @TypedColumn(name = "locator", method = MethodType.SETDATA, fromVersion = "1.2.0")
void setLocator(UUID locator);
}
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-@TypedTable(name="Arp_Sources_Remote", database="hardware_vtep", fromVersion="1.2.0")
+@TypedTable(name = "Arp_Sources_Remote", database = "hardware_vtep", fromVersion = "1.2.0")
public interface ArpSourcesRemote extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="src_mac", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+ @TypedColumn(name = "src_mac", method = MethodType.GETCOLUMN, fromVersion = "1.2.0")
Column<GenericTableSchema, String> getSrcMacColumn();
- @TypedColumn(name="src_mac", method=MethodType.GETDATA, fromVersion="1.2.0")
+ @TypedColumn(name = "src_mac", method = MethodType.GETDATA, fromVersion = "1.2.0")
String getSrcMac();
- @TypedColumn(name="src_mac", method=MethodType.SETDATA, fromVersion="1.2.0")
+ @TypedColumn(name = "src_mac", method = MethodType.SETDATA, fromVersion = "1.2.0")
void setSrcMac(String srcMac);
- @TypedColumn(name="locator", method=MethodType.GETCOLUMN, fromVersion="1.2.0")
+ @TypedColumn(name = "locator", method = MethodType.GETCOLUMN, fromVersion = "1.2.0")
Column<GenericTableSchema, UUID> getLocatorColumn();
- @TypedColumn(name="locator", method=MethodType.SETDATA, fromVersion="1.2.0")
+ @TypedColumn(name = "locator", method = MethodType.SETDATA, fromVersion = "1.2.0")
void setLocator(UUID locator);
}
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-@TypedTable(name="Global", database="hardware_vtep", fromVersion="1.0.0")
+@TypedTable(name = "Global", database = "hardware_vtep", fromVersion = "1.0.0")
public interface Global extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="managers", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "managers", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getManagersColumn();
- @TypedColumn(name="managers", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "managers", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setManagers(Set<UUID> managers);
- @TypedColumn(name="switches", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "switches", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getSwitchesColumn();
- @TypedColumn(name="switches", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "switches", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setSwitches(Set<UUID> switches);
- @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="1.7.0")
+ @TypedColumn(name = "other_config", method = MethodType.GETCOLUMN, fromVersion = "1.7.0")
Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
- @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="1.7.0")
+ @TypedColumn(name = "other_config", method = MethodType.SETDATA, fromVersion = "1.7.0")
void setOtherConfig(Map<String, String> otherConfig);
}
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
/**
- * This class is a typed interface to the AutoAttach Table
+ * This class is a typed interface to the AutoAttach Table.
*/
-@TypedTable(name="AutoAttach", database="Open_vSwitch", fromVersion="7.11.2")
+@TypedTable(name = "AutoAttach", database = "Open_vSwitch", fromVersion = "7.11.2")
public interface AutoAttach extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="system_name", method=MethodType.GETCOLUMN, fromVersion="7.11.2")
+ @TypedColumn(name = "system_name", method = MethodType.GETCOLUMN, fromVersion = "7.11.2")
Column<GenericTableSchema, String> getSystemNameColumn();
- @TypedColumn(name="system_name", method=MethodType.SETDATA, fromVersion="7.11.2")
+
+ @TypedColumn(name = "system_name", method = MethodType.SETDATA, fromVersion = "7.11.2")
void setSystemName(String systemName);
- @TypedColumn(name="system_description", method=MethodType.GETCOLUMN, fromVersion="7.11.2")
+ @TypedColumn(name = "system_description", method = MethodType.GETCOLUMN, fromVersion = "7.11.2")
Column<GenericTableSchema, String> getSystemDescriptionColumn();
- @TypedColumn(name="system_description", method=MethodType.SETDATA, fromVersion="7.11.2")
+
+ @TypedColumn(name = "system_description", method = MethodType.SETDATA, fromVersion = "7.11.2")
void setSystemDescription(String systemDescription);
- @TypedColumn(name="mappings", method=MethodType.GETCOLUMN, fromVersion="7.11.2")
+ @TypedColumn(name = "mappings", method = MethodType.GETCOLUMN, fromVersion = "7.11.2")
Column<GenericTableSchema, Map<Long, Long>> getMappingsColumn();
- @TypedColumn(name="mappings", method=MethodType.SETDATA, fromVersion="7.11.2")
+
+ @TypedColumn(name = "mappings", method = MethodType.SETDATA, fromVersion = "7.11.2")
void setMappings(Map<Long, Long> mappings);
// FIXME: To be uncommented when Open vSwitch supports external_ids column
*/
package org.opendaylight.ovsdb.schema.openvswitch;
+
import java.util.Map;
import java.util.Set;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
/**
- * This class is a typed interface to the Bridge Table
+ * This class is a typed interface to the Bridge Table.
*/
-@TypedTable(name="Bridge", database="Open_vSwitch", fromVersion="1.0.0")
+@TypedTable(name = "Bridge", database = "Open_vSwitch", fromVersion = "1.0.0")
public interface Bridge extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "name", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, String> getNameColumn();
- @TypedColumn(name="name", method=MethodType.GETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "name", method = MethodType.GETDATA, fromVersion = "1.0.0")
String getName();
- @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "name", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setName(String name);
- @TypedColumn(name="datapath_type", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "datapath_type", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, String> getDatapathTypeColumn();
- @TypedColumn(name="datapath_type", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "datapath_type", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setDatapathType(String datapathType);
- @TypedColumn(name="datapath_id", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "datapath_id", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<String>> getDatapathIdColumn();
- @TypedColumn(name="datapath_id", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "datapath_id", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setDatapathId(Set<String> datapathId);
- @TypedColumn(name="stp_enable", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+ @TypedColumn(name = "stp_enable", method = MethodType.GETCOLUMN, fromVersion = "6.2.0")
Column<GenericTableSchema, Boolean> getStpEnableColumn();
- @TypedColumn(name="stp_enable", method=MethodType.SETDATA, fromVersion="6.2.0")
- void setStpEnable(Boolean stp_enable);
+ @TypedColumn(name = "stp_enable", method = MethodType.SETDATA, fromVersion = "6.2.0")
+ void setStpEnable(Boolean stpEnable);
- @TypedColumn(name="ports", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "ports", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getPortsColumn();
- @TypedColumn(name="ports", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "ports", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setPorts(Set<UUID> ports);
- @TypedColumn(name="mirrors", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "mirrors", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getMirrorsColumn();
- @TypedColumn(name="mirrors", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "mirrors", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setMirrors(Set<UUID> mirrors);
- @TypedColumn(name="netflow", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "netflow", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getNetflowColumn();
- @TypedColumn(name="netflow", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "netflow", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setNetflow(Set<UUID> netflow);
- @TypedColumn(name="sflow", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "sflow", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getSflowColumn();
- @TypedColumn(name="sflow", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "sflow", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setSflow(Set<UUID> sflow);
- @TypedColumn(name="ipfix", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+ @TypedColumn(name = "ipfix", method = MethodType.GETCOLUMN, fromVersion = "7.1.0")
Column<GenericTableSchema, Set<UUID>> getIpfixColumn();
- @TypedColumn(name="ipfix", method=MethodType.SETDATA, fromVersion="7.1.0")
+ @TypedColumn(name = "ipfix", method = MethodType.SETDATA, fromVersion = "7.1.0")
void setIpfix(Set<UUID> ipfix);
- @TypedColumn(name="controller", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "controller", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<UUID>> getControllerColumn();
- @TypedColumn(name="controller", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "controller", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setController(Set<UUID> controller);
- @TypedColumn(name="protocols", method=MethodType.GETCOLUMN, fromVersion="6.11.1")
+ @TypedColumn(name = "protocols", method = MethodType.GETCOLUMN, fromVersion = "6.11.1")
Column<GenericTableSchema, Set<String>> getProtocolsColumn();
- @TypedColumn(name="protocols", method=MethodType.SETDATA, fromVersion="6.11.1")
+ @TypedColumn(name = "protocols", method = MethodType.SETDATA, fromVersion = "6.11.1")
void setProtocols(Set<String> protocols);
- @TypedColumn(name="fail_mode", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "fail_mode", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<String>> getFailModeColumn();
- @TypedColumn(name="fail_mode", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "fail_mode", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setFailMode(Set<String> failMode);
- @TypedColumn(name="status", method=MethodType.GETCOLUMN, fromVersion="6.2.0")
+ @TypedColumn(name = "status", method = MethodType.GETCOLUMN, fromVersion = "6.2.0")
Column<GenericTableSchema, Map<String, String>> getStatusColumn();
- @TypedColumn(name="status", method=MethodType.SETDATA, fromVersion="6.2.0")
+ @TypedColumn(name = "status", method = MethodType.SETDATA, fromVersion = "6.2.0")
void setStatus(Map<String, String> status);
- @TypedColumn(name="other_config", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "other_config", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
- @TypedColumn(name="other_config", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "other_config", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setOtherConfig(Map<String, String> otherConfig);
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
- @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "external_ids", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setExternalIds(Map<String, String> externalIds);
- @TypedColumn(name="flood_vlans", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
+ @TypedColumn(name = "flood_vlans", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<Long>> getFloodVlansColumn();
- @TypedColumn(name="flood_vlans", method=MethodType.SETDATA, fromVersion="1.0.0")
+ @TypedColumn(name = "flood_vlans", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setFloodVlans(Set<Long> vlans);
- @TypedColumn(name="flow_tables", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+ @TypedColumn(name = "flow_tables", method = MethodType.GETCOLUMN, fromVersion = "6.5.0")
Column<GenericTableSchema, Map<Long, UUID>> getFlowTablesColumn();
- @TypedColumn(name="flow_tables", method=MethodType.SETDATA, fromVersion="6.5.0")
+ @TypedColumn(name = "flow_tables", method = MethodType.SETDATA, fromVersion = "6.5.0")
void setFlowTables(Map<Long, UUID> flowTables);
- @TypedColumn(name="auto_attach", method=MethodType.GETCOLUMN, fromVersion="7.11.2")
+ @TypedColumn(name = "auto_attach", method = MethodType.GETCOLUMN, fromVersion = "7.11.2")
Column<GenericTableSchema, Set<UUID>> getAutoAttachColumn();
- @TypedColumn(name="auto_attach", method=MethodType.SETDATA, fromVersion="7.11.2")
+ @TypedColumn(name = "auto_attach", method = MethodType.SETDATA, fromVersion = "7.11.2")
void setAutoAttach(Set<UUID> autoAttach);
}
* Reusing the existing Table definitions and many of columns are not defined here
* TODO : Fill up the missing Columns and include Supported DB Version
*/
-@TypedTable(name="Capability", database="Open_vSwitch")
+@TypedTable(name = "Capability", database = "Open_vSwitch")
public interface Capability extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="details", method=MethodType.GETCOLUMN)
+ @TypedColumn(name = "details", method = MethodType.GETCOLUMN)
Column<GenericTableSchema, Map<String, String>> getDetailsColumn();
- @TypedColumn(name="details", method=MethodType.SETDATA)
+ @TypedColumn(name = "details", method = MethodType.SETDATA)
void setDetails(Map<String, String> details);
}
package org.opendaylight.ovsdb.schema.openvswitch;
+import java.util.Map;
+import java.util.Set;
import org.opendaylight.ovsdb.lib.notation.Column;
import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
import org.opendaylight.ovsdb.lib.schema.typed.MethodType;
import org.opendaylight.ovsdb.lib.schema.typed.TypedColumn;
import org.opendaylight.ovsdb.lib.schema.typed.TypedTable;
-import java.util.Map;
-import java.util.Set;
-
/**
- * This class is a typed interface to the Controller Table
+ * This class is a typed interface to the Controller Table.
*/
-@TypedTable (name="Controller", database="Open_vSwitch", fromVersion="1.0.0")
+@TypedTable(name = "Controller", database = "Open_vSwitch", fromVersion = "1.0.0")
public interface Controller extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn (name = "target", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "target", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, String> getTargetColumn();
- @TypedColumn (name = "target", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "target", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setTarget(String target);
- @TypedColumn (name = "controller_burst_limit", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "controller_burst_limit", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Long> getBurstLimitColumn();
- @TypedColumn (name = "controller_burst_limit", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "controller_burst_limit", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setBurstLimit(Long burstLimit);
- @TypedColumn (name = "controller_rate_limit", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "controller_rate_limit", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Long> getRateLimitColumn();
- @TypedColumn (name = "controller_rate_limit", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "controller_rate_limit", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setRateLimit(Long rateLimit);
- @TypedColumn (name = "connection_mode", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "connection_mode", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<String>> getConnectionModeColumn();
- @TypedColumn (name = "connection_mode", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "connection_mode", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setConnectionMode(Set<String> connectionMode);
- @TypedColumn (name = "enable_async_messages", method = MethodType.GETCOLUMN, fromVersion = "6.7.0")
+ @TypedColumn(name = "enable_async_messages", method = MethodType.GETCOLUMN, fromVersion = "6.7.0")
Column<GenericTableSchema, Set<Boolean>> getEnableAsyncMessagesColumn();
- @TypedColumn (name = "enable_async_messages", method = MethodType.SETDATA, fromVersion = "6.7.0")
+ @TypedColumn(name = "enable_async_messages", method = MethodType.SETDATA, fromVersion = "6.7.0")
void setEnableAsyncMessages(Set<Boolean> enableAsyncMessages);
- @TypedColumn (name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
- @TypedColumn (name = "external_ids", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "external_ids", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setExternalIds(Map<String, String> externalIds);
- @TypedColumn (name = "local_netmask", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "local_netmask", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<String>> getLocalNetmaskColumn();
- @TypedColumn (name = "local_netmask", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "local_netmask", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setLocalNetmask(Set<String> localNetmask);
- @TypedColumn (name = "local_gateway", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "local_gateway", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<String>> getLocalGatewayColumn();
- @TypedColumn (name = "local_gateway", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "local_gateway", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setLocalGateway(Set<String> localGateway);
- @TypedColumn (name = "status", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ @TypedColumn(name = "status", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
Column<GenericTableSchema, Map<String, String>> getStatusColumn();
- @TypedColumn (name = "status", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ @TypedColumn(name = "status", method = MethodType.SETDATA, fromVersion = "1.1.0")
void setStatus(Map<String, String> status);
- @TypedColumn (name = "role", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ @TypedColumn(name = "role", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
Column<GenericTableSchema, Set<String>> getRoleColumn();
- @TypedColumn (name = "role", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ @TypedColumn(name = "role", method = MethodType.SETDATA, fromVersion = "1.1.0")
void setRole(Set<String> role);
- @TypedColumn (name = "inactivity_probe", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "inactivity_probe", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<Long>> getInactivityProbeColumn();
- @TypedColumn (name = "inactivity_probe", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "inactivity_probe", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setInactivityProbe(Set<Long> inactivityProbe);
- @TypedColumn (name = "is_connected", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
+ @TypedColumn(name = "is_connected", method = MethodType.GETCOLUMN, fromVersion = "1.1.0")
Column<GenericTableSchema, Boolean> getIsConnectedColumn();
- @TypedColumn (name = "is_connected", method = MethodType.SETDATA, fromVersion = "1.1.0")
+ @TypedColumn(name = "is_connected", method = MethodType.SETDATA, fromVersion = "1.1.0")
void setIsConnected(Boolean isConnected);
- @TypedColumn (name = "other_config", method = MethodType.GETCOLUMN, fromVersion = "6.8.0")
+ @TypedColumn(name = "other_config", method = MethodType.GETCOLUMN, fromVersion = "6.8.0")
Column<GenericTableSchema, Map<String, String>> getOtherConfigColumn();
- @TypedColumn (name = "other_config", method = MethodType.SETDATA, fromVersion = "6.8.0")
+ @TypedColumn(name = "other_config", method = MethodType.SETDATA, fromVersion = "6.8.0")
void setOtherConfig(Map<String, String> otherConfig);
- @TypedColumn (name = "max_backoff", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "max_backoff", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<Long>> getMaxBackoffColumn();
- @TypedColumn (name = "max_backoff", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "max_backoff", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setMaxBackoff(Set<Long> maxBackoff);
- @TypedColumn (name = "local_ip", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
+ @TypedColumn(name = "local_ip", method = MethodType.GETCOLUMN, fromVersion = "1.0.0")
Column<GenericTableSchema, Set<String>> getLocalIpColumn();
- @TypedColumn (name = "local_ip", method = MethodType.SETDATA, fromVersion = "1.0.0")
+ @TypedColumn(name = "local_ip", method = MethodType.SETDATA, fromVersion = "1.0.0")
void setLocalIp(Set<String> localIp);
- @TypedColumn (name = "discover_update_resolv_conf", method = MethodType.GETCOLUMN,
- fromVersion="1.0.0", untilVersion="3.0.0")
+ @TypedColumn(name = "discover_update_resolv_conf", method = MethodType.GETCOLUMN,
+ fromVersion = "1.0.0", untilVersion = "3.0.0")
Column<GenericTableSchema, Set<String>> getDiscoverUpdateResolvConfColumn();
- @TypedColumn (name = "discover_update_resolv_conf", method = MethodType.SETDATA,
- fromVersion="1.0.0", untilVersion="3.0.0")
+ @TypedColumn(name = "discover_update_resolv_conf", method = MethodType.SETDATA,
+ fromVersion = "1.0.0", untilVersion = "3.0.0")
void setDiscoverUpdateResolvConf(Set<String> discoverUpdateResolvConf);
- @TypedColumn (name = "discover_accept_regex", method = MethodType.GETCOLUMN,
- fromVersion="1.0.0", untilVersion="3.0.0")
+ @TypedColumn(name = "discover_accept_regex", method = MethodType.GETCOLUMN,
+ fromVersion = "1.0.0", untilVersion = "3.0.0")
Column<GenericTableSchema, Set<String>> getDiscoverAcceptRegexColumn();
- @TypedColumn (name = "discover_accept_regex", method = MethodType.SETDATA,
- fromVersion="1.0.0", untilVersion="3.0.0")
+ @TypedColumn(name = "discover_accept_regex", method = MethodType.SETDATA,
+ fromVersion = "1.0.0", untilVersion = "3.0.0")
void setDiscoverAcceptRegex(Set<String> discoverAcceptRegex);
}
/**
* This class is a typed interface to the Flow_Sample_Collector_Set Table
*/
-@TypedTable(name="Flow_Sample_Collector_Set", database="Open_vSwitch", fromVersion="7.1.0")
+@TypedTable(name = "Flow_Sample_Collector_Set", database = "Open_vSwitch", fromVersion = "7.1.0")
public interface FlowSampleCollectorSet extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="id", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+ @TypedColumn(name = "id", method = MethodType.GETCOLUMN, fromVersion = "7.1.0")
Column<GenericTableSchema, Long> getIdColumn();
- @TypedColumn(name="id", method=MethodType.SETDATA, fromVersion="7.1.0")
+ @TypedColumn(name = "id", method = MethodType.SETDATA, fromVersion = "7.1.0")
void setId(Long id);
- @TypedColumn(name="bridge", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+ @TypedColumn(name = "bridge", method = MethodType.GETCOLUMN, fromVersion = "7.1.0")
Column<GenericTableSchema, UUID> getBridgeColumn();
- @TypedColumn(name="bridge", method=MethodType.SETDATA, fromVersion="7.1.0")
+ @TypedColumn(name = "bridge", method = MethodType.SETDATA, fromVersion = "7.1.0")
void setBridge(UUID bridge);
- @TypedColumn(name="ipfix", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+ @TypedColumn(name = "ipfix", method = MethodType.GETCOLUMN, fromVersion = "7.1.0")
Column<GenericTableSchema, UUID> getIpfixColumn();
- @TypedColumn(name="ipfix", method=MethodType.SETDATA, fromVersion="7.1.0")
+ @TypedColumn(name = "ipfix", method = MethodType.SETDATA, fromVersion = "7.1.0")
void setIpfix(UUID ipfix);
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="7.1.0")
+ @TypedColumn(name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "7.1.0")
Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
- @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="7.1.0")
+ @TypedColumn(name = "external_ids", method = MethodType.SETDATA, fromVersion = "7.1.0")
void setExternalIds(Map<String, String> externalIds);
}
/**
* This class is a typed interface to the Flow_Table Table
*/
-@TypedTable(name="Flow_Table", database="Open_vSwitch", fromVersion="6.5.0")
+@TypedTable(name = "Flow_Table", database = "Open_vSwitch", fromVersion = "6.5.0")
public interface FlowTable extends TypedBaseTable<GenericTableSchema> {
- @TypedColumn(name="flow_limit", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
- Column<GenericTableSchema, Set<Long>> getFlowLimitColumn() ;
+ @TypedColumn(name = "flow_limit", method = MethodType.GETCOLUMN, fromVersion = "6.5.0")
+ Column<GenericTableSchema, Set<Long>> getFlowLimitColumn();
- @TypedColumn(name="flow_limit", method=MethodType.SETDATA, fromVersion="6.5.0")
- void setFlowLimit(Set<Long> flowLimit) ;
+ @TypedColumn(name = "flow_limit", method = MethodType.SETDATA, fromVersion = "6.5.0")
+ void setFlowLimit(Set<Long> flowLimit);
- @TypedColumn(name="overflow_policy", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
- Column<GenericTableSchema, Set<String>> getOverflowPolicyColumn() ;
+ @TypedColumn(name = "overflow_policy", method = MethodType.GETCOLUMN, fromVersion = "6.5.0")
+ Column<GenericTableSchema, Set<String>> getOverflowPolicyColumn();
- @TypedColumn(name="overflow_policy", method=MethodType.SETDATA, fromVersion="6.5.0")
- void setOverflowPolicy(Set<String> overflowPolicy) ;
+ @TypedColumn(name = "overflow_policy", method = MethodType.SETDATA, fromVersion = "6.5.0")
+ void setOverflowPolicy(Set<String> overflowPolicy);
- @TypedColumn(name="groups", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
- Column<GenericTableSchema, Set<String>> getGroupsColumn() ;
+ @TypedColumn(name = "groups", method = MethodType.GETCOLUMN, fromVersion = "6.5.0")
+ Column<GenericTableSchema, Set<String>> getGroupsColumn();
- @TypedColumn(name="groups", method=MethodType.SETDATA, fromVersion="6.5.0")
- void setGroups(Set<String> groups) ;
+ @TypedColumn(name = "groups", method = MethodType.SETDATA, fromVersion = "6.5.0")
+ void setGroups(Set<String> groups);
- @TypedColumn(name="name", method=MethodType.GETCOLUMN, fromVersion="6.5.0")
+ @TypedColumn(name = "name", method = MethodType.GETCOLUMN, fromVersion = "6.5.0")
Column<GenericTableSchema, Set<String>> getNameColumn();
- @TypedColumn(name="name", method=MethodType.SETDATA, fromVersion="6.5.0")
+ @TypedColumn(name = "name", method = MethodType.SETDATA, fromVersion = "6.5.0")
void setName(Set<String> name);
- @TypedColumn(name="prefixes", method=MethodType.GETCOLUMN, fromVersion="7.4.0")
+ @TypedColumn(name = "prefixes", method = MethodType.GETCOLUMN, fromVersion = "7.4.0")
Column<GenericTableSchema, Set<String>> getPrefixesColumn();
- @TypedColumn(name="prefixes", method=MethodType.SETDATA, fromVersion="7.4.0")
+ @TypedColumn(name = "prefixes", method = MethodType.SETDATA, fromVersion = "7.4.0")
void setPrefixes(Set<String> prefixes);
- @TypedColumn(name="external_ids", method=MethodType.GETCOLUMN, fromVersion="7.5.0")
+ @TypedColumn(name = "external_ids", method = MethodType.GETCOLUMN, fromVersion = "7.5.0")
Column<GenericTableSchema, Map<String, String>> getExternalIdsColumn();
- @TypedColumn(name="external_ids", method=MethodType.SETDATA, fromVersion="7.5.0")
+ @TypedColumn(name = "external_ids", method = MethodType.SETDATA, fromVersion = "7.5.0")
void setExternalIds(Map<String, String> externalIds);
}
*/
package org.opendaylight.ovsdb.southbound;
-public class OvsdbSchemaContants {
+public interface OvsdbSchemaContants {
- public static final String DATABASE_NAME = "Open_vSwitch";
- private static final String BRIDGE_NAME = "Bridge";
+ String DATABASE_NAME = "Open_vSwitch";
+ String BRIDGE_NAME = "Bridge";
- private OvsdbSchemaContants() { }
-
- public enum OvsdbSchemaTables {
+ enum OvsdbSchemaTables {
OPENVSWITCH(DATABASE_NAME,null,null),
BRIDGE(BRIDGE_NAME, DATABASE_NAME, "bridges"),
PORT("Port", BRIDGE_NAME, "ports"),
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.QosTypeLinuxSfq;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
-public class SouthboundConstants {
-
- private SouthboundConstants() { }
-
- public static final String OPEN_V_SWITCH = "Open_vSwitch";
- public static final TopologyId OVSDB_TOPOLOGY_ID = new TopologyId(new Uri("ovsdb:1"));
- public static final String OVSDB_URI_PREFIX = "ovsdb";
- public static final String BRIDGE_URI_PREFIX = "bridge";
- public static final String TP_URI_PREFIX = "terminationpoint";
- public static final String QOS_URI_PREFIX = "qos";
- public static final String QOS_NAMED_UUID_PREFIX = "QOS";
- public static final Integer PORT_QOS_LIST_KEY = 1;
- public static final String QUEUE_URI_PREFIX = "queue";
- public static final String QUEUE_NAMED_UUID_PREFIX = "QUEUE";
- public static final String AUTOATTACH_URI_PREFIX = "autoattach";
- public static final String AUTOATTACH_SUPPORTED_OVS_SCHEMA_VERSION = "7.11.2";
- public static final Integer DEFAULT_OVSDB_PORT = 6640;
- public static final String DEFAULT_OPENFLOW_PORT = "6653";
- public static final String OPENFLOW_CONNECTION_PROTOCOL = "tcp";
- public static final String UUID = "uuid";
- public static final String QOS_LINUX_HTB = "linux-htb";
- public static final String QOS_LINUX_HFSC = "linux-hfsc";
+public interface SouthboundConstants {
+
+ String OPEN_V_SWITCH = "Open_vSwitch";
+ TopologyId OVSDB_TOPOLOGY_ID = new TopologyId(new Uri("ovsdb:1"));
+ String OVSDB_URI_PREFIX = "ovsdb";
+ String BRIDGE_URI_PREFIX = "bridge";
+ String TP_URI_PREFIX = "terminationpoint";
+ String QOS_URI_PREFIX = "qos";
+ String QOS_NAMED_UUID_PREFIX = "QOS";
+ Integer PORT_QOS_LIST_KEY = 1;
+ String QUEUE_URI_PREFIX = "queue";
+ String QUEUE_NAMED_UUID_PREFIX = "QUEUE";
+ String AUTOATTACH_URI_PREFIX = "autoattach";
+ String AUTOATTACH_SUPPORTED_OVS_SCHEMA_VERSION = "7.11.2";
+ Integer DEFAULT_OVSDB_PORT = 6640;
+ String DEFAULT_OPENFLOW_PORT = "6653";
+ String OPENFLOW_CONNECTION_PROTOCOL = "tcp";
+ String UUID = "uuid";
+ String QOS_LINUX_HTB = "linux-htb";
+ String QOS_LINUX_HFSC = "linux-hfsc";
// The following four QoS types are present in OVS 2.5+
// Refer to http://openvswitch.org/support/dist-docs/ovs-vswitchd.conf.db.5.txt
- public static final String QOS_LINUX_SFQ = "linux-sfq";
- public static final String QOS_LINUX_CODEL = "linux-codel";
- public static final String QOS_LINUX_FQ_CODEL = "linux-fq_codel";
- public static final String QOS_EGRESS_POLICER = "egress-policer";
- public static final ImmutableBiMap<Class<? extends QosTypeBase>,String> QOS_TYPE_MAP
+ String QOS_LINUX_SFQ = "linux-sfq";
+ String QOS_LINUX_CODEL = "linux-codel";
+ String QOS_LINUX_FQ_CODEL = "linux-fq_codel";
+ String QOS_EGRESS_POLICER = "egress-policer";
+ ImmutableBiMap<Class<? extends QosTypeBase>,String> QOS_TYPE_MAP
= new ImmutableBiMap.Builder<Class<? extends QosTypeBase>,String>()
.put(QosTypeLinuxHtb.class,QOS_LINUX_HTB)
.put(QosTypeLinuxHfsc.class,QOS_LINUX_HFSC)
.put(QosTypeEgressPolicer.class,QOS_EGRESS_POLICER)
.build();
- public static final ImmutableBiMap<Class<? extends OvsdbBridgeProtocolBase>,String> OVSDB_PROTOCOL_MAP
+ ImmutableBiMap<Class<? extends OvsdbBridgeProtocolBase>,String> OVSDB_PROTOCOL_MAP
= new ImmutableBiMap.Builder<Class<? extends OvsdbBridgeProtocolBase>,String>()
.put(OvsdbBridgeProtocolOpenflow10.class,"OpenFlow10")
.put(OvsdbBridgeProtocolOpenflow11.class,"OpenFlow11")
.put(OvsdbBridgeProtocolOpenflow15.class,"OpenFlow15")
.build();
- public static final ImmutableBiMap<Class<? extends OvsdbFailModeBase>,String> OVSDB_FAIL_MODE_MAP
+ ImmutableBiMap<Class<? extends OvsdbFailModeBase>,String> OVSDB_FAIL_MODE_MAP
= new ImmutableBiMap.Builder<Class<? extends OvsdbFailModeBase>,String>()
.put(OvsdbFailModeStandalone.class,"standalone")
.put(OvsdbFailModeSecure.class,"secure")
.build();
- public static final ImmutableBiMap<String, Class<? extends InterfaceTypeBase>> OVSDB_INTERFACE_TYPE_MAP
+ ImmutableBiMap<String, Class<? extends InterfaceTypeBase>> OVSDB_INTERFACE_TYPE_MAP
= new ImmutableBiMap.Builder<String, Class<? extends InterfaceTypeBase>>()
.put("internal", InterfaceTypeInternal.class)
.put("vxlan", InterfaceTypeVxlan.class)
.put("stt", InterfaceTypeStt.class)
.build();
- public static final ImmutableBiMap<Class<? extends DatapathTypeBase>,String> DATAPATH_TYPE_MAP
+ ImmutableBiMap<Class<? extends DatapathTypeBase>,String> DATAPATH_TYPE_MAP
= new ImmutableBiMap.Builder<Class<? extends DatapathTypeBase>,String>()
.put(DatapathTypeSystem.class,"system")
.put(DatapathTypeNetdev.class,"netdev")
.build();
- public static final String IID_EXTERNAL_ID_KEY = "opendaylight-iid";
- public static final String QOS_ID_EXTERNAL_ID_KEY = "opendaylight-qos-id";
- public static final String QUEUE_ID_EXTERNAL_ID_KEY = "opendaylight-queue-id";
- public static final String AUTOATTACH_ID_EXTERNAL_ID_KEY = "opendaylight-autoattach-id";
+ String IID_EXTERNAL_ID_KEY = "opendaylight-iid";
+ String QOS_ID_EXTERNAL_ID_KEY = "opendaylight-qos-id";
+ String QUEUE_ID_EXTERNAL_ID_KEY = "opendaylight-queue-id";
+ String AUTOATTACH_ID_EXTERNAL_ID_KEY = "opendaylight-autoattach-id";
- static final ImmutableCollection<String> SKIP_OVSDB_TABLE = new ImmutableSet.Builder<String>()
+ ImmutableCollection<String> SKIP_OVSDB_TABLE = new ImmutableSet.Builder<String>()
.add("Flow_Table")
.add("Mirror")
.add("NetFlow")
//Note: _version is an internal column of ovsdb schema, that gets updated
//with every change in the row of the table.
// The "Manager" entry needs to be a modifiable list, SouthboundProvider::setSkipManagerStatus() modifies it
- static final ImmutableMap<String,List<String>> SKIP_COLUMN_FROM_TABLE
+ ImmutableMap<String,List<String>> SKIP_COLUMN_FROM_TABLE
= new ImmutableMap.Builder<String,List<String>>()
.put("Open_vSwitch", Arrays.asList("statistics","_version"))
.put("Port", Arrays.asList("statistics","_version"))
.put("Controller", Arrays.asList("status","_version"))
.build();
- public enum VlanModes {
+ enum VlanModes {
ACCESS("access"),
NATIVE_TAGGED("native-tagged"),
NATIVE_UNTAGGED("native-untagged"),
}
}
- public enum OwnershipStates {
+ enum OwnershipStates {
OWNER("OWNER"),
NONOWNER("NON-OWNER");
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SouthboundMapper {
+public final class SouthboundMapper {
private SouthboundMapper() { }
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SouthboundUtil {
+public final class SouthboundUtil {
private static final Logger LOG = LoggerFactory.getLogger(SouthboundUtil.class);
private static final String SCHEMA_VERSION_MISMATCH =
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+// This class needs to be mocked
+@SuppressWarnings("checkstyle:FinalClass")
public class TransactUtils {
private TransactUtils() { }
for (Entry<UUID, OpenVSwitch> entry : updatedOpenVSwitchRows.entrySet()) {
OpenVSwitch openVSwitch = entry.getValue();
- final InstanceIdentifier<Node> nodePath = getInstanceIdentifier(instanceIdentifierCodec, openVSwitch);
+ final InstanceIdentifier<Node> nodePath = getInstanceIdentifier(openVSwitch);
OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = new OvsdbNodeAugmentationBuilder();
setDataPathTypes(ovsdbNodeBuilder, openVSwitch);
setInterfaceTypes(ovsdbNodeBuilder, openVSwitch);
OpenVSwitch oldEntry = deletedOpenVSwitchRows.get(entry.getKey());
- setExternalIds(instanceIdentifierCodec, transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
- setOtherConfig(instanceIdentifierCodec, transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
+ setExternalIds(transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
+ setOtherConfig(transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
ovsdbNodeBuilder.setConnectionInfo(getConnectionInfo());
NodeBuilder nodeBuilder = new NodeBuilder();
- nodeBuilder.setNodeId(getNodeId(instanceIdentifierCodec, openVSwitch));
+ nodeBuilder.setNodeId(getNodeId(openVSwitch));
nodeBuilder.addAugmentation(OvsdbNodeAugmentation.class,
ovsdbNodeBuilder.build());
transaction.merge(LogicalDatastoreType.OPERATIONAL, nodePath,
}
}
- private void setOtherConfig(InstanceIdentifierCodec instanceIdentifierCodec, ReadWriteTransaction transaction,
+ private void setOtherConfig(ReadWriteTransaction transaction,
OvsdbNodeAugmentationBuilder ovsdbNodeBuilder, OpenVSwitch oldEntry, OpenVSwitch openVSwitch) {
Map<String, String> oldOtherConfigs = null;
Map<String, String> otherConfigs = null;
}
if ((oldOtherConfigs != null) && (!oldOtherConfigs.isEmpty())) {
- removeOldConfigs(instanceIdentifierCodec, transaction, oldOtherConfigs, openVSwitch);
+ removeOldConfigs(transaction, oldOtherConfigs, openVSwitch);
}
if ((otherConfigs != null) && (!otherConfigs.isEmpty())) {
setNewOtherConfigs(ovsdbNodeBuilder, otherConfigs);
}
}
- private void removeOldConfigs(InstanceIdentifierCodec instanceIdentifierCodec, ReadWriteTransaction transaction,
+ private void removeOldConfigs(ReadWriteTransaction transaction,
Map<String, String> oldOtherConfigs, OpenVSwitch ovs) {
InstanceIdentifier<OvsdbNodeAugmentation> nodeAugmentataionIid = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
- .child(Node.class, new NodeKey(getNodeId(instanceIdentifierCodec, ovs)))
+ .child(Node.class, new NodeKey(getNodeId(ovs)))
.augmentation(OvsdbNodeAugmentation.class);
Set<String> otherConfigKeys = oldOtherConfigs.keySet();
for (String otherConfigKey : otherConfigKeys) {
ovsdbNodeBuilder.setOpenvswitchOtherConfigs(otherConfigsList);
}
- private void setExternalIds(InstanceIdentifierCodec instanceIdentifierCodec, ReadWriteTransaction transaction,
+ private void setExternalIds(ReadWriteTransaction transaction,
OvsdbNodeAugmentationBuilder ovsdbNodeBuilder, OpenVSwitch oldEntry, OpenVSwitch openVSwitch) {
Map<String, String> oldExternalIds = null;
Map<String, String> externalIds = null;
if ((oldExternalIds == null) || oldExternalIds.isEmpty()) {
setNewExternalIds(ovsdbNodeBuilder, externalIds);
} else if (externalIds != null && !externalIds.isEmpty()) {
- removeExternalIds(instanceIdentifierCodec, transaction, oldExternalIds, openVSwitch);
+ removeExternalIds(transaction, oldExternalIds, openVSwitch);
setNewExternalIds(ovsdbNodeBuilder, externalIds);
}
}
- private void removeExternalIds(InstanceIdentifierCodec instanceIdentifierCodec, ReadWriteTransaction transaction,
+ private void removeExternalIds(ReadWriteTransaction transaction,
Map<String, String> oldExternalIds, OpenVSwitch ovs) {
InstanceIdentifier<OvsdbNodeAugmentation> nodeAugmentataionIid = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
- .child(Node.class, new NodeKey(getNodeId(instanceIdentifierCodec, ovs)))
+ .child(Node.class, new NodeKey(getNodeId(ovs)))
.augmentation(OvsdbNodeAugmentation.class);
Set<String> externalIdKeys = oldExternalIds.keySet();
for (String externalIdKey : externalIdKeys) {
}
}
- private InstanceIdentifier<Node> getInstanceIdentifier(InstanceIdentifierCodec instanceIdentifierCodec,
- OpenVSwitch ovs) {
+ private InstanceIdentifier<Node> getInstanceIdentifier(OpenVSwitch ovs) {
if (ovs.getExternalIdsColumn() != null
&& ovs.getExternalIdsColumn().getData() != null
&& ovs.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) {
return getOvsdbConnectionInstance().getInstanceIdentifier();
}
- private NodeId getNodeId(InstanceIdentifierCodec instanceIdentifierCodec, OpenVSwitch ovs) {
- NodeKey nodeKey = getInstanceIdentifier(instanceIdentifierCodec, ovs).firstKeyOf(Node.class);
+ private NodeId getNodeId(OpenVSwitch ovs) {
+ NodeKey nodeKey = getInstanceIdentifier(ovs).firstKeyOf(Node.class);
return nodeKey.getNodeId();
}
}
doNothing().when(client).registerCallbacks(any());
//TODO: Write unit tests for EntityOwnershipService
- InstanceIdentifier<Node> iid = mock(InstanceIdentifier.class);
- when(client.getInstanceIdentifier()).thenReturn(iid);
+ when(client.getInstanceIdentifier()).thenReturn(mock(InstanceIdentifier.class));
field(OvsdbConnectionManager.class, "entityConnectionMap").set(ovsdbConnManager, entityConnectionMap);
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getEntityFromConnectionInstance",
OvsdbConnectionInstance.class));
when(SouthboundMapper.createConnectionInfo(any(OvsdbClient.class))).thenReturn(key);
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getInstanceIdentifier", ConnectionInfo.class));
- InstanceIdentifier<Node> iid = mock(InstanceIdentifier.class);
- when(ovsdbConnManager.getInstanceIdentifier(key)).thenReturn(iid);
+ when(ovsdbConnManager.getInstanceIdentifier(key)).thenReturn(mock(InstanceIdentifier.class));
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getConnectionInstance", ConnectionInfo.class));
when(ovsdbConnManager.getConnectionInstance(key)).thenReturn(null);
when(ovsdbConnManager.connectedButCallBacksNotRegistered(any(OvsdbClient.class)))
.thenReturn(ovsdbConnectionInstance);
- InstanceIdentifier<Node> iid = mock(InstanceIdentifier.class);
- when(ovsdbConnectionInstance.getInstanceIdentifier()).thenReturn(iid);
+ when(ovsdbConnectionInstance.getInstanceIdentifier()).thenReturn(mock(InstanceIdentifier.class));
field(OvsdbConnectionManager.class, "entityConnectionMap").set(ovsdbConnManager, entityConnectionMap);
suppress(MemberMatcher.method(OvsdbConnectionManager.class, "getEntityFromConnectionInstance",
OvsdbConnectionInstance.class));
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "setInterfaceTypes",
OvsdbNodeAugmentationBuilder.class, OpenVSwitch.class));
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "setExternalIds",
- InstanceIdentifierCodec.class, ReadWriteTransaction.class, OvsdbNodeAugmentationBuilder.class,
- OpenVSwitch.class, OpenVSwitch.class));
+ ReadWriteTransaction.class, OvsdbNodeAugmentationBuilder.class, OpenVSwitch.class, OpenVSwitch.class));
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "setOtherConfig",
InstanceIdentifierCodec.class, ReadWriteTransaction.class, OvsdbNodeAugmentationBuilder.class,
OpenVSwitch.class, OpenVSwitch.class));
when(column.getData()).thenReturn(map);
when(oldEntry.getOtherConfigColumn()).thenReturn(column);
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "removeOldConfigs",
- InstanceIdentifierCodec.class, ReadWriteTransaction.class, Map.class, OpenVSwitch.class));
+ ReadWriteTransaction.class, Map.class, OpenVSwitch.class));
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "setNewOtherConfigs",
OvsdbNodeAugmentationBuilder.class, Map.class));
ReadWriteTransaction transaction = mock(ReadWriteTransaction.class);
OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = mock(OvsdbNodeAugmentationBuilder.class);
- Whitebox.invokeMethod(openVSwitchUpdateCommand, "setOtherConfig", mock(InstanceIdentifierCodec.class),
+ Whitebox.invokeMethod(openVSwitchUpdateCommand, "setOtherConfig",
transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
verify(openVSwitch, times(2)).getOtherConfigColumn();
verify(oldEntry, times(2)).getOtherConfigColumn();
PowerMockito.verifyPrivate(openVSwitchUpdateCommand).invoke("removeOldConfigs",
- any(InstanceIdentifierCodec.class), any(ReadWriteTransaction.class),
+ any(ReadWriteTransaction.class),
any(Map.class), any(OpenVSwitch.class));
}
//suppress getNodeId()
MemberModifier.suppress(
- MemberMatcher.method(OpenVSwitchUpdateCommand.class, "getNodeId", InstanceIdentifierCodec.class,
- OpenVSwitch.class));
+ MemberMatcher.method(OpenVSwitchUpdateCommand.class, "getNodeId", OpenVSwitch.class));
PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(mock(NodeKey.class));
OpenVSwitch ovs = mock(OpenVSwitch.class);
- Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeOldConfigs", mock(InstanceIdentifierCodec.class),
+ Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeOldConfigs",
transaction, oldOtherConfigs, ovs);
verify(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
}
when(column.getData()).thenReturn(map);
when(oldEntry.getExternalIdsColumn()).thenReturn(column);
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "removeExternalIds",
- InstanceIdentifierCodec.class, ReadWriteTransaction.class, Map.class, OpenVSwitch.class));
+ ReadWriteTransaction.class, Map.class, OpenVSwitch.class));
MemberModifier.suppress(MemberMatcher.method(OpenVSwitchUpdateCommand.class, "setNewExternalIds",
OvsdbNodeAugmentationBuilder.class, Map.class));
ReadWriteTransaction transaction = mock(ReadWriteTransaction.class);
OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = mock(OvsdbNodeAugmentationBuilder.class);
- Whitebox.invokeMethod(openVSwitchUpdateCommand, "setExternalIds", mock(InstanceIdentifierCodec.class),
+ Whitebox.invokeMethod(openVSwitchUpdateCommand, "setExternalIds",
transaction, ovsdbNodeBuilder, oldEntry, openVSwitch);
verify(openVSwitch, times(2)).getExternalIdsColumn();
verify(oldEntry, times(2)).getExternalIdsColumn();
PowerMockito.verifyPrivate(openVSwitchUpdateCommand).invoke("removeExternalIds",
- any(InstanceIdentifierCodec.class), any(ReadWriteTransaction.class), any(Map.class),
+ any(ReadWriteTransaction.class), any(Map.class),
any(OpenVSwitch.class));
}
//suppress getNodeId()
MemberModifier.suppress(
- MemberMatcher.method(OpenVSwitchUpdateCommand.class, "getNodeId", InstanceIdentifierCodec.class,
- OpenVSwitch.class));
+ MemberMatcher.method(OpenVSwitchUpdateCommand.class, "getNodeId", OpenVSwitch.class));
PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(mock(NodeKey.class));
OpenVSwitch ovs = mock(OpenVSwitch.class);
- Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeExternalIds", mock(InstanceIdentifierCodec.class),
+ Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeExternalIds",
transaction, oldExternalIds, ovs);
verify(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
}
@PrepareForTest({ OvsdbControllerUpdateCommand.class, SouthboundMapper.class, SouthboundUtil.class,
InstanceIdentifier.class })
public class OvsdbControllerUpdateCommandTest {
- private Map<UUID, Controller> updatedControllerRows;
- private Map<UUID, Bridge> updatedBridgeRows;
- private OvsdbControllerUpdateCommand ovsdbControllerUpdateCommand;
-
private static final String BRIDGE_NAME = "br-int";
private static final String NODE_ID = "OF|00:00:00:0c:29:70:45:9b";
+ private OvsdbControllerUpdateCommand ovsdbControllerUpdateCommand;
+
@Before
public void setUp() {
ovsdbControllerUpdateCommand = PowerMockito.mock(OvsdbControllerUpdateCommand.class,
@Test
public void testExecute() throws Exception {
- updatedControllerRows = new HashMap<>();
+ Map<UUID, Controller> updatedControllerRows = new HashMap<>();
updatedControllerRows.put(mock(UUID.class), mock(Controller.class));
MemberModifier.field(OvsdbControllerUpdateCommand.class, "updatedControllerRows")
.set(ovsdbControllerUpdateCommand, updatedControllerRows);
any(ReadWriteTransaction.class), any(Map.class));
// updatedBridgeRows not null case
- updatedBridgeRows = new HashMap<>();
+ Map<UUID, Bridge> updatedBridgeRows = new HashMap<>();
updatedBridgeRows.put(mock(UUID.class), mock(Bridge.class));
MemberModifier.field(OvsdbControllerUpdateCommand.class, "updatedBridgeRows").set(ovsdbControllerUpdateCommand,
updatedBridgeRows);
private static final String TARGET_COLUMN_DATA = "Manager Column";
private static final String NODE_ID = "Node ID String";
- private Map<UUID, Manager> updatedManagerRows;
- private Map<UUID, OpenVSwitch> updatedOpenVSwitchRows;
+
private OvsdbManagersUpdateCommand ovsdbManagersUpdateCommand;
@Before
@Test
public void testExecute() throws Exception {
- updatedManagerRows = new HashMap<>();
+ Map<UUID, Manager> updatedManagerRows = new HashMap<>();
updatedManagerRows.put(mock(UUID.class), mock(Manager.class));
MemberModifier.field(OvsdbManagersUpdateCommand.class, "updatedManagerRows").set(ovsdbManagersUpdateCommand,
updatedManagerRows);
PowerMockito.doReturn(updatedManagerRowsWithUri).when(ovsdbManagersUpdateCommand, "getUriManagerMap",
any(Map.class));
- updatedOpenVSwitchRows = new HashMap<>();
+ Map<UUID, OpenVSwitch> updatedOpenVSwitchRows = new HashMap<>();
updatedOpenVSwitchRows.put(mock(UUID.class), mock(OpenVSwitch.class));
MemberModifier.field(OvsdbManagersUpdateCommand.class, "updatedOpenVSwitchRows").set(ovsdbManagersUpdateCommand,
updatedOpenVSwitchRows);
public void testOnTransactionChainFailed() throws Exception {
field(TransactionInvokerImpl.class, "failedTransactionQueue").set(transactionInvokerImpl,
failedTransactionQ);
- TransactionChain<?, ?> chain = mock(TransactionChain.class);
AsyncTransaction<?, ?> transaction = mock(AsyncTransaction.class);
Throwable cause = mock(Throwable.class);
- transactionInvokerImpl.onTransactionChainFailed(chain, transaction, cause);
+ transactionInvokerImpl.onTransactionChainFailed(mock(TransactionChain.class), transaction, cause);
BlockingQueue<AsyncTransaction<?, ?>> testFailedTransactionQueue = Whitebox
.getInternalState(transactionInvokerImpl, "failedTransactionQueue");
assertTrue(testFailedTransactionQueue.contains(transaction));
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import org.junit.Test;
+import org.junit.runner.RunWith;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
-import org.powermock.api.mockito.PowerMockito;
import org.osgi.framework.FrameworkUtil;
+import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
-@PrepareForTest( {System.class, FrameworkUtil.class} )
- public class ConfigPropertiesTest {
+@PrepareForTest({System.class, FrameworkUtil.class})
+public class ConfigPropertiesTest {
private static final String TEST_PROPERTY_KEY1 = "foobar34465$3467";
private static final String TEST_PROPERTY_MOCK_VALUE1 = "xbarMock1";
public void testGetProperty() {
Bundle bundleWithoutBundleNoContext = mock(Bundle.class);
Bundle bundle = mock(Bundle.class);
- BundleContext bundleContext = mock(BundleContext.class);
// mock #1
PowerMockito.mockStatic(FrameworkUtil.class);
PowerMockito.when(FrameworkUtil.getBundle(ConfigPropertiesTestMockingBundleNoContext.class))
.thenReturn(bundleWithoutBundleNoContext);
// mock #2
+ BundleContext bundleContext = mock(BundleContext.class);
when(bundle.getBundleContext()).thenReturn(bundleContext);
when(bundleWithoutBundleNoContext.getBundleContext()).thenReturn(null);
// mock #3
assertNull(FrameworkUtil.getBundle(ConfigPropertiesTestMocking.class));
assertEquals(FrameworkUtil.getBundle(ConfigPropertiesTest.class), bundle);
assertEquals(FrameworkUtil.getBundle(ConfigPropertiesTestMockingBundleNoContext.class),
- bundleWithoutBundleNoContext);
+ bundleWithoutBundleNoContext);
// test 2. bundleContext is null
assertNull(bundleWithoutBundleNoContext.getBundleContext());
final String value41 = ConfigProperties.getProperty(ConfigPropertiesTestMocking.class, TEST_PROPERTY_KEY1);
assertNull(value41); // class has no bundle
final String value42 = ConfigProperties.getProperty(ConfigPropertiesTestMockingBundleNoContext.class,
- TEST_PROPERTY_KEY1);
+ TEST_PROPERTY_KEY1);
assertNull(value42); // class has no bundleContext
final String value43 = ConfigProperties.getProperty(this.getClass(), TEST_PROPERTY_KEY_NOT_FOUND);
assertNull(value43); // bundleContext will not know about key provided
// test 5. value returned from ConfigProperties.getProperty is the default value provided
- final String value5 = ConfigProperties.getProperty(this.getClass(), TEST_PROPERTY_KEY_NOT_FOUND, DEFAULT_PROPERTY_VALUE);
+ final String value5 =
+ ConfigProperties.getProperty(this.getClass(), TEST_PROPERTY_KEY_NOT_FOUND, DEFAULT_PROPERTY_VALUE);
assertEquals(DEFAULT_PROPERTY_VALUE, value5);
// test 6. value returned from ConfigProperties.getProperty is the mocked value
final String value61 = ConfigProperties.getProperty(this.getClass(), TEST_PROPERTY_KEY1);
assertEquals(TEST_PROPERTY_MOCK_VALUE1, value61);
- final String value62 = ConfigProperties.getProperty(this.getClass(), TEST_PROPERTY_KEY1, DEFAULT_PROPERTY_VALUE);
+ final String value62 =
+ ConfigProperties.getProperty(this.getClass(), TEST_PROPERTY_KEY1, DEFAULT_PROPERTY_VALUE);
assertEquals(TEST_PROPERTY_MOCK_VALUE1, value62);
}
// Helper classes used to de-mux mock behaviors
private class ConfigPropertiesTestMockingBundleNoContext {
}
+
private class ConfigPropertiesTestMocking {
}
}
*/
package org.opendaylight.ovsdb.utils.yang;
+import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
-
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import com.google.common.base.Preconditions;
-
/**
* YANG utility functions.
*/