import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
import static org.opendaylight.mdsal.binding.testutils.AssertDataObjects.assertEqualBeans;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import javax.inject.Inject;
+import org.eclipse.jdt.annotation.NonNull;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.MethodRule;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter;
import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorTestModule;
import org.opendaylight.infrautils.caches.testutils.CacheModule;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
import org.opendaylight.infrautils.testutils.LogRule;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.WriteTransaction;
+import org.opendaylight.mdsal.common.api.CommitInfo;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeGre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone;
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(false).build();
// write into config DS
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> tx.put(iid, itmConfigObj, true)).get();
+
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ iid,itmConfigObj));
+ coordinatorEventsWaiter.awaitEventsConsumption();
// read from config DS
- boolean defTzEnabled = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(
+ boolean defTzEnabled = SingleTransactionDataBroker.syncReadOptional(
dataBroker, LogicalDatastoreType.CONFIGURATION, iid).get().isDefTzEnabled();
Assert.assertEquals(defTzEnabled, false);
}
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).build();
// write into config DS
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
- tx -> tx.put(iid, itmConfigObj, true)).get();
+ //txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ // tx -> tx.put(iid, itmConfigObj, true));
+
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ iid,itmConfigObj)).get();
+
+ coordinatorEventsWaiter.awaitEventsConsumption();
+
// read from config DS
- boolean defTzEnabled = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(
+ boolean defTzEnabled = SingleTransactionDataBroker.syncReadOptional(
dataBroker, LogicalDatastoreType.CONFIGURATION, iid).get().isDefTzEnabled();
Assert.assertEquals(defTzEnabled, true);
}
// set def-tz-tunnel-type to VXLAN
String defTzTunnelType = ITMConstants.TUNNEL_TYPE_VXLAN;
+ /*InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();*/
+
InstanceIdentifier<TransportZone> tzonePath = processDefTzOnItmConfig(defTzEnabledFlag,
defTzTunnelType);
Assert.assertNotNull(tzonePath);
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithVxlanTunnelType(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
}
@Test
// set def-tz-tunnel-type to GRE
String defTzTunnelType = ITMConstants.TUNNEL_TYPE_GRE;
+ InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(TunnelTypeGre.class)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
+
InstanceIdentifier<TransportZone> tzonePath = processDefTzOnItmConfig(defTzEnabledFlag,
defTzTunnelType);
Assert.assertNotNull(tzonePath);
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithGreTunnelType(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
}
@Test
defTzTunnelType);
Assert.assertNotNull(tzonePath);
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, tzonePath).get());
}
// set def-tz-tunnel-type to VXLAN
String defTzTunnelType = ITMConstants.TUNNEL_TYPE_VXLAN;
+ InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(TunnelTypeVxlan.class)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
InstanceIdentifier<TransportZone> tzonePath = processDefTzOnItmConfig(defTzEnabledFlag,
defTzTunnelType);
Assert.assertNotNull(tzonePath);
// check default-TZ is created with VXLAN tunnel type
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithVxlanTunnelType().getTunnelType(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath)
- .checkedGet().get().getTunnelType());
+ .get().get().getTunnelType());
// now, change def-tz-tunnel-type to GRE
defTzTunnelType = ITMConstants.TUNNEL_TYPE_GRE;
+
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(TunnelTypeGre.class)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
+
tzonePath = processDefTzOnItmConfig(defTzEnabledFlag, defTzTunnelType);
Assert.assertNotNull(tzonePath);
// check default-TZ is re-created with GRE tunnel type
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithGreTunnelType().getTunnelType(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath)
- .checkedGet().get().getTunnelType());
+ .get().get().getTunnelType());
}
@Test
itmProvider.createDefaultTransportZone(itmConfigObj);
coordinatorEventsWaiter.awaitEventsConsumption();
+ InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(TunnelTypeGre.class)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(
ITMConstants.DEFAULT_TRANSPORT_ZONE);
Assert.assertNotNull(tzonePath);
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithGreTunnelType(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
// now delete default-TZ first by setting def-tz-enabled flag to false
itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(false).build();
itmProvider.createDefaultTransportZone(itmConfigObj);
coordinatorEventsWaiter.awaitEventsConsumption();
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, tzonePath).get());
}
// wait for start-up default-TZ creation task to get over
coordinatorEventsWaiter.awaitEventsConsumption();
+ InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(TunnelTypeVxlan.class)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(
ITMConstants.DEFAULT_TRANSPORT_ZONE);
Assert.assertNotNull(tzonePath);
// check TEP is added into default-TZ
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithTep(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
// remove tep from default-TZ
futures = ItmTepAutoConfigTestUtil.deleteTep(ItmTestConstants.DEF_TZ_TEP_IP, ItmTestConstants.DEF_BR_DPID,
futures.get();
// check TEP is deleted from default-TZ
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
}
// check TZ is created with correct TZ name
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get().getZoneName());
// add tep
ListenableFuture<Void> futures = ItmTepAutoConfigTestUtil.addTep(ItmTestConstants.NB_TZ_TEP_IP,
// check TEP is added into TZ that is already created.
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
// remove tep
futures = ItmTepAutoConfigTestUtil.deleteTep(ItmTestConstants.NB_TZ_TEP_IP, ItmTestConstants.DEF_BR_DPID,
futures.get();
// check TEP is deleted
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
// for safe side, check TZ is present
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get().getZoneName());
}
@Test
// OvsdbNodeListener would be automatically listen on Node to add TEP
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT,
ItmTestConstants.LOCALHOST_IP);
- CheckedFuture<Void, TransactionCommitFailedException> future =
+ FluentFuture<? extends @NonNull CommitInfo> future =
OvsdbTestUtil.createNode(connInfo,tepIp,ITMConstants.DEFAULT_TRANSPORT_ZONE,dataBroker);
future.get();
+ InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
+
// add bridge into node
future = OvsdbTestUtil.addBridgeIntoNode(connInfo, ItmTestConstants.DEF_BR_NAME,
ItmTestConstants.DEF_BR_DPID, dataBroker);
// check TEP is added into default-TZ
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithTep(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath)
- .checkedGet().get());
+ .get().get());
// test TEP delete now,
// pass tep-ip with NULL value, tep-ip paramtere in external_ids will not be set.
Assert.assertNotNull(vtepPath);
// check TEP is deleted from default-TZ when TEP-Ip is removed from southbound
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
}
// OvsdbNodeListener would be automatically listen on Node to add TEP
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT,
ItmTestConstants.LOCALHOST_IP);
- CheckedFuture<Void, TransactionCommitFailedException> future = OvsdbTestUtil.createNode(
+ FluentFuture<? extends @NonNull CommitInfo> future = OvsdbTestUtil.createNode(
connInfo, tepIp, ItmTestConstants.TZ_NAME, dataBroker);
future.get();
// check TEP is added into NB configured TZ
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath)
- .checkedGet().get());
+ .get().get());
IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
coordinatorEventsWaiter.awaitEventsConsumption();
// check TEP is deleted from default-TZ when TEP-Ip is removed from southbound
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
}
// create Network topology node
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT,
ItmTestConstants.LOCALHOST_IP);
- CheckedFuture<Void, TransactionCommitFailedException> future = OvsdbTestUtil.createNode(
+ FluentFuture<? extends @NonNull CommitInfo> future = OvsdbTestUtil.createNode(
connInfo, ItmTestConstants.NOT_HOSTED_TZ_TEP_IP, ItmTestConstants.NOT_HOSTED_TZ_NAME,
dataBroker);
future.get();
// check not hosted
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL,
- notHostedtzPath).checkedGet().get());
+ notHostedtzPath).get().get());
future = OvsdbTestUtil.updateNode(connInfo, ItmTestConstants.NOT_HOSTED_TZ_TEP_IP, null,
ItmTestConstants.DEF_BR_NAME, dataBroker);
// wait for OvsdbNodeListener to perform config DS update through transaction
coordinatorEventsWaiter.awaitEventsConsumption();
- Assert.assertEquals(Optional.absent(),dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(),dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.OPERATIONAL, notHostedtzPath).get());
}
// OvsdbNodeListener would be automatically listen on Node to add TEP
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT,
ItmTestConstants.LOCALHOST_IP);
- CheckedFuture<Void, TransactionCommitFailedException> future = OvsdbTestUtil.createNode(
+ FluentFuture<? extends @NonNull CommitInfo> future = OvsdbTestUtil.createNode(
connInfo, tepIp, ITMConstants.DEFAULT_TRANSPORT_ZONE, dataBroker);
future.get();
+ InstanceIdentifier<TransportZone> tzPath =
+ ItmUtils.getTZInstanceIdentifier(ITMConstants.DEFAULT_TRANSPORT_ZONE);
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
+ tzPath, new TransportZoneBuilder().setZoneName(ITMConstants.DEFAULT_TRANSPORT_ZONE)
+ .setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN)
+ .withKey(new TransportZoneKey(ITMConstants.DEFAULT_TRANSPORT_ZONE))
+ .build(), WriteTransaction.CREATE_MISSING_PARENTS)).get();
+
// add bridge into node
future = OvsdbTestUtil.addBridgeIntoNode(connInfo, ItmTestConstants.DEF_BR_NAME,
ItmTestConstants.DEF_BR_DPID, dataBroker);
future.get();
// wait for OvsdbNodeListener to perform config DS update through transaction
coordinatorEventsWaiter.awaitEventsConsumption();
+ //Thread.sleep(5000);
// iid for default-TZ
InstanceIdentifier<TransportZone> defTzonePath = ItmTepAutoConfigTestUtil.getTzIid(
ITMConstants.DEFAULT_TRANSPORT_ZONE);
Assert.assertNotNull(defTzonePath);
+
// check TEP is added into default-TZ
+
+ /*if (dataBroker != null)
+ {
+ String errMsg = "present db :" + dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, defTzonePath);
+ throw new NullPointerException(errMsg);
+ }*/
+
+
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithTep(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, defTzonePath)
- .checkedGet().get());
+ .get().get());
// update OVSDB node with tep-ip in local_ip list
tepIp = ItmTestConstants.NB_TZ_TEP_IP;
// when local_ip is updated from southbound
assertEqualBeans(ExpectedDefTransportZoneObjects.defTzWithUpdatedTepIp(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION,defTzonePath)
- .checkedGet().get());
+ .get().get());
}
@Ignore
// OvsdbNodeListener would be automatically listen on Node to add TEP
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT,
ItmTestConstants.LOCALHOST_IP);
- CheckedFuture<Void, TransactionCommitFailedException> future = OvsdbTestUtil.createNode(
+ FluentFuture<? extends @NonNull CommitInfo> future = OvsdbTestUtil.createNode(
connInfo, tepIp, ITMConstants.DEFAULT_TRANSPORT_ZONE, dataBroker);
future.get();
// check TEP is added into default-TZ
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithTep(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, defTzonePath)
- .checkedGet().get());
+ .get().get());
IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
InstanceIdentifier<Vteps> oldVTepPath = ItmTepAutoConfigTestUtil.getTepIid(subnetMaskObj,
coordinatorEventsWaiter.awaitEventsConsumption();
// check old TEP which was in default-TZ is deleted
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, oldVTepPath).get());
// check TEP is updated and now it is added into TZA transport-zone when tzname is updated
// to TZA from southbound
assertEqualBeans(ExpectedTransportZoneObjects.updatedTransportZone(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION,tzaTzonePath)
- .checkedGet().get());
+ .get().get());
}
@Test
// OvsdbNodeListener would be automatically listen on Node to add TEP
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT,
ItmTestConstants.LOCALHOST_IP);
- CheckedFuture<Void, TransactionCommitFailedException> future = OvsdbTestUtil.createNode(
+ FluentFuture<? extends @NonNull CommitInfo> future = OvsdbTestUtil.createNode(
connInfo, tepIp, ItmTestConstants.TZ_NAME, dataBroker);
future.get();
ItmTestConstants.TZ_NAME);
Assert.assertNotNull(tzonePath);
+ /*if (dataBroker != null)
+ {
+ String errMsg = "present db :" + dataBroker.newReadOnlyTransaction().
+ read(LogicalDatastoreType.CONFIGURATION, tzonePath);
+ throw new NullPointerException(errMsg);
+ }*/
+
// check TEP is added into TZ
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
Assert.assertNotNull(newVTepPath);
// check old TEP having default-bridge-DPID is deleted
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.CONFIGURATION, oldVTepPath).get());
// check TEP is updated with dpnId of br2 when br-name is updated to br2 from southbound
Assert.assertEquals(ItmTestConstants.INT_BR2_DPID, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, newVTepPath).checkedGet().get().getDpnId());
+ .read(LogicalDatastoreType.CONFIGURATION, newVTepPath).get().get().getDpnId());
}
@Test
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, notHostedPath)
- .checkedGet().get());
+ .get().get());
}
@Test
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get());
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get());
//delete from not hosted list
future = ItmTepAutoConfigTestUtil.deleteTep(ItmTestConstants.NOT_HOSTED_TZ_TEP_IP,
ItmTestConstants.NOT_HOSTED_TZ_TEPDPN_ID, ItmTestConstants.NOT_HOSTED_TZ_NAME, dataBroker, txRunner);
future.get();
- Assert.assertEquals(Optional.absent(),
+ Assert.assertEquals(Optional.empty(),
dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get());
}
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get());
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get());
// create the same TZ
TransportZone transportZoneNorth = new TransportZoneBuilder().setZoneName(ItmTestConstants.NOT_HOSTED_TZ_NAME)
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects
.newTepNotHostedTransportZone().getUnknownVteps().get(0).getIpAddress().stringValue(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzPath)
- .checkedGet().get().getVteps().get(0).getIpAddress().stringValue());
+ .get().get().getVteps().get(0).getIpAddress().stringValue());
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone().getUnknownVteps()
.get(0).getDpnId(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzPath).checkedGet().get()
- .getVteps().get(0).getDpnId());
+ .read(LogicalDatastoreType.CONFIGURATION, tzPath).get()
+ .get().getVteps().get(0).getDpnId());
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone().getZoneName(),
dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzPath)
- .checkedGet().get().getZoneName());
+ .get().get().getZoneName());
// check TZ is removed
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
.read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get());
}
// check TZ is created
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get().getZoneName());
// add tep
ListenableFuture<Void> futures =
// check TEP is added into TZ that is already created.
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
// remove Transport Zone
txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.delete(LogicalDatastoreType.CONFIGURATION,
// for TEP movement through transaction
coordinatorEventsWaiter.awaitEventsConsumption();
//verify delete
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet());
+
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get());
//check deleted tz moved to notHosted
InstanceIdentifier<TepsInNotHostedTransportZone> notHostedPath =
ItmTepAutoConfigTestUtil.getTepNotHostedInTZIid(ItmTestConstants.TZ_NAME);
Assert.assertNotNull(notHostedPath);
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get().getZoneName());
//readd the same tz
txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION,
// for TEP movement through transaction
coordinatorEventsWaiter.awaitEventsConsumption();
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet());
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get());
+
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
}
@Test
// check TZ is created
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get().getZoneName());
// add tep
ListenableFuture<Void> futures =
// check TEP is added into TZ that is already created.
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
// remove Transport Zone
txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.delete(LogicalDatastoreType.CONFIGURATION,
// for TEP movement through transaction
coordinatorEventsWaiter.awaitEventsConsumption();
//verify delete
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet());
+
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get());
//check deleted tz moved to notHosted
InstanceIdentifier<TepsInNotHostedTransportZone> notHostedPath =
coordinatorEventsWaiter.awaitEventsConsumption();
Assert.assertNotNull(notHostedPath);
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get().getZoneName());
//create vtepList form unknownVtepList
List<Vteps> vtepsList = new ArrayList<>();
List<UnknownVteps> unknownVtepsList = dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get().getUnknownVteps();
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get().getUnknownVteps();
for (UnknownVteps unknownVtep:unknownVtepsList) {
Vteps vteps = new VtepsBuilder().setDpnId(unknownVtep.getDpnId())
coordinatorEventsWaiter.awaitEventsConsumption();
// verify TZ is moved from notHosted to transport zone and their should be only one vtep in it.
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet());
+
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get());
+
assertEqualBeans(1, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get()
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get()
.getVteps().size());
}
// check TZ is created
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get().getZoneName());
// add tep
ListenableFuture<Void> futures =
// check TEP is added into TZ that is already created.
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(),
dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get());
// remove Transport Zone
txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.delete(LogicalDatastoreType.CONFIGURATION,
// for TEP movement through transaction
coordinatorEventsWaiter.awaitEventsConsumption();
//verify delete
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet());
+
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get());
//check deleted tz moved to notHosted
InstanceIdentifier<TepsInNotHostedTransportZone> notHostedPath =
Assert.assertNotNull(notHostedPath);
Assert.assertEquals(ItmTestConstants.TZ_NAME, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get().getZoneName());
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get().getZoneName());
//create vtepList form unknownVtepList
List<Vteps> vtepsList = new ArrayList<>();
List<UnknownVteps> unknownVtepsList = dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get().getUnknownVteps();
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get().get().getUnknownVteps();
//modifing the dpnid and keeping the ip same.
for (UnknownVteps unknownVtep:unknownVtepsList) {
Vteps vteps = new VtepsBuilder().setDpnId(Uint64.valueOf(10))
coordinatorEventsWaiter.awaitEventsConsumption();
// verify TZ is moved from notHosted to transport zone and their should be only one vtep in it.
- Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet());
+
+ Assert.assertEquals(Optional.empty(), dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get());
+
assertEqualBeans(1, dataBroker.newReadOnlyTransaction()
- .read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get()
+ .read(LogicalDatastoreType.CONFIGURATION, tzonePath).get().get()
.getVteps().size());
}
}