use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesDeserializer method deserialize.
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
final MultipartReplyTableFeaturesBuilder builder = new MultipartReplyTableFeaturesBuilder();
final List<TableFeatures> items = new ArrayList<>();
while (message.readableBytes() > 0) {
final int itemLength = message.readUnsignedShort();
final TableFeaturesBuilder itemBuilder = new TableFeaturesBuilder().setTableId(message.readUnsignedByte());
message.skipBytes(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
final String name = ByteBufUtils.decodeNullTerminatedString(message, MAX_TABLE_NAME_LENGTH);
final byte[] match = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(match);
final byte[] write = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
message.readBytes(write);
items.add(itemBuilder.setKey(new TableFeaturesKey(itemBuilder.getTableId())).setName(name).setMetadataMatch(new BigInteger(1, match)).setMetadataWrite(new BigInteger(1, write)).setConfig(readTableConfig(message)).setMaxEntries(message.readUnsignedInt()).setTableProperties(readTableProperties(message, itemLength - MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH)).build());
}
return builder.setTableFeatures(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey in project openflowplugin by opendaylight.
the class TableFeaturesListenerTest method updateFlowTest.
@Test
public void updateFlowTest() {
TableKey tableKey = new TableKey((short) 2);
TableFeaturesKey tableFeaturesKey = new TableFeaturesKey(tableKey.getId());
addTable(tableKey, NODE_KEY);
TableFeatures tableFeaturesData = new TableFeaturesBuilder().setKey(tableFeaturesKey).build();
InstanceIdentifier<TableFeatures> tableFeaturesII = InstanceIdentifier.create(Nodes.class).child(Node.class, NODE_KEY).augmentation(FlowCapableNode.class).child(TableFeatures.class, tableFeaturesKey);
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableFeaturesII, tableFeaturesData);
assertCommit(writeTx.submit());
tableFeaturesData = new TableFeaturesBuilder().setKey(tableFeaturesKey).setName("dummy name").build();
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.CONFIGURATION, tableFeaturesII, tableFeaturesData);
assertCommit(writeTx.submit());
SalTableServiceMock salTableServiceMock = (SalTableServiceMock) forwardingRulesManager.getSalTableService();
List<UpdateTableInput> updateTableInputs = salTableServiceMock.getUpdateTableInput();
assertEquals(1, updateTableInputs.size());
assertEquals("DOM-0", updateTableInputs.get(0).getTransactionUri().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey in project openflowplugin by opendaylight.
the class OpenflowpluginTableFeaturesTestCommandProvider method writeTableFeatures.
private void writeTableFeatures(final CommandInterpreter ci, TableFeatures tableFeatures) {
ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(TableFeatures.class, new TableFeaturesKey(tableFeatures.getTableId()));
modification.merge(LogicalDatastoreType.OPERATIONAL, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.OPERATIONAL, path1, tableFeatures, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, tableFeatures, true);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
Aggregations