Search in sources :

Example 21 with TableFeatureProperties

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties in project openflowplugin by opendaylight.

the class SalTableServiceImplTest method testUpdateTableSuccess.

@Test
public void testUpdateTableSuccess() throws ExecutionException, InterruptedException {
    Mockito.doAnswer((Answer<Void>) invocation -> {
        TableFeaturesBuilder tableFeaturesBld = new TableFeaturesBuilder().setTableId((short) 0).setName("Zafod").setMaxEntries(42L).setTableFeatureProperties(Collections.<TableFeatureProperties>emptyList());
        MultipartReplyTableFeaturesBuilder mpTableFeaturesBld = new MultipartReplyTableFeaturesBuilder().setTableFeatures(Collections.singletonList(tableFeaturesBld.build()));
        MultipartReplyTableFeaturesCaseBuilder mpBodyBld = new MultipartReplyTableFeaturesCaseBuilder().setMultipartReplyTableFeatures(mpTableFeaturesBld.build());
        MultipartReplyMessageBuilder mpResultBld = new MultipartReplyMessageBuilder().setType(MultipartType.OFPMPTABLEFEATURES).setMultipartReplyBody(mpBodyBld.build()).setXid(21L);
        final RpcResult<List<MultipartReply>> rpcResult = RpcResultBuilder.success(Collections.singletonList((MultipartReply) mpResultBld.build())).build();
        handleResultFuture.set(rpcResult);
        return null;
    }).when(multiMessageCollector).endCollecting(Matchers.<EventIdentifier>any());
    final Future<RpcResult<UpdateTableOutput>> rpcResultFuture = salTableService.updateTable(prepareUpdateTable());
    Assert.assertNotNull(rpcResultFuture);
    verify(mockedRequestContextStack).createRequestContext();
}
Also used : UpdateTableInput(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeaturesBuilder) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ServiceMocking(org.opendaylight.openflowplugin.impl.services.ServiceMocking) UpdatedTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder) Matchers(org.mockito.Matchers) Mock(org.mockito.Mock) RpcProviderRegistry(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry) MultipartWriterProviderFactory(org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProviderFactory) MultipartReplyTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCaseBuilder) SettableFuture(com.google.common.util.concurrent.SettableFuture) Answer(org.mockito.stubbing.Answer) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder) Future(java.util.concurrent.Future) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) ConvertorManagerFactory(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory) UpdateTableInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder) UpdateTableOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput) Test(org.junit.Test) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) Mockito.when(org.mockito.Mockito.when) FutureCallback(com.google.common.util.concurrent.FutureCallback) Mockito.verify(org.mockito.Mockito.verify) ExecutionException(java.util.concurrent.ExecutionException) Mockito(org.mockito.Mockito) List(java.util.List) ConvertorManager(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) EventIdentifier(org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) RpcResultBuilder(org.opendaylight.yangtools.yang.common.RpcResultBuilder) MultipartType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType) Assert(org.junit.Assert) Collections(java.util.Collections) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.multipart.reply.table.features.TableFeaturesBuilder) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder) MultipartReplyTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCaseBuilder) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeaturesBuilder) Test(org.junit.Test)

Example 22 with TableFeatureProperties

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestCommandProvider method createTestTableFeatures.

private TableFeaturesBuilder createTestTableFeatures(String tableFeatureTypeArg) {
    String tableFeatureType = tableFeatureTypeArg;
    if (tableFeatureType == null) {
        tableFeatureType = "t1";
    }
    final TableFeaturesBuilder tableFeature = new TableFeaturesBuilder();
    // Sample data , committing to DataStore
    if (!tableFeatureType.equals("t1")) {
        tableFeature.setTableId((short) 0);
        tableFeature.setName("Table 0");
        tableFeature.setMetadataMatch(BigInteger.valueOf(10));
        tableFeature.setMetadataWrite(BigInteger.valueOf(10));
        tableFeature.setMaxEntries(10000L);
        tableFeature.setConfig(new TableConfig(false));
        List<TableFeatureProperties> properties = new ArrayList<>();
        switch(tableFeatureType) {
            case "t2":
                // To set the ApplyActionsMiss
                properties.add(createApplyActionsMissTblFeatureProp().build());
                break;
            case "t3":
                // To set the Next Table
                properties.add(createNextTblFeatureProp().build());
                break;
            case "t4":
                // To set the Next Table Miss
                properties.add(createNextTableMissTblFeatureProp().build());
                break;
            case "t5":
                // To set the ApplyActions
                properties.add(createApplyActionsTblFeatureProp().build());
                break;
            case "t6":
                // To set the instructions
                properties.add(createInstructionsTblFeatureProp().build());
                break;
            case "t7":
                // To set the instructions miss
                properties.add(createInstructionsMissTblFeatureProp().build());
                break;
            case "t8":
                // To set the write actions
                properties.add(createWriteActionsTblFeatureProp().build());
                break;
            case "t9":
                // To set the write actions miss
                properties.add(createWriteActionsMissTblFeatureProp().build());
                break;
            case "t10":
                // To set the match field
                properties.add(createMatchFieldTblFeatureProp().build());
                break;
            case "t11":
                // To set the write set-field
                properties.add(createWriteSetFieldTblFeatureProp().build());
                break;
            case "t12":
                // To set the write set-field miss
                properties.add(createWriteSetFieldMissTblFeatureProp().build());
                break;
            case "t13":
                // To set the apply set field
                properties.add(createApplySetFieldTblFeatureProp().build());
                break;
            case "t14":
                // To set the apply set field miss
                properties.add(createApplySetFieldMissTblFeatureProp().build());
                break;
            case "t15":
                // To set the wildcards set field match
                properties.add(createWildCardsTblFeatureProp().build());
                break;
            default:
                break;
        }
        TablePropertiesBuilder propertyBld = new TablePropertiesBuilder();
        propertyBld.setTableFeatureProperties(properties);
        tableFeature.setTableProperties(propertyBld.build());
    }
    return tableFeature;
}
Also used : TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties) ArrayList(java.util.ArrayList) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig) TablePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder)

Aggregations

ArrayList (java.util.ArrayList)16 TableFeatureProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties)13 Test (org.junit.Test)8 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder)8 NextTableIds (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds)6 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)6 ByteBuf (io.netty.buffer.ByteBuf)5 ActionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder)5 InstructionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder)5 NextTableRelatedTableFeatureProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty)5 NextTableRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder)5 OxmRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder)5 NextTableIdsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder)4 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction)4 TableConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig)4 TableFeaturesPropType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType)4 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)4 BigInteger (java.math.BigInteger)3 List (java.util.List)3 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)3