Search in sources :

Example 6 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 testAddDeleteTepForDefTz.

@Test
public void testAddDeleteTepForDefTz() throws Exception {
    // create default-TZ first by setting def-tz-enabled flag to true
    ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).setDefTzTunnelType(ITMConstants.TUNNEL_TYPE_VXLAN).build();
    TepCommandHelper tepCmdHelper = new TepCommandHelper(dataBroker, itmConfigObj);
    tepCmdHelper.start();
    InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(ITMConstants.DEFAULT_TRANSPORT_ZONE);
    Assert.assertNotNull(tzonePath);
    IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
    // add TEP into default-TZ
    CheckedFuture<Void, TransactionCommitFailedException> futures = ItmTepAutoConfigTestUtil.addTep(ItmTestConstants.DEF_TZ_TEP_IP, ItmTestConstants.DEF_BR_DPID, ITMConstants.DEFAULT_TRANSPORT_ZONE, false, dataBroker);
    futures.get();
    InstanceIdentifier<Vteps> vtepPath = ItmTepAutoConfigTestUtil.getTepIid(subnetMaskObj, ITMConstants.DEFAULT_TRANSPORT_ZONE, ItmTestConstants.INT_DEF_BR_DPID, ITMConstants.DUMMY_PORT);
    Assert.assertNotNull(vtepPath);
    // check TEP is added into default-TZ
    assertEqualBeans(ExpectedDefTransportZoneObjects.newDefTzWithTep(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
    // remove tep from default-TZ
    futures = ItmTepAutoConfigTestUtil.deleteTep(ItmTestConstants.DEF_TZ_TEP_IP, ItmTestConstants.DEF_BR_DPID, ITMConstants.DEFAULT_TRANSPORT_ZONE, dataBroker);
    futures.get();
    // check TEP is deleted from default-TZ
    Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
}
Also used : TepCommandHelper(org.opendaylight.genius.itm.cli.TepCommandHelper) IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) 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) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) 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