+/*
+ * 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.md.controller.topology.lldp.utils;
import java.nio.charset.Charset;
-import java.util.List;
import org.opendaylight.controller.sal.packet.Ethernet;
import org.opendaylight.controller.sal.packet.LLDP;
LLDP lldp = (LLDP) ethPkt.getPayload();
try {
- List<LLDPTLV> optionalTLVList = lldp.getOptionalTLVList();
- if (optionalTLVList == null) {
- return null;
- }
NodeId srcNodeId = null;
NodeConnectorId srcNodeConnectorId = null;
for (LLDPTLV lldptlv : lldp.getOptionalTLVList()) {
srcNodeId = new NodeId(srcNodeIdString);
}
}
-
- InstanceIdentifier<NodeConnector> srcInstanceId = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class,new NodeKey(srcNodeId))
- .child(NodeConnector.class, new NodeConnectorKey(srcNodeConnectorId))
- .toInstance();
- return new NodeConnectorRef(srcInstanceId);
+ if(srcNodeId != null && srcNodeConnectorId != null) {
+ InstanceIdentifier<NodeConnector> srcInstanceId = InstanceIdentifier.builder(Nodes.class)
+ .child(Node.class,new NodeKey(srcNodeId))
+ .child(NodeConnector.class, new NodeConnectorKey(srcNodeConnectorId))
+ .toInstance();
+ return new NodeConnectorRef(srcInstanceId);
+ }
} catch (Exception e) {
LOG.warn("Caught exception ", e);
}