Search in sources :

Example 31 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ExperimenterInputMessageFactoryTest method testV13Real.

/**
 * Testing of {@link ExperimenterInputMessageFactory} for correct serializer
 * lookup and serialization.
 */
@Test(expected = IllegalStateException.class)
public void testV13Real() throws Exception {
    startUp(true);
    ExperimenterInputBuilder builder = new ExperimenterInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setExperimenter(new ExperimenterId(42L));
    builder.setExpType(22L);
    builder.setExperimenterDataOfChoice(vendorData);
    ExperimenterInput input = builder.build();
    expFactory.serialize(input, out);
}
Also used : ExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) ExperimenterInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput) Test(org.junit.Test)

Example 32 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class TypeKeyMakerFactoryTest method testExperimenterActionKeyMaker.

/**
 * Tests {@link TypeKeyMakerFactory#createActionKeyMaker(short)}.
 */
@Test
public void testExperimenterActionKeyMaker() {
    TypeKeyMaker<Action> keyMaker = TypeKeyMakerFactory.createActionKeyMaker(EncodeConstants.OF13_VERSION_ID);
    Assert.assertNotNull("Null keyMaker", keyMaker);
    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder builder = new ActionBuilder();
    builder.setExperimenterId(new ExperimenterId(42L));
    builder.setActionChoice(new CopyTtlInCaseBuilder().build());
    Action action = builder.build();
    MessageTypeKey<?> key = keyMaker.make(action);
    Assert.assertNotNull("Null key", key);
    Assert.assertEquals("Wrong key", new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, CopyTtlInCase.class, 42L), key);
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) CopyTtlInCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) CopyTtlInCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCase) Test(org.junit.Test)

Example 33 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class TypeKeyMakerFactoryTest method testExperimenterInstructionKeyMaker.

/**
 * Tests {@link TypeKeyMakerFactory#createInstructionKeyMaker(short)}.
 */
@Test
public void testExperimenterInstructionKeyMaker() {
    TypeKeyMaker<Instruction> keyMaker = TypeKeyMakerFactory.createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID);
    Assert.assertNotNull("Null keyMaker", keyMaker);
    InstructionBuilder builder = new InstructionBuilder();
    builder.setExperimenterId(new ExperimenterId(42L));
    builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
    Instruction instruction = builder.build();
    MessageTypeKey<?> key = keyMaker.make(instruction);
    Assert.assertNotNull("Null key", key);
    Assert.assertEquals("Wrong key", new InstructionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, ClearActionsCase.class, 42L), key);
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder) ClearActionsCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction) ClearActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) Test(org.junit.Test)

Example 34 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class TypeKeyMakerFactoryTest method testExperimenterMatchEntriesKeyMaker.

/**
 * Tests {@link TypeKeyMakerFactory#createMatchEntriesKeyMaker(short)}.
 */
@Test
public void testExperimenterMatchEntriesKeyMaker() {
    TypeKeyMaker<MatchEntry> keyMaker = TypeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
    Assert.assertNotNull("Null keyMaker", keyMaker);
    MatchEntryBuilder builder = new MatchEntryBuilder();
    builder.setOxmClass(ExperimenterClass.class);
    builder.setOxmMatchField(OxmMatchFieldClass.class);
    builder.setHasMask(true);
    ExperimenterIdCaseBuilder caseBuilder = new ExperimenterIdCaseBuilder();
    ExperimenterBuilder expBuilder = new ExperimenterBuilder();
    expBuilder.setExperimenter(new ExperimenterId(42L));
    caseBuilder.setExperimenter(expBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
    MatchEntry entry = builder.build();
    MessageTypeKey<?> key = keyMaker.make(entry);
    Assert.assertNotNull("Null key", key);
    MatchEntrySerializerKey<?, ?> comparationKey = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, ExperimenterClass.class, OxmMatchFieldClass.class);
    comparationKey.setExperimenterId(42L);
    Assert.assertEquals("Wrong key", comparationKey, key);
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) ExperimenterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder) MatchEntrySerializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) ExperimenterIdCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder) Test(org.junit.Test)

Example 35 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ServiceMocking method initialization.

@Before
@SuppressWarnings("unchecked")
public void initialization() throws Exception {
    when(mockedExtensionConverter.getExperimenterId()).thenReturn(new ExperimenterId(DUMMY_EXPERIMENTER_ID));
    when(mockedExtensionConverterProvider.getMessageConverter(Matchers.<TypeVersionKey>any())).thenReturn(mockedExtensionConverter);
    when(mockedRequestContextStack.createRequestContext()).thenReturn(mockedRequestContext);
    when(mockedRequestContext.getXid()).thenReturn(DUMMY_XID);
    when(mockedFeatures.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedFeatures.getVersion()).thenReturn(DUMMY_VERSION);
    when(mockedFeaturesOutput.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedFeaturesOutput.getVersion()).thenReturn(DUMMY_VERSION);
    when(mockedPrimConnectionContext.getFeatures()).thenReturn(mockedFeatures);
    when(mockedPrimConnectionContext.getConnectionAdapter()).thenReturn(mockedConnectionAdapter);
    when(mockedPrimConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING);
    when(mockedPrimConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue);
    when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_II);
    when(mockedDeviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
    when(mockedDeviceInfo.getVersion()).thenReturn(DUMMY_VERSION);
    when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext);
    when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy);
    when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(DUMMY_VERSION, dataBroker, DUMMY_NODE_II));
    when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
    when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
    when(mockedDeviceContext.getMultiMsgCollector(Matchers.any())).thenReturn(multiMessageCollector);
    setup();
}
Also used : ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) DeviceFlowRegistryImpl(org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl) Before(org.junit.Before)

Aggregations

ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)37 Test (org.junit.Test)14 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)13 ExperimenterDataOfChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice)9 ByteBuf (io.netty.buffer.ByteBuf)6 ExperimenterIdCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder)5 ExperimenterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder)5 ExperimenterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput)5 ExperimenterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder)5 ArrayList (java.util.ArrayList)4 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)4 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)3 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)3 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)2 MultipartRequestInputFactory (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)2 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)2 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)2 BigInteger (java.math.BigInteger)1