private Boolean throttling = false; // if true, no more batching.
private volatile Boolean shuttingDown = false;
- private LLDPTLV chassisIdTlv, portIdTlv, ttlTlv, customTlv;
+ private LLDPTLV chassisIdTlv, systemNameTlv, portIdTlv, ttlTlv, customTlv;
private IPluginOutConnectionService connectionOutService;
class DiscoveryTransmit implements Runnable {
chassisIdTlv.setType(LLDPTLV.TLVType.ChassisID.getValue()).setLength((short) cidValue.length)
.setValue(cidValue);
+ // Create LLDP SystemName TLV
+ byte[] snValue = LLDPTLV.createSystemNameTLVValue(nodeConnector.getNode().toString());
+ systemNameTlv.setType(LLDPTLV.TLVType.SystemName.getValue()).setLength((short) snValue.length)
+ .setValue(snValue);
+
// Create LLDP PortID TLV
String portId = nodeConnector.getNodeConnectorIDString();
byte[] pidValue = LLDPTLV.createPortIDTLVValue(portId);
// Create discovery pkt
LLDP discoveryPkt = new LLDP();
- discoveryPkt.setChassisId(chassisIdTlv).setPortId(portIdTlv).setTtl(ttlTlv).setOptionalTLVList(customList);
+ discoveryPkt.setChassisId(chassisIdTlv).setPortId(portIdTlv).setTtl(ttlTlv).setSystemNameId(systemNameTlv)
+ .setOptionalTLVList(customList);
RawPacket rawPkt = null;
try {
chassisIdTlv = new LLDPTLV();
chassisIdTlv.setType(LLDPTLV.TLVType.ChassisID.getValue());
+ // Create LLDP SystemName TLV
+ systemNameTlv = new LLDPTLV();
+ systemNameTlv.setType(LLDPTLV.TLVType.SystemName.getValue());
+
// Create LLDP PortID TLV
portIdTlv = new LLDPTLV();
portIdTlv.setType(LLDPTLV.TLVType.PortID.getValue());
public class LLDP extends Packet {
private static final String CHASSISID = "ChassisId";
+ private static final String SYSTEMNAMEID = "SystemNameID";
private static final String PORTID = "PortId";
private static final String TTL = "TTL";
- private static final int LLDPDefaultTlvs = 3;
+ private static final int LLDPDefaultTlvs = 4;
private static LLDPTLV emptyTLV = new LLDPTLV().setLength((short) 0)
.setType((byte) 0);
public static final byte[] LLDPMulticastMac = { 1, (byte) 0x80,
return this;
}
+ /**
+ * @return the SystemName TLV
+ */
+ public LLDPTLV getSystemNameId() {
+ return getTLV(SYSTEMNAMEID);
+ }
+
+ /**
+ * @param LLDPTLV
+ * - the chassisId to set
+ */
+ public LLDP setSystemNameId(LLDPTLV systemNameId) {
+ tlvList.put(getType(SYSTEMNAMEID), systemNameId);
+ return this;
+ }
+
/**
* @return LLDPTLV - the portId TLV
*/
getfieldnumBits(VALUE)); // variable
}
+ /**
+ * Creates the SystemName TLV value
+ *
+ * @param nodeId
+ * node identifier string
+ * @return the SystemName TLV value in byte array
+ */
+ static public byte[] createSystemNameTLVValue(String nodeId) {
+ byte[] nid = nodeId.getBytes();
+ return nid;
+ }
+
/**
* Creates the ChassisID TLV value including the subtype and ChassisID
* string
public static NodeConnector createNodeConnector(
String nodeConnectorType, Object portId, Node node) {
try {
- return new NodeConnector(nodeConnectorType, portId, node);
+ if (nodeConnectorType.equals(Node.NodeIDType.OPENFLOW) && (portId.getClass() == String.class)) {
+ return new NodeConnector(nodeConnectorType, Short.parseShort((String) portId), node);
+ } else {
+ return new NodeConnector(nodeConnectorType, portId, node);
+ }
} catch (ConstructionException e1) {
logger.error("",e1);
return null;