[CONTROLLER-602] Cannot publish LinkDiscovered event Created: 04/Jul/14  Updated: 25/Jul/23  Due: 22/Sep/14  Resolved: 05/May/15

Status: Resolved
Project: controller
Component/s: adsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Ken Jarrad Assignee: Jan Hajnar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: PC


External issue ID: 1309

 Description   

java.lang.NumberFormatException: For input string: "172.16.1.56"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.7.0_51]
at java.lang.Integer.parseInt(Integer.java:492) ~[na:1.7.0_51]
at java.lang.Short.parseShort(Short.java:117) ~[na:1.7.0_51]
at java.lang.Short.valueOf(Short.java:173) ~[na:1.7.0_51]
at java.lang.Short.valueOf(Short.java:199) ~[na:1.7.0_51]
at org.opendaylight.controller.sal.compatibility.topology.TopologyMapping.toADNodeConnector(TopologyMapping.java:103) ~[na:na]



 Comments   
Comment by Ken Jarrad [ 04/Jul/14 ]

I was able to publish LinkDiscovered via NotificationService only a day or two earlier. Maybe I'm doing it differently now or maybe someone changed something.

final LinkDiscoveredBuilder ldb = new LinkDiscoveredBuilder();
final String nodeUriPrefix = "opendaylight-inventory:nodes/node/";
NodeId dstNodeId = new NodeId(nodeUriPrefix + edge.getTailNode().getName());
NodeConnectorId dstNodeConnectorId = new NodeConnectorId(edge.getTailNodeConnector().getAddressList().get(0).getHostAddress());
InstanceIdentifier<NodeConnector> dstInstanceId = InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(dstNodeId))
.child(NodeConnector.class, new NodeConnectorKey(dstNodeConnectorId))
.toInstance();
final NodeConnectorRef dstNodeConnectorRef = new NodeConnectorRef(dstInstanceId);
ldb.setDestination(dstNodeConnectorRef);
... same for source ...
final LinkDiscovered linkDiscovered = ldb.build();
logger.info("onepk connector topology link {}", linkDiscovered);
notificationService.publish(linkDiscovered);

Comment by Jan Hajnar [ 22/Sep/14 ]

Implementation has changed that sal-compatibility always expects openflow type NodeId and NodeConnectorId (short type). This will of course fail if input is something different.

Added hotfix that changes type from openflow to md-sal(string) when input is not convertible to short:
https://git.opendaylight.org/gerrit/#/c/11437/

Comment by Carol Sanders [ 05/May/15 ]

This bug is part of the project to Move all ADSAL associated component bugs to ADSAL.

Generated at Wed Feb 07 19:53:26 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.