use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class SetDlSrcActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final MacAddress address = new MacAddress("00:01:02:03:04:05");
final Action action = new SetDlSrcActionCaseBuilder().setSetDlSrcAction(new SetDlSrcActionBuilder().setAddress(address).build()).build();
assertAction(action, out -> {
byte[] addressBytes = new byte[6];
out.readBytes(addressBytes);
assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), address.getValue());
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class Ipv6NdSllEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final MacAddress address = new MacAddress("00:01:02:03:04:05");
writeHeader(in, false);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
assertEquals(address.getValue(), match.getIpv6NdSll().getValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction35.
private static InstructionsBuilder createAppyActionInstruction35() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final ActionBuilder ab1 = new ActionBuilder();
final ActionBuilder ab2 = new ActionBuilder();
final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
// Ethernet
final EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
final EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01"));
final EthernetMatchBuilder ethernetMatch1 = new EthernetMatchBuilder();
final EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
ethDestBuilder.setAddress(new MacAddress("00:00:00:00:00:02"));
final EthernetMatchBuilder ethernetMatch2 = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86ddL));
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
ethernetMatch1.setEthernetDestination(ethDestBuilder.build());
ethernetMatch2.setEthernetType(ethTypeBuilder.build());
setFieldBuilder.setEthernetMatch(ethernetMatch.build());
setFieldBuilder1.setEthernetMatch(ethernetMatch1.build());
setFieldBuilder2.setEthernetMatch(ethernetMatch2.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
ab1.setKey(new ActionKey(1));
actionList.add(ab1.build());
ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
ab2.setKey(new ActionKey(2));
actionList.add(ab2.build());
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
final InstructionBuilder ib = new InstructionBuilder();
ib.setKey(new InstructionKey(0));
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
ib.setKey(new InstructionKey(0));
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction43.
private static InstructionsBuilder createAppyActionInstruction43() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final ActionBuilder ab1 = new ActionBuilder();
final ActionBuilder ab2 = new ActionBuilder();
final ActionBuilder ab3 = new ActionBuilder();
final ActionBuilder ab4 = new ActionBuilder();
final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder2 = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder3 = new SetFieldBuilder();
final SetFieldBuilder setFieldBuilder4 = new SetFieldBuilder();
// setting the values of ARP
final MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS);
final MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS);
final Ipv4Prefix dstiparp = new Ipv4Prefix("200.71.9.52");
final Ipv4Prefix srciparp = new Ipv4Prefix("100.1.1.1");
// create ARP match action
final ArpMatchBuilder arpmatch = new ArpMatchBuilder();
final ArpMatchBuilder arpmatch1 = new ArpMatchBuilder();
final ArpMatchBuilder arpmatch2 = new ArpMatchBuilder();
final ArpMatchBuilder arpmatch3 = new ArpMatchBuilder();
final ArpMatchBuilder arpmatch4 = new ArpMatchBuilder();
final ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
arpsrc.setAddress(macsrc);
final ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
arpdst.setAddress(macdest);
arpmatch.setArpOp(2);
arpmatch1.setArpSourceHardwareAddress(arpsrc.build());
arpmatch2.setArpTargetHardwareAddress(arpdst.build());
arpmatch3.setArpSourceTransportAddress(srciparp);
arpmatch4.setArpTargetTransportAddress(dstiparp);
setFieldBuilder.setLayer3Match(arpmatch.build());
ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
setFieldBuilder1.setLayer3Match(arpmatch1.build());
ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
ab1.setKey(new ActionKey(1));
actionList.add(ab1.build());
setFieldBuilder2.setLayer3Match(arpmatch2.build());
ab2.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder2.build()).build());
ab2.setKey(new ActionKey(2));
actionList.add(ab2.build());
setFieldBuilder3.setLayer3Match(arpmatch3.build());
ab3.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder3.build()).build());
ab3.setKey(new ActionKey(3));
actionList.add(ab3.build());
setFieldBuilder4.setLayer3Match(arpmatch4.build());
ab4.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder4.build()).build());
ab4.setKey(new ActionKey(4));
actionList.add(ab4.build());
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
final InstructionBuilder ib = new InstructionBuilder();
ib.setKey(new InstructionKey(0));
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createAppyActionInstruction5.
private static InstructionsBuilder createAppyActionInstruction5() {
final List<Action> actionList = new ArrayList<>();
final ActionBuilder ab = new ActionBuilder();
final SetDlDstActionBuilder setdl = new SetDlDstActionBuilder();
setdl.setAddress(new MacAddress("00:05:b9:7c:81:5f"));
ab.setAction(new SetDlDstActionCaseBuilder().setSetDlDstAction(setdl.build()).build());
ab.setKey(new ActionKey(0));
actionList.add(ab.build());
// Create an Apply Action
final ApplyActionsBuilder aab = new ApplyActionsBuilder();
aab.setAction(actionList);
// Wrap our Apply Action in an Instruction
final InstructionBuilder ib = new InstructionBuilder();
ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
// Put our Instruction in a list of Instructions
final InstructionsBuilder isb = new InstructionsBuilder();
final List<Instruction> instructions = new ArrayList<>();
ib.setKey(new InstructionKey(0));
instructions.add(ib.build());
isb.setInstruction(instructions);
return isb;
}
Aggregations