package org.opendaylight.genius.mdsalutil.instructions;
import java.util.List;
-import org.opendaylight.genius.mdsalutil.ActionInfoList;
import org.opendaylight.genius.mdsalutil.ActionInfo;
+import org.opendaylight.genius.mdsalutil.ActionInfoList;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
}
@Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
- InstructionGotoTable that = (InstructionGotoTable) o;
+ InstructionGotoTable that = (InstructionGotoTable) other;
return tableId == that.tableId;
}
@Override
public int hashCode() {
- return (int) tableId;
+ return tableId;
}
}
}
@Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
- InstructionWriteMetadata that = (InstructionWriteMetadata) o;
+ InstructionWriteMetadata that = (InstructionWriteMetadata) other;
- if (metadata != null ? !metadata.equals(that.metadata) : that.metadata != null) return false;
+ if (metadata != null ? !metadata.equals(that.metadata) : that.metadata != null) {
+ return false;
+ }
return mask != null ? mask.equals(that.mask) : that.mask == null;
}
void installFlow(FlowEntity flowEntity);
+ CheckedFuture<Void,TransactionCommitFailedException> installFlow(BigInteger dpId, Flow flowEntity);
+
+ CheckedFuture<Void,TransactionCommitFailedException> installFlow(BigInteger dpId, FlowEntity flowEntity);
+
/**
* Add a Flow to batched transaction.
* This is used to batch multiple ConfigDS changes in a single transaction.
*/
void addFlowToTx(FlowEntity flowEntity, WriteTransaction tx);
- CheckedFuture<Void,TransactionCommitFailedException> installFlow(BigInteger dpId, Flow flowEntity);
-
/**
* Add a Flow to batched transaction
* This is used to batch multiple ConfigDS changes in a single transaction and programming on specific DPN.
*/
void addFlowToTx(BigInteger dpId, Flow flow, WriteTransaction tx);
+ void removeFlow(FlowEntity flowEntity);
+
CheckedFuture<Void,TransactionCommitFailedException> removeFlow(BigInteger dpId, Flow flowEntity);
CheckedFuture<Void,TransactionCommitFailedException> removeFlow(BigInteger dpId, FlowEntity flowEntity);
*/
void removeFlowToTx(BigInteger dpId, Flow flow, WriteTransaction tx);
- CheckedFuture<Void,TransactionCommitFailedException> installFlow(BigInteger dpId, FlowEntity flowEntity);
-
- void removeFlow(FlowEntity flowEntity);
-
/**
* Remove a Flow using batched transaction.
* This is used to batch multiple ConfigDS changes in a single transaction
/**
* API to remove the Group on Data Plane Node synchronously. It internally waits for
* Group Change Notification to confirm group delete request is being sent.
- *
- * @param groupEntity
*/
void syncRemoveGroup(GroupEntity groupEntity);
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public interface ActionableResource {
+
short CREATE = 1;
short UPDATE = 2;
short DELETE = 3;
InstanceIdentifier getInstanceIdentifier();
+
void setInstanceIdentifier(InstanceIdentifier identifier);
+
Object getInstance();
+
void setInstance(Object instance);
+
Object getOldInstance();
+
void setOldInstance(Object oldInstance);
+
short getAction();
+
void setAction(short action);
+
String getKey();
+
void setKey(String key);
}
public class DefaultBatchHandler implements ResourceHandler {
- private DataBroker dataBroker;
- private Integer batchSize;
- private Integer batchInterval;
- private LogicalDatastoreType datastoreType;
-
- public DefaultBatchHandler(DataBroker dataBroker,LogicalDatastoreType dataStoreType,Integer batchSize,Integer batchInterval) {
+ private final DataBroker dataBroker;
+ private final Integer batchSize;
+ private final Integer batchInterval;
+ private final LogicalDatastoreType datastoreType;
+ public DefaultBatchHandler(DataBroker dataBroker, LogicalDatastoreType dataStoreType, Integer batchSize,
+ Integer batchInterval) {
this.dataBroker = dataBroker;
this.batchSize = batchSize;
this.batchInterval = batchInterval;
this.datastoreType = dataStoreType;
-
}
- public void update(WriteTransaction tx, LogicalDatastoreType datastoreType,
- final InstanceIdentifier identifier, final Object original, final Object update, List<SubTransaction> transactionObjects) {
- if ((update != null) && !(update instanceof DataObject)) {
+
+ @Override
+ public void update(WriteTransaction tx, LogicalDatastoreType datastoreType, final InstanceIdentifier identifier,
+ final Object original, final Object update, List<SubTransaction> transactionObjects) {
+ if (update != null && !(update instanceof DataObject)) {
return;
}
if (datastoreType != getDatastoreType()) {
tx.merge(datastoreType, identifier, (DataObject) update, true);
}
+ @Override
public void create(WriteTransaction tx, final LogicalDatastoreType datastoreType,
- final InstanceIdentifier identifier, final Object data, List<SubTransaction> transactionObjects) {
- if ((data != null) && !(data instanceof DataObject)) {
+ final InstanceIdentifier identifier, final Object data, List<SubTransaction> transactionObjects) {
+ if (data != null && !(data instanceof DataObject)) {
return;
}
if (datastoreType != getDatastoreType()) {
tx.put(datastoreType, identifier, (DataObject) data, true);
}
+ @Override
public void delete(WriteTransaction tx, final LogicalDatastoreType datastoreType,
- final InstanceIdentifier identifier, final Object data, List<SubTransaction> transactionObjects) {
- if ((data != null) && !(data instanceof DataObject)) {
+ final InstanceIdentifier identifier, final Object data, List<SubTransaction> transactionObjects) {
+ if (data != null && !(data instanceof DataObject)) {
return;
}
if (datastoreType != getDatastoreType()) {
tx.delete(datastoreType, identifier);
}
+ @Override
public DataBroker getResourceBroker() {
return dataBroker;
}
+ @Override
public int getBatchSize() {
return batchSize;
}
+ @Override
public int getBatchInterval() {
return batchInterval;
}
+ @Override
public LogicalDatastoreType getDatastoreType() {
return datastoreType;
}
throw new RuntimeException("Resource type already registered");
}
resourceHandlerMapper.put(resourceType, new ImmutablePair<>(resQueue, resHandler));
- ScheduledThreadPoolExecutor resDelegatorService = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1);
+ ScheduledThreadPoolExecutor resDelegatorService = (ScheduledThreadPoolExecutor)
+ Executors.newScheduledThreadPool(1);
resourceBatchingThreadMapper.put(resourceType, resDelegatorService);
LOG.info("Registered resourceType {} with batchSize {} and batchInterval {}", resourceType,
resHandler.getBatchSize(), resHandler.getBatchInterval());
this.actResourceList = actResourceList;
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
public void process() {
InstanceIdentifier<T> identifier;
Object instance;
WriteTransaction writeTransaction = broker.newWriteOnlyTransaction();
switch (object.getAction()) {
case SubTransaction.CREATE :
- writeTransaction.put(dsType, object.getInstanceIdentifier(), (DataObject)object.getInstance(), true);
+ writeTransaction.put(dsType, object.getInstanceIdentifier(),
+ (DataObject) object.getInstance(), true);
break;
case SubTransaction.DELETE :
writeTransaction.delete(dsType, object.getInstanceIdentifier());
break;
case SubTransaction.UPDATE :
- writeTransaction.merge(dsType, object.getInstanceIdentifier(), (DataObject)object.getInstance(), true);
+ writeTransaction.merge(dsType, object.getInstanceIdentifier(),
+ (DataObject) object.getInstance(), true);
break;
default:
- LOG.error("Unable to determine Action for transaction object with id {}", object.getInstanceIdentifier());
+ LOG.error("Unable to determine Action for transaction object with id {}",
+ object.getInstanceIdentifier());
}
- CheckedFuture<Void, TransactionCommitFailedException> futureOperation = writeTransaction.submit();
try {
- futureOperation.get();
+ writeTransaction.submit().get();
} catch (InterruptedException | ExecutionException exception) {
LOG.error("Error {} to datastore (path, data) : ({}, {})", object.getAction(),
object.getInstanceIdentifier(), object.getInstance(), exception);
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public interface ResourceHandler {
- void create(WriteTransaction tx, LogicalDatastoreType datastoreType, InstanceIdentifier identifer, Object vrfEntry,List<SubTransaction> transactionObjects);
- void delete(WriteTransaction tx, LogicalDatastoreType datastoreType, InstanceIdentifier identifer, Object vrfEntry,List<SubTransaction> transactionObjects);
+
+ void create(WriteTransaction tx, LogicalDatastoreType datastoreType, InstanceIdentifier identifer, Object vrfEntry,
+ List<SubTransaction> transactionObjects);
+
+ void delete(WriteTransaction tx, LogicalDatastoreType datastoreType, InstanceIdentifier identifer, Object vrfEntry,
+ List<SubTransaction> transactionObjects);
+
void update(WriteTransaction tx, LogicalDatastoreType datastoreType, InstanceIdentifier identifier, Object original,
- Object update,List<SubTransaction> transactionObjects);
+ Object update, List<SubTransaction> transactionObjects);
+
LogicalDatastoreType getDatastoreType();
+
int getBatchSize();
+
int getBatchInterval();
+
DataBroker getResourceBroker();
}
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public interface SubTransaction {
+
short CREATE = 1;
short UPDATE = 2;
short DELETE = 3;
InstanceIdentifier getInstanceIdentifier();
+
void setInstanceIdentifier(InstanceIdentifier identifier);
+
Object getInstance();
+
void setInstance(Object instance);
+
short getAction();
+
void setAction(short action);
}
import org.slf4j.LoggerFactory;
public class EntityOwnerUtils {
- public static final String ENTITY_OWNER_CACHE = "entity.owner.cache";
+
private static final Logger LOG = LoggerFactory.getLogger(EntityOwnerUtils.class);
- static final ArrayList<EntityEvent> eventsHistory = new ArrayList<>();
+
+ public static final String ENTITY_OWNER_CACHE = "entity.owner.cache";
+ private static final ArrayList<EntityEvent> EVENTS_HISTORY = new ArrayList<>();
+
public static class EntityEvent {
- long time;
- String entityName;
- boolean isOwner;
- boolean hasOwner;
+ private final long time;
+ private final String entityName;
+ private final boolean isOwner;
+ private final boolean hasOwner;
+
public EntityEvent(long time, String entityName, boolean hasOwner, boolean isOwner) {
this.time = time;
this.entityName = entityName;
this.hasOwner = hasOwner;
this.isOwner = isOwner;
}
+
public long getTime() {
return time;
}
+
public String getEntityName() {
return entityName;
}
+
public boolean isOwner() {
return isOwner;
}
+
public boolean hasOwner() {
return hasOwner;
}
}
+
public static ArrayList<EntityEvent> getEventsHistory() {
- return eventsHistory;
+ return EVENTS_HISTORY;
}
static {
createEntityOwnerCache();
}
+
private static void createEntityOwnerCache() {
if (CacheUtil.getCache(ENTITY_OWNER_CACHE) == null) {
CacheUtil.createCache(ENTITY_OWNER_CACHE);
(ConcurrentMap<String, Boolean>) CacheUtil.getCache(ENTITY_OWNER_CACHE);
String entity = getEntity(entityType, entityName);
if (entityOwnerCache != null) {
- LOG.trace("updating entity owner "+isOwner+ " "+entity );
+ LOG.trace("updating entity owner " + isOwner + " " + entity);
entityOwnerCache.put(entity, isOwner);
}
}
/**
* Registers the entityName for ownership for given entityType
- * adds a local listener which takes care of updating the cached entity status
- * @param entityOwnershipService
- * @param entityType
- * @param entityName
+ * adds a local listener which takes care of updating the cached entity status.
+ *
* @param listener also adds this listener for ownership events if provided
- * @throws CandidateAlreadyRegisteredException
*/
- public static void registerEntityCandidateForOwnerShip (
+ public static void registerEntityCandidateForOwnerShip(
EntityOwnershipService entityOwnershipService,
String entityType, String entityName, EntityOwnershipListener listener)
throws CandidateAlreadyRegisteredException {
- LOG.info("registering for entity ownership for type "+entityType);
+ LOG.info("registering for entity ownership for type {}", entityType);
Entity candidateEntity = new Entity(entityType, entityName);
entityOwnershipService.registerCandidate(
candidateEntity);
if (listener != null) {
entityOwnershipService.registerListener(entityType, listener);
}
- LOG.info("registered for entity ownership for type "+entityType);
+ LOG.info("registered for entity ownership for type {}", entityType);
//TODO track registrations for closing
}
private static Listener entityOwnershipListener = new Listener();
+
static class Listener implements EntityOwnershipListener {
@Override
public void ownershipChanged(EntityOwnershipChange ownershipChange) {
String entityType = ownershipChange.getEntity().getType();
String entityName = ownershipChange.getEntity().getId().toString();
- LOG.info("entity ownership changed for "+entityType);
- eventsHistory.add(new EntityEvent(System.currentTimeMillis(), entityName, ownershipChange.hasOwner() ,
+ LOG.info("entity ownership changed for {}", entityType);
+ EVENTS_HISTORY.add(new EntityEvent(System.currentTimeMillis(), entityName, ownershipChange.hasOwner() ,
ownershipChange.isOwner()));
if (ownershipChange.hasOwner() && ownershipChange.isOwner()) {
- LOG.info("entity ownership change became owner for type "+entityType);
+ LOG.info("entity ownership change became owner for type {}", entityType);
updateEntityOwner(entityType, entityName, Boolean.TRUE);
} else {
- LOG.info("entity ownership lost ownership for type "+entityType);
+ LOG.info("entity ownership lost ownership for type {} ", entityType);
updateEntityOwner(entityType, entityName, Boolean.FALSE);
}
}
private static HwvtepHACache instance = new HwvtepHACache();
- private ConcurrentHashMap<InstanceIdentifier<Node>, Set<InstanceIdentifier<Node>>> parentToChildMap = new ConcurrentHashMap<>();
- private ConcurrentHashMap<InstanceIdentifier<Node>, InstanceIdentifier<Node>> childToParentMap = new ConcurrentHashMap<>();
- private ConcurrentHashMap<String, Boolean> childNodeIds = new ConcurrentHashMap<>();
- private ConcurrentHashMap<String, Boolean> connectedNodes = new ConcurrentHashMap<>();
- private LinkedBlockingQueue<DebugEvent> debugEvents = new LinkedBlockingQueue<>(MAX_EVENT_BUFFER_SIZE);
+ private final ConcurrentHashMap<InstanceIdentifier<Node>, Set<InstanceIdentifier<Node>>>
+ parentToChildMap = new ConcurrentHashMap<>();
+
+ private final ConcurrentHashMap<InstanceIdentifier<Node>, InstanceIdentifier<Node>>
+ childToParentMap = new ConcurrentHashMap<>();
+
+ private final ConcurrentHashMap<String, Boolean> childNodeIds = new ConcurrentHashMap<>();
+
+ private final ConcurrentHashMap<String, Boolean> connectedNodes = new ConcurrentHashMap<>();
+
+ private final LinkedBlockingQueue<DebugEvent> debugEvents = new LinkedBlockingQueue<>(MAX_EVENT_BUFFER_SIZE);
public static HwvtepHACache getInstance() {
return instance;
public class HwvtepSouthboundConstants {
public static final String HWVTEP_ENTITY_TYPE = "hwvtep";
- public static final ImmutableBiMap<Class<? extends EncapsulationTypeBase>, String> ENCAPS_TYPE_MAP = new ImmutableBiMap.Builder<Class<? extends EncapsulationTypeBase>, String>()
+
+ public static final ImmutableBiMap<Class<? extends EncapsulationTypeBase>, String> ENCAPS_TYPE_MAP
+ = new ImmutableBiMap.Builder<Class<? extends EncapsulationTypeBase>, String>()
.put(EncapsulationTypeVxlanOverIpv4.class, "vxlan_over_ipv4").build();
+
public static final String ELAN_ENTITY_TYPE = "elan";
public static final String ELAN_ENTITY_NAME = "elan";
public static final String TEP_PREFIX = "vxlan_over_ipv4:";
* @return the instance identifier
*/
public static InstanceIdentifier<LogicalSwitches> createLogicalSwitchesInstanceIdentifier(NodeId nodeId,
- HwvtepNodeName hwvtepNodeName) {
+ HwvtepNodeName hwvtepNodeName) {
return createInstanceIdentifier(nodeId).augmentation(HwvtepGlobalAugmentation.class)
.child(LogicalSwitches.class, new LogicalSwitchesKey(hwvtepNodeName));
}
* @return the instance identifier
*/
public static InstanceIdentifier<RemoteMcastMacs> createRemoteMcastMacsInstanceIdentifier(NodeId nodeId,
- String logicalSwitchName, MacAddress mac) {
+ String logicalSwitchName, MacAddress mac) {
InstanceIdentifier<LogicalSwitches> logicalSwitch = createLogicalSwitchesInstanceIdentifier(nodeId,
new HwvtepNodeName(logicalSwitchName));
return createInstanceIdentifier(nodeId).augmentation(HwvtepGlobalAugmentation.class)
* @return the instance identifier
*/
public static InstanceIdentifier<RemoteMcastMacs> createRemoteMcastMacsInstanceIdentifier(NodeId nodeId,
- RemoteMcastMacsKey remoteMcastMacsKey) {
+ RemoteMcastMacsKey remoteMcastMacsKey) {
return createInstanceIdentifier(nodeId).augmentation(HwvtepGlobalAugmentation.class)
.child(RemoteMcastMacs.class, remoteMcastMacsKey);
}
* @return the instance identifier
*/
public static InstanceIdentifier<TerminationPoint> createPhysicalLocatorInstanceIdentifier(NodeId nodeId,
- HwvtepPhysicalLocatorAugmentation physicalLocatorAug) {
+ HwvtepPhysicalLocatorAugmentation physicalLocatorAug) {
return createInstanceIdentifier(nodeId).child(TerminationPoint.class,
getTerminationPointKey(physicalLocatorAug));
}
return tpKey;
}
+ public static TerminationPointKey getTerminationPointKey(String ipAddress) {
+ TerminationPointKey tpKey = null;
+ String tpKeyStr = getTerminationPointKeyString(ipAddress);
+ if (tpKeyStr != null) {
+ tpKey = new TerminationPointKey(new TpId(tpKeyStr));
+ }
+ return tpKey;
+ }
+
/**
* Creates the managed node id.
*
if (type.isEmpty()) {
return EncapsulationTypeVxlanOverIpv4.class;
} else {
- ImmutableBiMap<String, Class<? extends EncapsulationTypeBase>> mapper = HwvtepSouthboundConstants.ENCAPS_TYPE_MAP
- .inverse();
+ ImmutableBiMap<String, Class<? extends EncapsulationTypeBase>> mapper
+ = HwvtepSouthboundConstants.ENCAPS_TYPE_MAP.inverse();
return mapper.get(type);
}
}
* @return the remote ucast macs
*/
public static RemoteUcastMacs createRemoteUcastMac(NodeId nodeId, String mac, IpAddress ipAddress,
- String logicalSwitchName, HwvtepPhysicalLocatorAugmentation physicalLocatorAug) {
+ String logicalSwitchName, HwvtepPhysicalLocatorAugmentation physicalLocatorAug) {
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(
createLogicalSwitchesInstanceIdentifier(nodeId, new HwvtepNodeName(logicalSwitchName)));
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(
* @return the remote mcast macs
*/
public static RemoteMcastMacs createRemoteMcastMac(NodeId nodeId, String mac, IpAddress ipAddress,
- String logicalSwitchName, List<HwvtepPhysicalLocatorAugmentation> lstPhysicalLocatorAug) {
+ String logicalSwitchName, List<HwvtepPhysicalLocatorAugmentation> lstPhysicalLocatorAug) {
HwvtepLogicalSwitchRef lsRef = new HwvtepLogicalSwitchRef(
createLogicalSwitchesInstanceIdentifier(nodeId, new HwvtepNodeName(logicalSwitchName)));
return vbBuilder.build();
}
- public static TerminationPointKey getTerminationPointKey(String ipAddress) {
- TerminationPointKey tpKey = null;
- String tpKeyStr = getTerminationPointKeyString(ipAddress);
- if (tpKeyStr != null) {
- tpKey = new TerminationPointKey(new TpId(tpKeyStr));
- }
- return tpKey;
- }
-
public static String getTerminationPointKeyString(String ipAddress) {
String tpKeyStr = null;
if (ipAddress != null) {
putLogicalSwitch(transaction,logicalDatastoreType, nodeId, logicalSwitch);
return transaction.submit();
}
+
/**
* Put the logical switches in the transaction.
*
}
/**
- * Gets physical port termination point
+ * Gets physical port termination point.
*
* @param broker
* the broker
* @return the physical locator
*/
public static HwvtepPhysicalLocatorAugmentation getPhysicalLocator(DataBroker broker,
- LogicalDatastoreType datastoreType, NodeId nodeId, final IpAddress phyLocatorIp) {
+ LogicalDatastoreType datastoreType, NodeId nodeId, final IpAddress phyLocatorIp) {
HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils
.createHwvtepPhysicalLocatorAugmentation(String.valueOf(phyLocatorIp.getValue()));
InstanceIdentifier<HwvtepPhysicalLocatorAugmentation> iid = HwvtepSouthboundUtils
return transaction.submit();
}
+ /**
+ * Delete remote ucast mac from the transaction.
+ *
+ * @param transaction
+ * the transaction
+ * @param nodeId
+ * the node id
+ * @param mac
+ * the mac
+ */
+ public static void deleteRemoteUcastMac(final WriteTransaction transaction, final NodeId nodeId,
+ String logialSwitchName, final MacAddress mac) {
+ transaction.delete(LogicalDatastoreType.CONFIGURATION,
+ HwvtepSouthboundUtils.createRemoteUcastMacsInstanceIdentifier(nodeId, logialSwitchName, mac));
+ }
+
/**
* Delete remote ucast macs from the config DS.
*
}
}
- /**
- * Delete remote ucast mac from the transaction.
- *
- * @param transaction
- * the transaction
- * @param nodeId
- * the node id
- * @param mac
- * the mac
- */
- public static void deleteRemoteUcastMac(final WriteTransaction transaction, final NodeId nodeId,
- String logialSwitchName, final MacAddress mac) {
- transaction.delete(LogicalDatastoreType.CONFIGURATION,
- HwvtepSouthboundUtils.createRemoteUcastMacsInstanceIdentifier(nodeId, logialSwitchName, mac));
- }
-
/**
* Adds the remote mcast macs into config DS.
*
remoteMcastMac.getKey());
transaction.put(logicalDatastoreType, iid, remoteMcastMac, true);
}
+
/**
* Gets the remote mcast mac.
*
return transaction.submit();
}
+ /**
+ * Delete remote mcast mac from the transaction.
+ *
+ * @param transaction
+ * the transaction
+ * @param nodeId
+ * the node id
+ * @param remoteMcastMacsKey
+ * the remote mcast macs key
+ */
+ public static void deleteRemoteMcastMac(final WriteTransaction transaction, final NodeId nodeId,
+ final RemoteMcastMacsKey remoteMcastMacsKey) {
+ transaction.delete(LogicalDatastoreType.CONFIGURATION,
+ HwvtepSouthboundUtils.createRemoteMcastMacsInstanceIdentifier(nodeId, remoteMcastMacsKey));
+ }
+
/**
* Delete remote mcast macs from config DS.
*
}
}
- /**
- * Delete remote mcast mac from the transaction.
- *
- * @param transaction
- * the transaction
- * @param nodeId
- * the node id
- * @param remoteMcastMacsKey
- * the remote mcast macs key
- */
- public static void deleteRemoteMcastMac(final WriteTransaction transaction, final NodeId nodeId,
- final RemoteMcastMacsKey remoteMcastMacsKey) {
- transaction.delete(LogicalDatastoreType.CONFIGURATION,
- HwvtepSouthboundUtils.createRemoteMcastMacsInstanceIdentifier(nodeId, remoteMcastMacsKey));
- }
-
/**
* Merge vlan bindings in the transaction.
*
* the vlan bindings
*/
public static void mergeVlanBindings(final WriteTransaction transaction, final NodeId nodeId,
- final String phySwitchName, final String phyPortName, final List<VlanBindings> vlanBindings) {
+ final String phySwitchName, final String phyPortName, final List<VlanBindings> vlanBindings) {
NodeId physicalSwitchNodeId = HwvtepSouthboundUtils.createManagedNodeId(nodeId, phySwitchName);
mergeVlanBindings(transaction, physicalSwitchNodeId, phyPortName, vlanBindings);
}
@Test
public void testAddHAChild() {
-
InstanceIdentifier<Node> parent = newNodeInstanceIdentifier("ha");
InstanceIdentifier<Node> child1 = newNodeInstanceIdentifier("d1");
- InstanceIdentifier<Node> child2 = newNodeInstanceIdentifier("d1");
- String child1NodeId = child1.firstKeyOf(Node.class).getNodeId().getValue();
- String child2NodeId = child2.firstKeyOf(Node.class).getNodeId().getValue();
hwvtepHACache.addChild(parent, child1);
assertTrue(hwvtepHACache.isHAEnabledDevice(child1));
assertTrue(hwvtepHACache.isHAParentNode(parent));
+ InstanceIdentifier<Node> child2 = newNodeInstanceIdentifier("d1");
hwvtepHACache.addChild(parent, child2);
assertTrue(hwvtepHACache.isHAEnabledDevice(child1));
assertTrue(hwvtepHACache.isHAEnabledDevice(child2));
assertTrue(hwvtepHACache.getChildrenForHANode(parent).contains(child1));
assertTrue(hwvtepHACache.getChildrenForHANode(parent).contains(child2));
+ String child1NodeId = child1.firstKeyOf(Node.class).getNodeId().getValue();
+ String child2NodeId = child2.firstKeyOf(Node.class).getNodeId().getValue();
+
List<DebugEvent> events = hwvtepHACache.getNodeEvents();
assertTrue(events.contains(new NodeEvent.ChildAddedEvent(child1NodeId)));
assertTrue(events.contains(new NodeEvent.ChildAddedEvent(child2NodeId)));