use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project netvirt by opendaylight.
the class AclMatches method addEthMatch.
private void addEthMatch() {
AceEth aceEth = (AceEth) matches.getAceType();
if (aceEth.getSourceMacAddress() != null) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
ethSourceBuilder.setAddress(new MacAddress(aceEth.getSourceMacAddress()));
ethernetMatch.setEthernetSource(ethSourceBuilder.build());
matchBuilder.setEthernetMatch(mergeEthernetMatch(matchBuilder, ethernetMatch));
}
if (aceEth.getDestinationMacAddress() != null) {
EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder();
ethDestBuilder.setAddress(new MacAddress(aceEth.getDestinationMacAddress()));
ethernetMatch.setEthernetDestination(ethDestBuilder.build());
matchBuilder.setEthernetMatch(mergeEthernetMatch(matchBuilder, ethernetMatch));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.
the class OpenflowPluginBulkTransactionProvider method createEthernetMatch.
private static MatchBuilder createEthernetMatch() {
// ethernettype
EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
// match
EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
// ethernet
EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder();
// macaddress
// match
MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff");
ethdest.setAddress(macdest);
// ethdest.setMask(mask1);
ethmatch.setEthernetDestination(ethdest.build());
EthernetSourceBuilder ethsrc = new EthernetSourceBuilder();
MacAddress macsrc = new MacAddress("00:00:00:00:23:ae");
ethsrc.setAddress(macsrc);
// ethsrc.setMask(mask2);
ethmatch.setEthernetSource(ethsrc.build());
MatchBuilder match = new MatchBuilder();
match.setEthernetMatch(ethmatch.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.
the class OfToSalEthDstCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
final EthDst ethDstCase = source.getEthDst();
if (ethDstCase != null) {
EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
ethDestinationBuilder.setAddress(ethDstCase.getMacAddress());
byte[] destinationMask = ethDstCase.getMask();
if (destinationMask != null) {
ethDestinationBuilder.setMask(new MacAddress(macAddressToString(destinationMask)));
}
ethMatchBuilder.setEthernetDestination(ethDestinationBuilder.build());
matchBuilder.setEthernetMatch(ethMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder in project openflowplugin by opendaylight.
the class EthernetDestinationEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final EthernetMatch ethernetMatch = builder.getEthernetMatch();
final EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
ethernetDestinationBuilder.setAddress(OxmDeserializerHelper.convertMacAddress(message));
if (hasMask) {
ethernetDestinationBuilder.setMask(OxmDeserializerHelper.convertMacAddress(message));
}
if (Objects.isNull(ethernetMatch)) {
builder.setEthernetMatch(new EthernetMatchBuilder().setEthernetDestination(ethernetDestinationBuilder.build()).build());
} else if (Objects.isNull(ethernetMatch.getEthernetDestination())) {
builder.setEthernetMatch(new EthernetMatchBuilder(ethernetMatch).setEthernetDestination(ethernetDestinationBuilder.build()).build());
} else {
throwErrorOnMalformed(builder, "ethernetMatch", "ethernetDestination");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder 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;
}
Aggregations