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);
}
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);
}
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);
}
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);
}
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();
}
Aggregations