use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project netvirt by opendaylight.
the class Ipv6PktHandlerTest method testOnPacketReceivedWithInvalidParams.
@Test
public void testOnPacketReceivedWithInvalidParams() throws Exception {
// invalid ethtype
pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
"33 33 FF F5 00 00", // Source MAC
"00 01 02 03 04 05", // Invalid (fake IPv6)
"80 00", // Version 6, traffic class E0, no flowlabel
"6E 00 00 00", // Payload length
"00 18", // Next header is authentication
"3A", // Hop limit
"FF", // Source IP
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
"FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00")).build());
verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
// invalid ipv6 header
pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
"33 33 FF F5 00 00", // Source MAC
"00 01 02 03 04 05", // IPv6
"86 DD", // Version 6, traffic class E0, no flowlabel
"6E 00 00 00", // Payload length
"00 18", // Next header is authentication
"33", // Hop limit
"FF", // Source IP
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
"FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00")).build());
verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
// invalid icmpv6 header
pktHandler.onPacketReceived(new PacketReceivedBuilder().setPayload(ipv6TestUtils.buildPacket(// Destination MAC
"33 33 FF F5 00 00", // Source MAC
"00 01 02 03 04 05", // IPv6
"86 DD", // Version 6, traffic class E0, no flowlabel
"6E 00 00 00", // Payload length
"00 18", // Next header is ICMPv6
"3A", // Hop limit
"FF", // Source IP
"00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // Destination IP
"FF 02 00 00 00 00 00 00 00 00 00 01 FF F5 00 00", // ICMPv6 router solicitation
"85", // Code
"00", // Checksum (valid)
"67 3C", // ICMPv6 message body
"00 00 00 00", // Target
"FE 80 00 00 00 00 00 00 C0 00 54 FF FE F5 00 00")).build());
verify(pktProcessService, times(0)).transmitPacket(any(TransmitPacketInput.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType 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.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class OfToSalEthTypeCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull EthTypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder();
final EthType ethTypeCase = source.getEthType();
if (ethTypeCase != null) {
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType((long) ethTypeCase.getEthType().getValue()));
ethMatchBuilder.setEthernetType(ethTypeBuilder.build());
matchBuilder.setEthernetMatch(ethMatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class PushMplsActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int ethType = 10;
final Action action = new PushMplsActionCaseBuilder().setPushMplsAction(new PushMplsActionBuilder().setEthernetType(ethType).build()).build();
assertAction(action, out -> {
assertEquals(out.readUnsignedShort(), ethType);
out.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createToSMatch.
private static MatchBuilder createToSMatch() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder();
final EthernetTypeBuilder ethtype = new EthernetTypeBuilder();
final EtherType type = new EtherType(0x0800L);
ethmatch.setEthernetType(ethtype.setType(type).build());
match.setEthernetMatch(ethmatch.build());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 6);
final Dscp dscp = new Dscp((short) 8);
ipmatch.setIpDscp(dscp);
match.setIpMatch(ipmatch.build());
return match;
}
Aggregations