Search in sources :

Example 1 with ItmConfigBuilder

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);
}
Also used : TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) Test(org.junit.Test)

Example 2 with ItmConfigBuilder

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));
}
Also used : InterfaceManagerService(org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) ItmRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) IfmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig) EntityOwnershipService(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) IfmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfigBuilder) ServiceRecoveryRegistry(org.opendaylight.genius.srm.ServiceRecoveryRegistry) DataImportBootReady(org.opendaylight.daexim.DataImportBootReady) DiagStatusService(org.opendaylight.infrautils.diagstatus.DiagStatusService) OsgiService(org.ops4j.pax.cdi.api.OsgiService)

Example 3 with ItmConfigBuilder

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);
}
Also used : TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) Test(org.junit.Test)

Example 4 with ItmConfigBuilder

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;
}
Also used : TepCommandHelper(org.opendaylight.genius.itm.cli.TepCommandHelper) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TepsInNotHostedTransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone)

Example 5 with ItmConfigBuilder

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());
}
Also used : TepCommandHelper(org.opendaylight.genius.itm.cli.TepCommandHelper) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TepsInNotHostedTransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone) Test(org.junit.Test)

Aggregations

ItmConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig)6 ItmConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder)6 Test (org.junit.Test)4 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)3 TepCommandHelper (org.opendaylight.genius.itm.cli.TepCommandHelper)3 TepsInNotHostedTransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone)3 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)3 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 DataImportBootReady (org.opendaylight.daexim.DataImportBootReady)1 IInterfaceManager (org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager)1 InterfaceManagerService (org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService)1 IMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager)1 TestIMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager)1 ServiceRecoveryRegistry (org.opendaylight.genius.srm.ServiceRecoveryRegistry)1 DiagStatusService (org.opendaylight.infrautils.diagstatus.DiagStatusService)1 EntityOwnershipService (org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService)1 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 IdManagerService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService)1 IfmConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig)1 IfmConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfigBuilder)1