From 5d50003bba95c2a58a87f9bd94f8dfd3c9e7d505 Mon Sep 17 00:00:00 2001 From: Ed Warnicke Date: Mon, 6 Apr 2015 09:30:41 -0700 Subject: [PATCH] Small fix to handle the fact that ovsdb sometimes returns ofport of -1 It turns out that sometimes ovsdb returns an ofport of -1 to indicate that there is no associated ofport value. We should represent that by *not* having an ofport value Change-Id: I2a28a34333ff1b92728286672499714079346444 Signed-off-by: Ed Warnicke --- .../md/OvsdbPortUpdateCommand.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java index a0ecb9096..f69b7458c 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbPortUpdateCommand.java @@ -135,15 +135,27 @@ public class OvsdbPortUpdateCommand extends AbstractTransactionCommand { Set ofPorts = interfIter.getOpenFlowPortColumn().getData(); if (ofPorts != null && !ofPorts.isEmpty()) { Iterator ofPortsIter = ofPorts.iterator(); - ovsdbTerminationPointBuilder - .setOfport(ofPortsIter.next().intValue()); + int ofPort = ofPortsIter.next().intValue(); + if (ofPort >= 0) { + ovsdbTerminationPointBuilder + .setOfport(ofPort); + } else { + LOG.debug("Received negative value for ofPort from ovsdb for {} {} {}", + bridge.getName(), interfIter.getName(),ofPort); + } } Set ofPortRequests = interfIter .getOpenFlowPortRequestColumn().getData(); if (ofPortRequests != null && !ofPortRequests.isEmpty()) { Iterator ofPortRequestsIter = ofPortRequests.iterator(); - ovsdbTerminationPointBuilder - .setOfportRequest(ofPortRequestsIter.next().intValue()); + int ofPort = ofPortRequestsIter.next().intValue(); + if (ofPort >= 0) { + ovsdbTerminationPointBuilder + .setOfportRequest(ofPort); + } else { + LOG.debug("Received negative value for ofPort from ovsdb for {} {} {}", + bridge.getName(), interfIter.getName(),ofPort); + } } Map externalIds = interfIter.getExternalIdsColumn().getData(); -- 2.36.6