Merge "OPNFLWPLUG-1062 Include additional LLDP fields in liblldp"
authorAnil Vishnoi <vishnoianil@gmail.com>
Wed, 1 May 2019 20:14:47 +0000 (20:14 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 1 May 2019 20:14:47 +0000 (20:14 +0000)
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDP.java
libraries/liblldp/src/main/java/org/opendaylight/openflowplugin/libraries/liblldp/LLDPTLV.java

index 141004c14155626f71b863435f1ccebd5d33bdd1..696562c1affb08acef2525f1c1af6a6f261e4eec 100644 (file)
@@ -25,6 +25,10 @@ public class LLDP extends Packet {
     private static final String SYSTEMNAMEID = "SystemNameID";
     private static final String PORTID = "PortId";
     private static final String TTL = "TTL";
+    private static final String SYSTEMDESC = "SystemDesc";
+    private static final String PORTDESC = "PortDesc";
+    private static final String SYSTEMCAPABILITIES = "SystemCapabilities";
+    private static final String MANAGEMENTADDRESS = "ManagementAddress";
     private static final int LLDP_DEFAULT_TLVS = 3;
     private static final LLDPTLV EMPTY_TLV = new LLDPTLV().setLength((short) 0).setType((byte) 0);
     @SuppressFBWarnings("MS_PKGPROTECT")
@@ -71,6 +75,14 @@ public class LLDP extends Packet {
                 return LLDPTLV.TLVType.TTL.getValue();
             case SYSTEMNAMEID:
                 return LLDPTLV.TLVType.SystemName.getValue();
+            case SYSTEMDESC:
+                return LLDPTLV.TLVType.SystemDesc.getValue();
+            case PORTDESC:
+                return LLDPTLV.TLVType.PortDesc.getValue();
+            case SYSTEMCAPABILITIES:
+                return LLDPTLV.TLVType.SystemCapabilities.getValue();
+            case MANAGEMENTADDRESS:
+                return LLDPTLV.TLVType.ManagementAddress.getValue();
             default:
                 return LLDPTLV.TLVType.Unknown.getValue();
         }
@@ -166,6 +178,54 @@ public class LLDP extends Packet {
         return this;
     }
 
+    /**
+     * Return the SystemDesc TLV.
+     */
+    public LLDPTLV getSystemDesc() {
+        return getTLV(SYSTEMDESC);
+    }
+
+    public LLDP setSystemDesc(final LLDPTLV systemDesc) {
+        setTLV(SYSTEMDESC, systemDesc);
+        return this;
+    }
+
+    /**
+     * Return the PortDesc TLV.
+     */
+    public LLDPTLV getPortDesc() {
+        return getTLV(PORTDESC);
+    }
+
+    public LLDP setPortDesc(final LLDPTLV portDesc) {
+        setTLV(PORTDESC, portDesc);
+        return this;
+    }
+
+    /**
+     * Return the SystemCapabilities TLV.
+     */
+    public LLDPTLV getSystemCapabilities() {
+        return getTLV(SYSTEMCAPABILITIES);
+    }
+
+    public LLDP setSystemCapabilities(final LLDPTLV systemCapabilities) {
+        setTLV(SYSTEMCAPABILITIES, systemCapabilities);
+        return this;
+    }
+
+    /**
+     * Return the ManagementAddress TLV.
+     */
+    public LLDPTLV getManagementAddress() {
+        return getTLV(MANAGEMENTADDRESS);
+    }
+
+    public LLDP setManagementAddress(final LLDPTLV managementAddress) {
+        setTLV(MANAGEMENTADDRESS, managementAddress);
+        return this;
+    }
+
     /**
      * Returns the optionalTLVList.
      */
@@ -271,3 +331,4 @@ public class LLDP extends Packet {
         return len / NetUtils.NUM_BITS_IN_A_BYTE;
     }
 }
+
index 85c9d0b9dc4e4eed1099fe2a553f0b7321eac870..2263a5f749ca40bb6947482bf544a5cd64a60055 100644 (file)
@@ -50,8 +50,8 @@ public class LLDPTLV extends Packet {
 
     public enum TLVType {
         Unknown((byte) 0), ChassisID((byte) 1), PortID((byte) 2), TTL((byte) 3), PortDesc(
-                (byte) 4), SystemName((byte) 5), SystemDesc((byte) 6), Custom(
-                        (byte) 127);
+                (byte) 4), SystemName((byte) 5), SystemDesc((byte) 6), SystemCapabilities((byte) 7),
+                ManagementAddress((byte) 8), Custom((byte) 127);
 
         private final byte value;
 
@@ -388,3 +388,4 @@ public class LLDPTLV extends Packet {
         return new CustomTLVKey(BitBufferHelper.getInt(LLDPTLV.OFOUI), LLDPTLV.CUSTOM_TLV_SUB_TYPE_CUSTOM_SEC[0]);
     }
 }
+