use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class SetNwDstActionSerializer method buildAction.
@Override
protected SetFieldCase buildAction(Action input) {
final Address address = SetNwDstActionCase.class.cast(input).getSetNwDstAction().getAddress();
final SetFieldBuilder builder = new SetFieldBuilder();
if (Ipv4.class.isInstance(address)) {
builder.setLayer3Match(new Ipv4MatchBuilder().setIpv4Destination(Ipv4.class.cast(address).getIpv4Address()).build());
} else if (Ipv6.class.isInstance(address)) {
builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6Destination(Ipv6.class.cast(address).getIpv6Address()).build());
}
return new SetFieldCaseBuilder().setSetField(builder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class PortMessageSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(MESSAGE, out);
// Header
assertEquals(out.readByte(), VERSION);
assertEquals(out.readByte(), serializer.getMessageType());
assertEquals(out.readShort(), LENGTH);
assertEquals(out.readInt(), XID.intValue());
// Body
assertEquals(out.readInt(), PORT_NUMBER_VAL.intValue());
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_01);
byte[] address = new byte[6];
out.readBytes(address);
assertEquals(new MacAddress(ByteBufUtils.macAddressToString(address)).getValue(), new MacAddress(MAC_ADDRESS).getValue());
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_02);
// Port config
final int config = ByteBufUtils.fillBitMaskFromMap(ImmutableMap.<Integer, Boolean>builder().put(0, IS_PORTDOWN).put(2, IS_NORECV).put(5, IS_NOFWD).put(6, IS_NOPACKETIN).build());
final int mask = ByteBufUtils.fillBitMaskFromMap(ImmutableMap.<Integer, Boolean>builder().put(0, true).put(2, true).put(5, true).put(6, true).build());
assertEquals(out.readInt(), config);
assertEquals(out.readInt(), mask);
// Port features
assertEquals(out.readInt(), ByteBufUtils.fillBitMask(0, IS_10MBHD, IS_10MBFD, IS_100MBHD, IS_100MBFD, IS_1GBHD, IS_1GBFD, IS_10GBFD, IS_40GBFD, IS_100GBFD, IS_1TBFD, IS_OTHER, IS_COPPER, IS_FIBER, IS_AUTOENG, IS_PAUSE, IS_PAUSE_ASYM));
out.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_03);
assertEquals(out.readableBytes(), 0);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class ArpShaCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final ArpShaCaseValueBuilder caseBuilder = new ArpShaCaseValueBuilder();
final ArpShaValuesBuilder valuesBuilder = new ArpShaValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm1Class.class);
matchEntryBuilder.setOxmMatchField(NxmNxArpSha.class);
matchEntryBuilder.setHasMask(false);
byte[] address = new byte[VALUE_LENGTH];
valuesBuilder.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
caseBuilder.setArpShaValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class EthDstCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthDstCaseValueBuilder caseBuilder = new EthDstCaseValueBuilder();
final EthDstValuesBuilder valuesBuilder = new EthDstValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfEthDst.class);
matchEntryBuilder.setHasMask(false);
byte[] address = new byte[VALUE_LENGTH];
valuesBuilder.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
caseBuilder.setEthDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.Address in project openflowplugin by opendaylight.
the class EthSrcCodecTest method createMatchEntry.
private MatchEntry createMatchEntry() {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
final EthSrcCaseValueBuilder caseBuilder = new EthSrcCaseValueBuilder();
final EthSrcValuesBuilder valuesBuilder = new EthSrcValuesBuilder();
matchEntryBuilder.setOxmClass(Nxm0Class.class);
matchEntryBuilder.setOxmMatchField(NxmOfEthDst.class);
matchEntryBuilder.setHasMask(false);
byte[] address = new byte[VALUE_LENGTH];
valuesBuilder.setMacAddress(new MacAddress(ByteBufUtils.macAddressToString(address)));
caseBuilder.setEthSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
return matchEntryBuilder.build();
}
Aggregations