Search in sources :

Example 1 with ArpOpCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue in project openflowplugin by opendaylight.

the class ArpOpConvertorTest method testConvertToOFJava.

@Test
public void testConvertToOFJava() throws Exception {
    final NxmOfArpOpBuilder nxmOfArpOpBuilder = new NxmOfArpOpBuilder().setValue(2);
    final NxAugMatchRpcAddFlowBuilder nxAugMatchRpcAddFlowBuilder = new NxAugMatchRpcAddFlowBuilder();
    nxAugMatchRpcAddFlowBuilder.setNxmOfArpOp(nxmOfArpOpBuilder.build());
    final Augmentation<Extension> extensionAugmentation = nxAugMatchRpcAddFlowBuilder.build();
    when(extension.getAugmentation(Matchers.<Class<Augmentation<Extension>>>any())).thenReturn(extensionAugmentation);
    final MatchEntry converted = arpOpConvertor.convert(extension);
    Assert.assertEquals(nxAugMatchRpcAddFlowBuilder.getNxmOfArpOp().getValue(), ((ArpOpCaseValue) converted.getMatchEntryValue()).getArpOpValues().getValue());
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) Augmentation(org.opendaylight.yangtools.yang.binding.Augmentation) ArpOpCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue) NxmOfArpOpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.op.grouping.NxmOfArpOpBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) NxAugMatchRpcAddFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder) Test(org.junit.Test)

Example 2 with ArpOpCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue in project openflowplugin by opendaylight.

the class ArpOpCodecTest method deserializeTest.

@Test
public void deserializeTest() {
    createBuffer(buffer);
    input = arpOpCodec.deserialize(buffer);
    final ArpOpCaseValue result = (ArpOpCaseValue) input.getMatchEntryValue();
    assertEquals(Nxm0Class.class, input.getOxmClass());
    assertEquals(NxmOfArpOp.class, input.getOxmMatchField());
    assertEquals(false, input.isHasMask());
    assertEquals(2, result.getArpOpValues().getValue().shortValue());
}
Also used : ArpOpCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue) Test(org.junit.Test)

Example 3 with ArpOpCaseValue

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue in project openflowplugin by opendaylight.

the class ArpOpCodec method serialize.

@Override
public void serialize(MatchEntry input, ByteBuf outBuffer) {
    serializeHeader(input, outBuffer);
    ArpOpCaseValue arpOpCase = ((ArpOpCaseValue) input.getMatchEntryValue());
    outBuffer.writeShort(arpOpCase.getArpOpValues().getValue());
}
Also used : ArpOpCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue)

Aggregations

ArpOpCaseValue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue)3 Test (org.junit.Test)2 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)1 Extension (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension)1 NxAugMatchRpcAddFlowBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcAddFlowBuilder)1 NxmOfArpOpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.arp.op.grouping.NxmOfArpOpBuilder)1 Augmentation (org.opendaylight.yangtools.yang.binding.Augmentation)1