use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config 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.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class ItmTepAutoConfigTest method tepAddDeleteFromNbTzViaSouthboundTest.
@Test
public void tepAddDeleteFromNbTzViaSouthboundTest() throws Exception {
// create Transport-zone in advance
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, tzonesPath, transportZones, dataBroker);
String tepIp = ItmTestConstants.NB_TZ_TEP_IP;
// create Network topology node with tep-ip set into ExternalIds list
// 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(connInfo, tepIp, ItmTestConstants.TZ_NAME, dataBroker);
future.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
Thread.sleep(1000);
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(ItmTestConstants.TZ_NAME);
Assert.assertNotNull(tzonePath);
// check TEP is added into NB configured TZ
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
InstanceIdentifier<Vteps> vtepPath = ItmTepAutoConfigTestUtil.getTepIid(subnetMaskObj, ItmTestConstants.TZ_NAME, ItmTestConstants.INT_DEF_BR_DPID, ITMConstants.DUMMY_PORT);
Assert.assertNotNull(vtepPath);
// test TEP delete now,
// pass tep-ip with NULL value, tep-ip paramtere in external_ids will not be set.
tepIp = null;
future = OvsdbTestUtil.updateNode(connInfo, tepIp, ItmTestConstants.TZ_NAME, null, dataBroker);
future.get();
// wait for OvsdbNodeListener to perform config DS update through transaction
Thread.sleep(1000);
// check TEP is deleted from default-TZ when TEP-Ip is removed from southbound
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class ItmTepAutoConfigTest method tepMoveFromTepsNotHostedListToTzTest.
@Test
public void tepMoveFromTepsNotHostedListToTzTest() throws Exception {
// add into not hosted list
CheckedFuture<Void, TransactionCommitFailedException> future = ItmTepAutoConfigTestUtil.addTep(ItmTestConstants.NOT_HOSTED_TZ_TEP_IP, ItmTestConstants.NOT_HOSTED_TZ_TEPDPN_ID, ItmTestConstants.NOT_HOSTED_TZ_NAME, false, dataBroker);
future.get();
InstanceIdentifier<TepsInNotHostedTransportZone> notHostedPath = ItmTepAutoConfigTestUtil.getTepNotHostedInTZIid(ItmTestConstants.NOT_HOSTED_TZ_NAME);
Assert.assertNotNull(notHostedPath);
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, notHostedPath).checkedGet().get());
// create the same TZ
TransportZone transportZoneNorth = new TransportZoneBuilder().setZoneName(ItmTestConstants.NOT_HOSTED_TZ_NAME).setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setKey(new TransportZoneKey(ItmTestConstants.NOT_HOSTED_TZ_NAME)).build();
Assert.assertNotNull(transportZoneNorth);
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, ItmTepAutoConfigTestUtil.getTzIid(ItmTestConstants.NOT_HOSTED_TZ_NAME), transportZoneNorth, dataBroker);
// wait for TransportZoneListener to perform config DS update
// for TEP movement through transaction
Thread.sleep(1000);
InstanceIdentifier<TransportZone> tzPath = ItmTepAutoConfigTestUtil.getTzIid(ItmTestConstants.NOT_HOSTED_TZ_NAME);
Assert.assertNotNull(tzPath);
// check TZ is Moved
assertEqualBeans(String.valueOf(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone().getUnknownVteps().get(0).getIpAddress().getValue()), String.valueOf(dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzPath).checkedGet().get().getSubnets().get(0).getVteps().get(0).getIpAddress().getValue()));
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone().getUnknownVteps().get(0).getDpnId(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzPath).checkedGet().get().getSubnets().get(0).getVteps().get(0).getDpnId());
assertEqualBeans(ExpectedTepNotHostedTransportZoneObjects.newTepNotHostedTransportZone().getZoneName(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzPath).checkedGet().get().getZoneName());
// check TZ is removed
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, notHostedPath).get());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class ItmTepAutoConfigTest method tepUpdateForBrNameTest.
@Test
public void tepUpdateForBrNameTest() throws Exception {
// create Transport-zone in advance
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, tzonesPath, transportZones, dataBroker);
String tepIp = ItmTestConstants.NB_TZ_TEP_IP;
// prepare OVSDB node with tep-ip set into ExternalIds list
// 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(connInfo, tepIp, ItmTestConstants.TZ_NAME, dataBroker);
future.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
Thread.sleep(1000);
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(ItmTestConstants.TZ_NAME);
Assert.assertNotNull(tzonePath);
// check TEP is added into TZ
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
InstanceIdentifier<Vteps> oldVTepPath = ItmTepAutoConfigTestUtil.getTepIid(subnetMaskObj, ItmTestConstants.TZ_NAME, ItmTestConstants.INT_DEF_BR_DPID, ITMConstants.DUMMY_PORT);
Assert.assertNotNull(oldVTepPath);
// add new bridge br2
future = OvsdbTestUtil.addBridgeIntoNode(connInfo, ItmTestConstants.BR2_NAME, ItmTestConstants.BR2_DPID, dataBroker);
future.get();
// wait for OvsdbNodeListener to perform config DS update through transaction
Thread.sleep(1000);
// update OVSDB node with br-name=br2 in ExternalIds column
String brName = ItmTestConstants.BR2_NAME;
future = OvsdbTestUtil.updateNode(connInfo, ItmTestConstants.NB_TZ_TEP_IP, ItmTestConstants.TZ_NAME, brName, dataBroker);
future.get();
// wait for OvsdbNodeListener to perform config DS update through transaction
Thread.sleep(1000);
InstanceIdentifier<Vteps> newVTepPath = ItmTepAutoConfigTestUtil.getTepIid(subnetMaskObj, ItmTestConstants.TZ_NAME, ItmTestConstants.INT_BR2_DPID, ITMConstants.DUMMY_PORT);
Assert.assertNotNull(newVTepPath);
// check old TEP having default-bridge-DPID is deleted
Assert.assertEquals(Optional.absent(), 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());
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config in project genius by opendaylight.
the class ItmProvider method updateVtepSchema.
@Override
public void updateVtepSchema(String schemaName, List<BigInteger> lstDpnsForAdd, List<BigInteger> lstDpnsForDelete) {
LOG.trace("Updating VTEP schema {} by adding DPN's {} and deleting DPN's {}.", schemaName, lstDpnsForAdd, lstDpnsForDelete);
VtepConfigSchema schema = ItmUtils.validateForUpdateVtepSchema(schemaName, lstDpnsForAdd, lstDpnsForDelete, this);
VtepConfigSchemaBuilder builder = new VtepConfigSchemaBuilder(schema);
/* if (ItmUtils.getDpnIdList(schema.getDpnIds()).isEmpty()) {
builder.setDpnIds(schema.getDpnIds());
} else {*/
if (lstDpnsForAdd != null && !lstDpnsForAdd.isEmpty()) {
List<BigInteger> originalDpnList = ItmUtils.getDpnIdList(schema.getDpnIds());
originalDpnList.addAll(lstDpnsForAdd);
builder.setDpnIds(ItmUtils.getDpnIdsListFromBigInt(originalDpnList));
}
if (lstDpnsForDelete != null && !lstDpnsForDelete.isEmpty()) {
List<BigInteger> originalDpnList = ItmUtils.getDpnIdList(schema.getDpnIds());
originalDpnList.removeAll(lstDpnsForDelete);
builder.setDpnIds(ItmUtils.getDpnIdsListFromBigInt(originalDpnList));
// schema.setDpnIds(ItmUtils.getDpnIdsListFromBigInt(ItmUtils.getDpnIdList(schema.getDpnIds())
// .removeAll(lstDpnsForAdd)));
}
// }
schema = builder.build();
MDSALUtil.syncWrite(this.dataBroker, LogicalDatastoreType.CONFIGURATION, ItmUtils.getVtepConfigSchemaIdentifier(schemaName), schema);
LOG.debug("Vtep config schema {} updated to config DS with DPN's {}", schemaName, ItmUtils.getDpnIdList(schema.getDpnIds()));
}
Aggregations