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());
}
Aggregations