From: Alex Fan Date: Fri, 13 Jun 2014 19:58:42 +0000 (-0700) Subject: Removed ipv4decoder, arpdecoder, & ethernetdecoder modules from parent pom.xml. ... X-Git-Tag: release/helium-sr1~119^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=3b0ae6934a4498ecd6520cbcfb51466d3abd2d4d;p=l2switch.git Removed ipv4decoder, arpdecoder, & ethernetdecoder modules from parent pom.xml. Move ethernet files back into packethandler for end-to-end testing with mininet. Change-Id: I8cfb3cfa78aecd6a69899176cc75249fe70e06ad Signed-off-by: Alex Fan --- diff --git a/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/PacketHandlerProvider.java b/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/PacketHandlerProvider.java index e14e3612..06f7ec0e 100644 --- a/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/PacketHandlerProvider.java +++ b/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/PacketHandlerProvider.java @@ -11,10 +11,11 @@ import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; import org.opendaylight.controller.sal.binding.api.data.DataBrokerService; -import org.opendaylight.l2switch.packethandler.decoders.DecoderRegistry; -import org.opendaylight.l2switch.packethandler.decoders.PacketDecoderService; -import org.opendaylight.l2switch.packethandler.decoders.PacketDecoderServiceImpl; -import org.opendaylight.l2switch.packethandler.decoders.PacketNotificationRegistry; +import org.opendaylight.l2switch.packethandler.decoders.*; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.PacketType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadTypeBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.EthernetPacketReceived; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.binding.NotificationListener; import org.slf4j.Logger; @@ -49,6 +50,7 @@ public class PacketHandlerProvider extends AbstractBindingAwareProvider notificationProviderService.registerInterestListener(packetNotificationRegistry); PacketDecoderService packetDecoderService = new PacketDecoderServiceImpl(decoderRegistry, packetNotificationRegistry); + packetDecoderService.registerDecoder(getEthernetArpPacketPayloadType(), new EthernetDecoder(), EthernetPacketReceived.class); RawPacketHandler rawPacketHandler = new RawPacketHandler(); rawPacketHandler.setNotificationProviderService(notificationProviderService); @@ -67,4 +69,11 @@ public class PacketHandlerProvider extends AbstractBindingAwareProvider if(rawPacketListenerRegistration != null) rawPacketListenerRegistration.close(); } + + private PacketPayloadType getEthernetArpPacketPayloadType() { + return new PacketPayloadTypeBuilder() + .setPacketType(PacketType.Raw) + .setPayloadType(PacketType.Ethernet.getIntValue()) + .build(); + } } \ No newline at end of file diff --git a/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/RawPacketHandler.java b/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/RawPacketHandler.java index 25991bfb..00dce241 100644 --- a/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/RawPacketHandler.java +++ b/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/RawPacketHandler.java @@ -12,6 +12,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadTypeBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.RawPacket; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.RawPacketBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadTypeBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener; import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived; import org.opendaylight.yangtools.yang.binding.Notification; diff --git a/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/decoders/EthernetDecoder.java b/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/decoders/EthernetDecoder.java new file mode 100644 index 00000000..bcd58f9d --- /dev/null +++ b/packethandler/implementation/src/main/java/org/opendaylight/l2switch/packethandler/decoders/EthernetDecoder.java @@ -0,0 +1,139 @@ +package org.opendaylight.l2switch.packethandler.decoders; + +import org.opendaylight.controller.sal.packet.BitBufferHelper; +import org.opendaylight.controller.sal.packet.BufferException; +import org.opendaylight.controller.sal.utils.HexEncode; +import org.opendaylight.controller.sal.utils.NetUtils; +import org.opendaylight.l2switch.packethandler.decoders.PacketDecoder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.Packet; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.PacketType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadTypeBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.RawPacket; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.RawPacketBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.EthernetPacketBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.EthernetPacketGrp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.EthernetPacketReceivedBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.Header8021qType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.KnownEtherType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.ethernet.packet.grp.Header8021q; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.ethernet.packet.grp.Header8021qBuilder; +import org.opendaylight.yangtools.yang.binding.Notification; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Arrays; + +/** + * Ethernet Packet Decoder + */ +public class EthernetDecoder implements PacketDecoder { + private static final Logger _logger = LoggerFactory.getLogger(EthernetDecoder.class); + public static final Integer LENGTH_MAX = 1500; + public static final Integer ETHERTYPE_MIN = 1536; + public static final Integer ETHERTYPE_8021Q = 0x8100; + public static final Integer ETHERTYPE_QINQ = 0x9100; + + /** + * Decode a RawPacket into an EthernetPacket + * + * @param packet -- data from wire to deserialize + * @return + * @throws BufferException + */ + @Override + public Packet decode(Packet packet) { + RawPacket rawPacket = packet.getRawPacket(); + EthernetPacketBuilder builder = new EthernetPacketBuilder(); + byte[] data = rawPacket.getPayload(); + + try { + // Save original rawPacket + builder.setRawPacket(new RawPacketBuilder().setIngress(rawPacket.getIngress()).setPayload(data).build()); + + // Deserialize the destination & source fields + builder.setDestinationMac(new MacAddress(HexEncode.bytesToHexStringFormat(BitBufferHelper.getBits(data, 0, 48)))); + builder.setSourceMac(new MacAddress(HexEncode.bytesToHexStringFormat(BitBufferHelper.getBits(data, 48, 48)))); + + // Deserialize the optional field 802.1Q headers + Integer nextField = BitBufferHelper.getInt(BitBufferHelper.getBits(data, 96, 16)); + int extraHeaderBits = 0; + ArrayList headerList = new ArrayList(); + while(nextField.equals(ETHERTYPE_8021Q) || nextField.equals(ETHERTYPE_QINQ)) { + Header8021qBuilder hBuilder = new Header8021qBuilder(); + hBuilder.setType(Header8021qType.forValue(nextField)); + + // Read 2 more bytes for priority (3bits), drop eligible (1bit), vlan-id (12bits) + byte[] vlanBytes = BitBufferHelper.getBits(data, 112 + extraHeaderBits, 16); + + // Remove the sign & right-shift to get the priority code + hBuilder.setPriorityCode((short) ((vlanBytes[0] & 0xff) >> 5)); + + // Remove the sign & remove priority code bits & right-shift to get drop-eligible bit + hBuilder.setDropEligible(1 == (((vlanBytes[0] & 0xff) & 0x10) >> 4)); + + // Remove priority code & drop-eligible bits, to get the VLAN-id + vlanBytes[0] = (byte) (vlanBytes[0] & 0x0F); + hBuilder.setVlan(BitBufferHelper.getInt(vlanBytes)); + + // Add 802.1Q header to the growing collection + headerList.add(hBuilder.build()); + + // Reset value of "nextField" to correspond to following 2 bytes for next 802.1Q header or EtherType/Length + nextField = BitBufferHelper.getInt(BitBufferHelper.getBits(data, 128 + extraHeaderBits, 16)); + + // 802.1Q header means payload starts at a later position + extraHeaderBits += 32; + } + // Set 802.1Q headers + if(!headerList.isEmpty()) { + builder.setHeader8021q(headerList); + } + + // Deserialize the EtherType or Length field + if(nextField >= ETHERTYPE_MIN) { + builder.setEthertype(KnownEtherType.forValue(nextField)); + } else if(nextField <= LENGTH_MAX) { + builder.setEthernetLength(nextField); + } else { + _logger.debug("Undefined header, value is not valid EtherType or length. Value is " + nextField); + } + + // Deserialize the payload now + int payloadStart = 96 + 16 + extraHeaderBits; + int payloadSize = data.length * NetUtils.NumBitsInAByte - payloadStart; + int start = payloadStart / NetUtils.NumBitsInAByte; + int stop = start + payloadSize / NetUtils.NumBitsInAByte; + builder.setEthernetPayload(Arrays.copyOfRange(data, start, stop)); + + if(null != builder.getEthertype()) { + builder.setPacketPayloadType(new PacketPayloadTypeBuilder() + .setPacketType(PacketType.Ethernet) + .setPayloadType(builder.getEthertype().getIntValue()) + .build()); + } + + } catch(BufferException be) { + _logger.info("Exception during decoding raw packet to ethernet."); + } + + return builder.build(); + + //ToDo: Possibly log these values + /*if (_logger.isTraceEnabled()) { + _logger.trace("{}: {}: {} (offset {} bitsize {})", + new Object[] { this.getClass().getSimpleName(), hdrField, + HexEncode.bytesToHexString(hdrFieldBytes), + startOffset, numBits }); + }*/ + } + + @Override + public Notification buildPacketNotification(Packet decodedPacket) { + if(!(decodedPacket instanceof EthernetPacketGrp)) return null; + + EthernetPacketReceivedBuilder ethernetPacketReceivedBuilder = new EthernetPacketReceivedBuilder((EthernetPacketGrp) decodedPacket); + return ethernetPacketReceivedBuilder.build(); + } +} diff --git a/packethandler/implementation/src/test/java/org/opendaylight/l2switch/packethandler/decoders/EthernetDecoderTest.java b/packethandler/implementation/src/test/java/org/opendaylight/l2switch/packethandler/decoders/EthernetDecoderTest.java new file mode 100644 index 00000000..61f3892e --- /dev/null +++ b/packethandler/implementation/src/test/java/org/opendaylight/l2switch/packethandler/decoders/EthernetDecoderTest.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.l2switch.packethandler.decoders; + +import org.junit.Test; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.BasePacket; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.BasePacketBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.PacketType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.PacketPayloadTypeBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.RawPacket; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.basepacket.rev140528.packet.RawPacketBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.EthernetPacketGrp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.Header8021qType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.ethernet.rev140528.KnownEtherType; + +import java.util.Arrays; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertNull; +import static junit.framework.Assert.assertTrue; + +public class EthernetDecoderTest { + + @Test + public void testDecode_IPv4EtherType() throws Exception { + byte[] packet = { + 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, + (byte) 0xcd, (byte) 0xef, 0x01, 0x23, 0x45, 0x67, + 0x08, 0x00, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + }; + EthernetPacketGrp e = (EthernetPacketGrp) new EthernetDecoder().decode(getBasePacket(new RawPacketBuilder().setPayload(packet).build())); + assertEquals(e.getEthertype(), KnownEtherType.Ipv4); + assertNull(e.getEthernetLength()); + assertNull(e.getHeader8021q()); + assertEquals(e.getDestinationMac().getValue(), "01:23:45:67:89:ab"); + assertEquals(e.getSourceMac().getValue(), "cd:ef:01:23:45:67"); + assertTrue(Arrays.equals(e.getEthernetPayload(), Arrays.copyOfRange(packet, 14, packet.length))); + } + + @Test + public void testDecode_Length() throws Exception { + byte[] packet = { + 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, + (byte) 0xcd, (byte) 0xef, 0x01, 0x23, 0x45, 0x67, + 0x00, 0x0e, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + }; + EthernetPacketGrp e = (EthernetPacketGrp) new EthernetDecoder().decode(getBasePacket(new RawPacketBuilder().setPayload(packet).build())); + assertNull(e.getEthertype()); + assertEquals(e.getEthernetLength().intValue(), 14); + assertNull(e.getHeader8021q()); + assertEquals(e.getDestinationMac().getValue(), "01:23:45:67:89:ab"); + assertEquals(e.getSourceMac().getValue(), "cd:ef:01:23:45:67"); + assertTrue(Arrays.equals(e.getEthernetPayload(), Arrays.copyOfRange(packet, 14, packet.length))); + } + + @Test + public void testDecode_IPv6EtherTypeWith8021qHeader() throws Exception { + byte[] packet = { + 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, + (byte) 0xcd, (byte) 0xef, 0x01, 0x23, 0x45, 0x67, + (byte) 0x81, 0x00, + (byte) 0xff, (byte) 0xff, + (byte) 0x86, (byte) 0xdd, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + }; + EthernetPacketGrp e = (EthernetPacketGrp) new EthernetDecoder().decode(getBasePacket(new RawPacketBuilder().setPayload(packet).build())); + assertEquals(e.getEthertype(), KnownEtherType.Ipv6); + assertNull(e.getEthernetLength()); + assertEquals(e.getHeader8021q().size(), 1); + assertEquals(e.getHeader8021q().get(0).getType(), Header8021qType.VlanTagged); + assertEquals(e.getHeader8021q().get(0).getPriorityCode().intValue(), 7); + assertTrue(e.getHeader8021q().get(0).isDropEligible()); + assertEquals(e.getHeader8021q().get(0).getVlan().intValue(), 4095); + assertEquals(e.getDestinationMac().getValue(), "01:23:45:67:89:ab"); + assertEquals(e.getSourceMac().getValue(), "cd:ef:01:23:45:67"); + assertTrue(Arrays.equals(e.getEthernetPayload(), Arrays.copyOfRange(packet, 18, packet.length))); + } + + @Test + public void testDecode_IPv6EtherTypeWithQinQ() throws Exception { + byte[] packet = { + 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xab, + (byte) 0xcd, (byte) 0xef, 0x01, 0x23, 0x45, 0x67, + (byte) 0x91, 0x00, + (byte) 0xff, (byte) 0xff, + (byte) 0x81, 0x00, + (byte) 0xa0, (byte) 0x0a, + (byte) 0x86, (byte) 0xdd, + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + }; + EthernetPacketGrp e = (EthernetPacketGrp) new EthernetDecoder().decode(getBasePacket(new RawPacketBuilder().setPayload(packet).build())); + assertEquals(e.getEthertype(), KnownEtherType.Ipv6); + assertNull(e.getEthernetLength()); + assertEquals(e.getHeader8021q().size(), 2); + assertEquals(e.getHeader8021q().get(0).getType(), Header8021qType.QInQ); + assertEquals(e.getHeader8021q().get(0).getPriorityCode().intValue(), 7); + assertTrue(e.getHeader8021q().get(0).isDropEligible()); + assertEquals(e.getHeader8021q().get(0).getVlan().intValue(), 4095); + assertEquals(e.getHeader8021q().get(1).getType(), Header8021qType.VlanTagged); + assertEquals(e.getHeader8021q().get(1).getPriorityCode().intValue(), 5); + assertFalse(e.getHeader8021q().get(1).isDropEligible()); + assertEquals(e.getHeader8021q().get(1).getVlan().intValue(), 10); + assertEquals(e.getDestinationMac().getValue(), "01:23:45:67:89:ab"); + assertEquals(e.getSourceMac().getValue(), "cd:ef:01:23:45:67"); + assertTrue(Arrays.equals(e.getEthernetPayload(), Arrays.copyOfRange(packet, 22, packet.length))); + } + + private BasePacket getBasePacket(RawPacket rawPacket) { + + return new BasePacketBuilder() + .setPacketPayloadType(getRawEthernetPacketPayloadType()) + .setRawPacket(rawPacket).build(); + } + + private PacketPayloadType getRawEthernetPacketPayloadType() { + + //currently doesn't make use of packet received as currently only ethernet packets are received so following is hard coded. + return new PacketPayloadTypeBuilder().setPacketType(PacketType.Raw).setPayloadType(PacketType.Ethernet.getIntValue()).build(); + } + +} diff --git a/packethandler/model/src/main/yang/ethernet-packet.yang b/packethandler/model/src/main/yang/ethernet-packet.yang new file mode 100644 index 00000000..84ee88bc --- /dev/null +++ b/packethandler/model/src/main/yang/ethernet-packet.yang @@ -0,0 +1,269 @@ +module ethernet-packet { + yang-version 1; + namespace "urn:opendaylight:packet:ethernet"; + prefix ethernet; + + import ietf-yang-types { + prefix yang; + revision-date 2010-09-24; + } + import packet-processing { + prefix pprocessing; + revision-date 2013-07-09; + } + import base-packet { + prefix bpacket; + revision-date 2014-05-28; + } + + revision 2014-05-28 { + description + "Ethernet packet module draft."; + } + + /* Taken from opendaylight-l2-types.yang, but it is commented out there -- will import once uncommented */ + typedef known-ether-type { + type enumeration { + enum "ipv4" { + value 2048; // 0x0800 + description "Internet Protocol version 4 (IPv4)"; + } + enum "arp" { + value 2054; // 0x0806 + description "Address Resolution Protocol (ARP)"; + } + enum "wake-on-lan" { + value 2114; // 0x0842 + description "Wake-on-LAN[3]"; + } + enum "ietf-trill" { + value 8947; // 0x22F3 + description "IETF TRILL Protocol"; + } + enum "decnet-phase-iv" { + value 24579; // 0x6003 + description "DECnet Phase IV"; + } + enum "reverse-arp" { + value 32821; // 0x8035 + description "Reverse Address Resolution Protocol"; + } + enum "apple-talk" { + value 32923; // 0x809B + description "AppleTalk (Ethertalk)"; + } + enum "apple-talk-arp" { + value 33011; // 0x80F3 + description "AppleTalk Address Resolution Protocol (AARP)"; + } + enum "vlan-tagged" { + value 33024; // 0x8100 + description "VLAN-tagged frame (IEEE 802.1Q) & Shortest Path Bridging IEEE 802.1aq[4]"; + } + enum "ipx" { + value 33079; // 0x8137 + description "IPX"; + } + enum "ipx2" { + value 33080; // 0x8138 + description "IPX"; + } + enum "qnx-qnet" { + value 33284; // 0x8204 + description "QNX Qnet"; + } + enum "ipv6" { + value 34525; // 0x86DD + description "Internet Protocol Version 6 (IPv6)"; + } + enum "ethernet-flow-control" { + value 34824; // 0x8808 + description "Ethernet flow control"; + } + enum "slow-protocols" { + value 34825; // 0x8809 + description "Slow Protocols (IEEE 802.3)"; + } + enum "cobra-net" { + value 34841; // 0x8819 + description "CobraNet"; + } + enum "mpls-unicast" { + value 34887; // 0x8847 + description "MPLS unicast"; + } + enum "mpls-multicast" { + value 34888; // 0x8848 + description "MPLS multicast"; + } + enum "PPP-over-ethernet-discovery" { + value 34915; // 0x8863 + description "PPPoE Discovery Stage"; + } + enum "PPP-over-ethernet-session" { + value 34916; // 0x8864 + description "PPPoE Session Stage"; + } + enum "jumbo" { + value 34928; // 0x8870 + description "Jumbo Frames[2]"; + } + enum "homeplug" { + value 34939; // 0x887B + description "HomePlug 1.0 MME"; + } + enum "eap-over-lan" { + value 34958; // 0x888E + description "EAP over LAN (IEEE 802.1X)"; + } + enum "profinet" { + value 34962; // 0x8892 + description "PROFINET Protocol"; + } + enum "hyper-scsi" { + value 34970; // 0x889A + description "HyperSCSI (SCSI over Ethernet)"; + } + enum "ata-over-ethernet" { + value 34978; // 0x88A2 + description "ATA over Ethernet"; + } + enum "ethercat" { + value 34980; // 0x88A4 + description "EtherCAT Protocol"; + } + enum "provider-bridging" { + value 34984; // 0x88A8 + description "Provider Bridging (IEEE 802.1ad) & Shortest Path Bridging IEEE 802.1aq[5]"; + } + enum "ethernet-powerlink" { + value 34987; // 0x88AB + description "Ethernet Powerlink[citation needed]"; + } + enum "lldp" { + value 35020; // 0x88CC + description "Link Layer Discovery Protocol (LLDP)"; + } + enum "sercos-3" { + value 35021; // 0x88CD + description "SERCOS III"; + } + enum "homeplug-av-mme" { + value 35041; // 0x88E1 + description "HomePlug AV MME[citation needed]"; + } + enum "media-redudancy-protocol" { + value 35043; // 0x88E3 + description "Media Redundancy Protocol (IEC62439-2)"; + } + enum "mac-security" { + value 35045; // 0x88E5 + description "MAC security (IEEE 802.1AE)"; + } + enum "precision-time-protocol" { + value 35063; // 0x88F7 + description "Precision Time Protocol (IEEE 1588)"; + } + enum "connectivity-fault-management" { + value 35074; // 0x8902 + description "IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)"; + } + enum "fibre-channel-over-ethernet" { + value 35078; // 0x8906 + description "Fibre Channel over Ethernet (FCoE)"; + } + enum "fibre-channel-over-ethernet-initialization" { + value 35092; // 0x8914 + description "FCoE Initialization Protocol"; + } + enum "rmda-over-converged-ethernet" { + value 35093; // 0x8915 + description "RDMA over Converged Ethernet (RoCE)"; + } + enum "high-availability-seamless-redudancy" { + value 35119; // 0x892F + description "High-availability Seamless Redundancy (HSR)"; + } + enum "ethernet-configuration-testing-protocol" { + value 36864; // 0x9000 + description "Ethernet Configuration Testing Protocol[6]"; + } + enum "q-in-q" { + value 37120; // 0x9100 + description "Q-in-Q"; + } + enum "veritas-low-latency" { + value 51966; // 0xCAFE + description "Veritas Low Latency Transport (LLT)[7] for Veritas Cluster Server"; + } + } + } + + typedef header8021q-type { + type enumeration { + enum "vlan-tagged" { + value 33024; // 0x8100 + description "VLAN-tagged frame (IEEE 802.1Q) & Shortest Path Bridging IEEE 802.1aq[4]"; + } + enum "q-in-q" { + value 37120; // 0x9100 + description "Q-in-Q"; + } + } + } + + grouping header8021q { + leaf type { + type header8021q-type; + } + + leaf priority-code { + type int16; + } + + leaf drop-eligible { + type boolean; + } + + leaf vlan { + type int32; + } + } + + grouping ethernet-packet-grp { + leaf source-mac { + type yang:mac-address; + } + + leaf destination-mac { + type yang:mac-address; + } + + list header8021q { + uses header8021q; + } + + leaf ethertype { + type known-ether-type; + } + + leaf ethernet-length { + type int32; + } + + leaf ethernet-payload { + type binary; + } + + uses bpacket:packet; + } + + container ethernet-packet { + uses ethernet-packet-grp; + } + + notification ethernet-packet-received { + uses ethernet-packet-grp; + } + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 418cd364..55490c38 100644 --- a/pom.xml +++ b/pom.xml @@ -11,9 +11,10 @@ parent packethandler - ethernetdecoder + endpointtracker