- if (ovsdbNodeModification != null && ovsdbNodeModification.getDataBefore() != null
- && ovsdbNodeModification.getDataAfter() != null
- && ovsdbNodeModification.getDataAfter().getConnectionInfo() != null) {
- OvsdbClient client = cm.getClient(ovsdbNodeModification.getDataAfter().getConnectionInfo());
- if (client == null) {
- if (ovsdbNodeModification.getDataBefore() != null) {
- try {
- cm.disconnect(ovsdbNodeModification.getDataBefore());
- cm.connect(change.getRootPath().getRootIdentifier(), ovsdbNodeModification
- .getDataAfter());
- } catch (UnknownHostException | ConnectException e) {
- LOG.warn("Error disconnecting from or connecting to ovsdbNode", e);
+ if (ovsdbNodeModification != null) {
+ final OvsdbNodeAugmentation dataBefore = ovsdbNodeModification.getDataBefore();
+ if (dataBefore != null) {
+ OvsdbNodeAugmentation dataAfter = ovsdbNodeModification.getDataAfter();
+ if (dataAfter != null) {
+ ConnectionInfo connectionInfo = dataAfter.getConnectionInfo();
+ if (connectionInfo != null) {
+ OvsdbClient client = cm.getClient(connectionInfo);
+ if (client == null) {
+ if (dataBefore != null) {
+ try {
+ cm.disconnect(dataBefore);
+ cm.connect(change.getRootPath().getRootIdentifier(), dataAfter);
+ } catch (UnknownHostException | ConnectException e) {
+ LOG.warn("Error disconnecting from or connecting to ovsdbNode", e);
+ }
+ }
+ }
+ }