+/*
+ * Copyright (c) 2013, 2015 Red Hat, 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.ovsdb.plugin.md;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
static final String OVS_NODE_PREFIX = "openvswitch:";
static final String OPENFLOW_NODE_PREFIX = "openflow:";
- static final Logger logger = LoggerFactory.getLogger(OvsdbInventoryManager.class);
+ static final Logger LOGGER = LoggerFactory.getLogger(OvsdbInventoryManager.class);
/**
tx.put(LogicalDatastoreType.CONFIGURATION, path, newNode, true);
try {
tx.submit().get();
- logger.debug("Removed Node {}", path.toString());
+ LOGGER.debug("Removed Node {}", path.toString());
} catch (InterruptedException | ExecutionException e) {
- logger.error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
}
}
tx.delete(LogicalDatastoreType.CONFIGURATION, path);
try {
tx.submit().get();
- logger.debug("Removed Node {}", path.toString());
+ LOGGER.debug("Removed Node {}", path.toString());
} catch (InterruptedException | ExecutionException e) {
- logger.error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
}
}
Row row,
Object context) {
if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Bridge.class))) {
- logger.debug("OVSDB Bridge Row removed on node {}", node.toString());
+ LOGGER.debug("OVSDB Bridge Row removed on node {}", node.toString());
DataBroker dataBroker = provider.getDataBroker();
Preconditions.checkNotNull(dataBroker);
OvsdbCapableNode ovsdbNode;
try {
Optional<OvsdbCapableNode> data = tx.read(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath).get();
+ if (!data.isPresent()) {
+ LOGGER.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
+ return;
+ }
ovsdbNode = data.get();
} catch (InterruptedException | ExecutionException e) {
- logger.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
+ LOGGER.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
return;
}
try {
tx.submit().get();
- logger.debug("Transaction success for delete of {} and update of {}",
+ LOGGER.debug("Transaction success for delete of {} and update of {}",
openflowNodePath.toString(),
ovsdbNodePath.toString());
} catch (InterruptedException | ExecutionException e) {
- logger.error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
}
}
}
String uuid,
Row old,
Row row) {
- logger.debug("OVSDB Bridge Row updated on node {}", node.toString());
+ LOGGER.debug("OVSDB Bridge Row updated on node {}", node.toString());
if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Bridge.class))) {
DataBroker dataBroker = provider.getDataBroker();
Bridge bridge = ovsdbConfigurationService.getTypedRow(node, Bridge.class, row);
ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
OvsdbCapableNode ovsdbNode;
try {
- Optional<OvsdbCapableNode>
- data = tx.read(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath).get();
+ Optional<OvsdbCapableNode> data = tx.read(LogicalDatastoreType.CONFIGURATION, ovsdbNodePath).get();
+ if (!data.isPresent()) {
+ LOGGER.error("OVSDB node not updated. Parent node for {} does not exist", ovsdbNodePath.toString());
+ return;
+ }
ovsdbNode = data.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException("Node does not exist");
try {
tx.submit().get();
- logger.debug("Transaction success for addition of {} and update of {}",
+ LOGGER.debug("Transaction success for addition of {} and update of {}",
openflowNodepath.toString(),
ovsdbNodePath.toString());
} catch (InterruptedException | ExecutionException e) {
- logger.error(e.getMessage(), e);
+ LOGGER.error(e.getMessage(), e);
}
}
}