use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder in project genius by opendaylight.
the class ItmTepAutoConfigTest method defTzEnabledTrueConfigTest.
@Test
public void defTzEnabledTrueConfigTest() throws Exception {
InstanceIdentifier<ItmConfig> iid = InstanceIdentifier.create(ItmConfig.class);
// set def-tz-enabled flag to true
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).build();
// write into config DS
CheckedFuture<Void, TransactionCommitFailedException> futures = ItmTepAutoConfigTestUtil.writeItmConfig(iid, itmConfigObj, dataBroker);
futures.get();
// read from config DS
boolean defTzEnabled = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, iid).get().isDefTzEnabled();
Assert.assertEquals(defTzEnabled, true);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder in project genius by opendaylight.
the class ItmTestModule method configureBindings.
@Override
protected void configureBindings() {
// Bindings for services from this project
bind(ItmRpcService.class).to(ItmManagerRpcService.class);
bind(ItmProvider.class);
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).setDefTzTunnelType(ITMConstants.TUNNEL_TYPE_VXLAN).setGpeExtensionEnabled(false).build();
bind(ItmConfig.class).toInstance(itmConfigObj);
IfmConfig interfaceConfig = new IfmConfigBuilder().setItmDirectTunnels(false).build();
bind(IfmConfig.class).toInstance(interfaceConfig);
bind(TunnelMonitorIntervalListener.class);
bind(TransportZoneListener.class);
bind(OvsdbNodeListener.class);
bind(InterfaceStateListener.class);
bind(VtepConfigSchemaListener.class);
bind(TunnelMonitorChangeListener.class);
bind(ItmTunnelEventListener.class);
// Bindings for external services to "real" implementations
bind(EntityOwnershipService.class).toInstance(mock(EntityOwnershipService.class));
bind(IdManagerService.class).to(IdManager.class);
bind(LockManagerService.class).to(LockManagerServiceImpl.class);
DataBroker dataBroker = DataBrokerTestModule.dataBroker();
bind(DataBroker.class).toInstance(dataBroker);
bind(DataBroker.class).annotatedWith(OsgiService.class).toInstance(dataBroker);
bind(InterfaceManagerService.class).to(InterfaceManagerServiceImpl.class);
bind(IInterfaceManager.class).to(InterfacemgrProvider.class);
bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
// Bindings to test infra (fakes & mocks)
TestIMdsalApiManager mdsalManager = TestIMdsalApiManager.newInstance();
bind(IMdsalApiManager.class).toInstance(mdsalManager);
bind(TestIMdsalApiManager.class).toInstance(mdsalManager);
bind(DataImportBootReady.class).annotatedWith(OsgiService.class).toInstance(new DataImportBootReady() {
});
bind(DiagStatusService.class).toInstance(mock(DiagStatusService.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder in project genius by opendaylight.
the class ItmTepAutoConfigTest method defTzEnabledFalseConfigTest.
@Test
public void defTzEnabledFalseConfigTest() throws Exception {
InstanceIdentifier<ItmConfig> iid = InstanceIdentifier.create(ItmConfig.class);
// set def-tz-enabled flag to false
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(false).build();
// write into config DS
CheckedFuture<Void, TransactionCommitFailedException> futures = ItmTepAutoConfigTestUtil.writeItmConfig(iid, itmConfigObj, dataBroker);
futures.get();
// read from config DS
boolean defTzEnabled = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, iid).get().isDefTzEnabled();
Assert.assertEquals(defTzEnabled, false);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder in project genius by opendaylight.
the class ItmTepAutoConfigTest method processDefTzOnItmConfig.
// Common method created for code-reuse
private InstanceIdentifier<TransportZone> processDefTzOnItmConfig(boolean defTzEnabledFlag, String defTzTunnelType) throws Exception {
ItmConfig itmConfigObj = null;
if (defTzTunnelType != null) {
// set def-tz-enabled flag and def-tz-tunnel-type
itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(defTzEnabledFlag).setDefTzTunnelType(defTzTunnelType).build();
} else {
// set def-tz-enabled flag only
itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(defTzEnabledFlag).build();
}
// Create TepCommandHelper object which creates/deletes default-TZ based
// on def-tz-enabled flag
TepCommandHelper tepCmdHelper = new TepCommandHelper(dataBroker, itmConfigObj);
tepCmdHelper.start();
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(ITMConstants.DEFAULT_TRANSPORT_ZONE);
return tzonePath;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder in project genius by opendaylight.
the class ItmTepAutoConfigTest method defTzDeletionTest.
@Test
public void defTzDeletionTest() throws Exception {
// create default-TZ first by setting def-tz-enabled flag to true
ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).setDefTzTunnelType(ITMConstants.TUNNEL_TYPE_GRE).build();
TepCommandHelper tepCmdHelper = new TepCommandHelper(dataBroker, itmConfigObj);
tepCmdHelper.start();
// Create TepCommandHelper object which creates/deletes default-TZ based on def-tz-enabled flag
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(ITMConstants.DEFAULT_TRANSPORT_ZONE);
Assert.assertNotNull(tzonePath);
assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithGreTunnelType(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
// now delete default-TZ first by setting def-tz-enabled flag to false
itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(false).build();
// Create TepCommandHelper object which creates/deletes default-TZ based on def-tz-enabled flag
tepCmdHelper = new TepCommandHelper(dataBroker, itmConfigObj);
tepCmdHelper.start();
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath).get());
}
Aggregations