return key;
}
- protected AbstractTransactionCommand() {
- // NO OP
- }
-
public AbstractTransactionCommand(HwvtepConnectionInstance key,TableUpdates updates, DatabaseSchema dbSchema) {
this.updates = updates;
this.dbSchema = dbSchema;
package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
import java.util.Map;
-import java.util.Map.Entry;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
public class GlobalUpdateCommand extends AbstractTransactionCommand {
private static final Logger LOG = LoggerFactory.getLogger(GlobalUpdateCommand.class);
- private Map<UUID, Global> updatedHwvtepRows =
- TyperUtils.extractRowsUpdated(Global.class, getUpdates(),getDbSchema());
- private Map<UUID, Global> oldHwvtepRows =
- TyperUtils.extractRowsUpdated(Global.class, getUpdates(),getDbSchema());
+ private final Map<UUID, Global> updatedHwvtepRows =
+ TyperUtils.extractRowsUpdated(Global.class, getUpdates(), getDbSchema());
- public GlobalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
- super(key, updates, dbSchema);
- }
+ public GlobalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ super(key, updates, dbSchema);
+ }
@Override
public void execute(ReadWriteTransaction transaction) {
- for (Entry<UUID, Global> entry : updatedHwvtepRows.entrySet()) {
- Global hwvtepGlobal = entry.getValue();
- Global oldEntry = oldHwvtepRows.get(entry.getKey());
+ for (Global hwvtepGlobal : updatedHwvtepRows.values()) {
final InstanceIdentifier<Node> nodePath = getInstanceIdentifier(hwvtepGlobal);
LOG.trace("Processing hardware_vtep update for nodePath: {}", nodePath);
private InstanceIdentifier<Node> getInstanceIdentifier(Global hwvtep) {
InstanceIdentifier<Node> iid = getOvsdbConnectionInstance().getInstanceIdentifier();
- if(iid == null) {
+ if (iid == null) {
LOG.warn("InstanceIdentifier was null when it shouldn't be");
/* This can be case for switch initiated connection */
iid = HwvtepSouthboundMapper.getInstanceIdentifier(hwvtep);
}
private NodeId getNodeId(Global hwvtep) {
- NodeKey nodeKey = getInstanceIdentifier(hwvtep).firstKeyOf(Node.class, NodeKey.class);
+ NodeKey nodeKey = getInstanceIdentifier(hwvtep).firstKeyOf(Node.class);
return nodeKey.getNodeId();
}
}
private static final long ONE_CONNECTED_MANAGER = 1;
private static final long ONE_ACTIVE_CONNECTION_IN_PASSIVE_MODE = 1;
- public HwvtepGlobalRemoveCommand(HwvtepConnectionInstance key,TableUpdates updates,DatabaseSchema dbSchema) {
- super(key,updates,dbSchema);
+ public HwvtepGlobalRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ super(key, updates, dbSchema);
}
@Override
public void execute(ReadWriteTransaction transaction) {
CheckedFuture<Optional<Node>, ReadFailedException> hwvtepGlobalFuture = transaction.read(
LogicalDatastoreType.OPERATIONAL, getOvsdbConnectionInstance().getInstanceIdentifier());
- Optional<Node> hwvtepGlobalOptional;
try {
- hwvtepGlobalOptional = hwvtepGlobalFuture.get();
+ Optional<Node> hwvtepGlobalOptional = hwvtepGlobalFuture.get();
if (hwvtepGlobalOptional.isPresent()) {
Node hwvtepNode = hwvtepGlobalOptional.get();
HwvtepGlobalAugmentation hgAugmentation = hwvtepNode.getAugmentation(HwvtepGlobalAugmentation.class);
}
}
} catch (Exception e) {
- LOG.warn("Failure to delete ovsdbNode {}",e);
+ LOG.warn("Failure to delete ovsdbNode {}", e);
}
}
public class HwvtepOperationalCommandAggregator implements TransactionCommand {
-
- private List<TransactionCommand> commands = new ArrayList<TransactionCommand>();
+ private List<TransactionCommand> commands = new ArrayList<>();
public HwvtepOperationalCommandAggregator(HwvtepConnectionInstance key,TableUpdates updates,
DatabaseSchema dbSchema) {
package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
import java.util.Collection;
+
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class LogicalSwitchRemoveCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchRemoveCommand.class);
-
- public LogicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public LogicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
@Override
public void execute(ReadWriteTransaction transaction) {
- Collection<LogicalSwitch> deletedLSRows = TyperUtils.extractRowsRemoved(LogicalSwitch.class, getUpdates(),getDbSchema()).values();
- if(deletedLSRows != null && !deletedLSRows.isEmpty()) {
- for (LogicalSwitch lSwitch : deletedLSRows) {
- InstanceIdentifier<LogicalSwitches> switchIid = getOvsdbConnectionInstance().getInstanceIdentifier()
- .augmentation(HwvtepGlobalAugmentation.class)
- .child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName(lSwitch.getName())));
- // TODO Delete any references
- transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid);
- }
+ Collection<LogicalSwitch> deletedLSRows =
+ TyperUtils.extractRowsRemoved(LogicalSwitch.class, getUpdates(), getDbSchema()).values();
+ for (LogicalSwitch lSwitch : deletedLSRows) {
+ InstanceIdentifier<LogicalSwitches> switchIid = getOvsdbConnectionInstance().getInstanceIdentifier()
+ .augmentation(HwvtepGlobalAugmentation.class)
+ .child(LogicalSwitches.class, new LogicalSwitchesKey(new HwvtepNodeName(lSwitch.getName())));
+ // TODO Delete any references
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid);
}
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
public class LogicalSwitchUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchUpdateCommand.class);
private Map<UUID, LogicalSwitch> updatedLSRows;
- private Map<UUID, LogicalSwitch> oldLSRows;
- public LogicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public LogicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(),getDbSchema());
- oldLSRows = TyperUtils.extractRowsOld(LogicalSwitch.class, getUpdates(),getDbSchema());
+ updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
- if(updatedLSRows != null && !updatedLSRows.isEmpty()) {
- for (Entry<UUID, LogicalSwitch> entry : updatedLSRows.entrySet()) {
- updateLogicalSwitch(transaction, entry.getValue());
- }
+ for (Entry<UUID, LogicalSwitch> entry : updatedLSRows.entrySet()) {
+ updateLogicalSwitch(transaction, entry.getValue());
}
}
if (connection.isPresent()) {
Node connectionNode = buildConnectionNode(lSwitch);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
-// TODO: Delete entries that are no longer needed
+ // TODO: Delete entries that are no longer needed
}
}
HwvtepNodeName hwvtepName = new HwvtepNodeName(lSwitch.getName());
lsBuilder.setHwvtepNodeName(hwvtepName);
lsBuilder.setKey(new LogicalSwitchesKey(hwvtepName));
- if(lSwitch.getTunnelKeyColumn().getData()!=null && !lSwitch.getTunnelKeyColumn().getData().isEmpty()){
+ if (lSwitch.getTunnelKeyColumn().getData() != null && !lSwitch.getTunnelKeyColumn().getData().isEmpty()) {
lsBuilder.setTunnelKey(lSwitch.getTunnelKeyColumn().getData().iterator().next().toString());
}
lSwitches.add(lsBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacsKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class MacEntriesRemoveCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(MacEntriesRemoveCommand.class);
-
- public MacEntriesRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public MacEntriesRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
}
private void removeUcastMacsLocal(ReadWriteTransaction transaction) {
- Collection<UcastMacsLocal> deletedLUMRows = TyperUtils.extractRowsRemoved(UcastMacsLocal.class, getUpdates(),getDbSchema()).values();
- if(deletedLUMRows!=null && !deletedLUMRows.isEmpty()){
- for (UcastMacsLocal lum : deletedLUMRows){
- InstanceIdentifier<LocalUcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
- .augmentation(HwvtepGlobalAugmentation.class)
- .child(LocalUcastMacs.class, new LocalUcastMacsKey(new MacAddress(lum.getMac())));
- transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
- }
- }
+ Collection<UcastMacsLocal> deletedLUMRows =
+ TyperUtils.extractRowsRemoved(UcastMacsLocal.class, getUpdates(), getDbSchema()).values();
+ for (UcastMacsLocal lum : deletedLUMRows) {
+ InstanceIdentifier<LocalUcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
+ .augmentation(HwvtepGlobalAugmentation.class)
+ .child(LocalUcastMacs.class, new LocalUcastMacsKey(new MacAddress(lum.getMac())));
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
+ }
}
private void removeUcastMacsRemote(ReadWriteTransaction transaction) {
- Collection<UcastMacsRemote> deletedUMRRows = TyperUtils.extractRowsRemoved(UcastMacsRemote.class, getUpdates(),getDbSchema()).values();
- if(deletedUMRRows!=null && !deletedUMRRows.isEmpty()){
- for (UcastMacsRemote lum : deletedUMRRows){
- InstanceIdentifier<RemoteUcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
- .augmentation(HwvtepGlobalAugmentation.class)
- .child(RemoteUcastMacs.class, new RemoteUcastMacsKey(new MacAddress(lum.getMac())));
- transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
- }
- }
+ Collection<UcastMacsRemote> deletedUMRRows =
+ TyperUtils.extractRowsRemoved(UcastMacsRemote.class, getUpdates(), getDbSchema()).values();
+ for (UcastMacsRemote lum : deletedUMRRows) {
+ InstanceIdentifier<RemoteUcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
+ .augmentation(HwvtepGlobalAugmentation.class)
+ .child(RemoteUcastMacs.class, new RemoteUcastMacsKey(new MacAddress(lum.getMac())));
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
+ }
}
private void removeMcastMacsLocal(ReadWriteTransaction transaction) {
- Collection<McastMacsLocal> deletedLMMRows = TyperUtils.extractRowsRemoved(McastMacsLocal.class, getUpdates(),getDbSchema()).values();
- if(deletedLMMRows!=null && !deletedLMMRows.isEmpty()){
- for (McastMacsLocal lmm : deletedLMMRows){
+ Collection<McastMacsLocal> deletedLMMRows =
+ TyperUtils.extractRowsRemoved(McastMacsLocal.class, getUpdates(), getDbSchema()).values();
+ for (McastMacsLocal lmm : deletedLMMRows) {
InstanceIdentifier<LocalMcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
- .augmentation(HwvtepGlobalAugmentation.class)
- .child(LocalMcastMacs.class, new LocalMcastMacsKey(new MacAddress(lmm.getMac())));
+ .augmentation(HwvtepGlobalAugmentation.class)
+ .child(LocalMcastMacs.class, new LocalMcastMacsKey(new MacAddress(lmm.getMac())));
transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
- }
}
}
private void removeMcastMacsRemote(ReadWriteTransaction transaction) {
- Collection<McastMacsRemote> deletedMMRRows = TyperUtils.extractRowsRemoved(McastMacsRemote.class, getUpdates(),getDbSchema()).values();
- if(deletedMMRRows!=null && !deletedMMRRows.isEmpty()){
- for (McastMacsRemote lum : deletedMMRRows){
- InstanceIdentifier<RemoteMcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
- .augmentation(HwvtepGlobalAugmentation.class)
- .child(RemoteMcastMacs.class, new RemoteMcastMacsKey(new MacAddress(lum.getMac())));
- transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
- }
- }
+ Collection<McastMacsRemote> deletedMMRRows =
+ TyperUtils.extractRowsRemoved(McastMacsRemote.class, getUpdates(), getDbSchema()).values();
+ for (McastMacsRemote lum : deletedMMRRows) {
+ InstanceIdentifier<RemoteMcastMacs> lumId = getOvsdbConnectionInstance().getInstanceIdentifier()
+ .augmentation(HwvtepGlobalAugmentation.class)
+ .child(RemoteMcastMacs.class, new RemoteMcastMacsKey(new MacAddress(lum.getMac())));
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, lumId);
+ }
}
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class McastMacsLocalUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(McastMacsLocalUpdateCommand.class);
private Map<UUID, McastMacsLocal> updatedMMacsLocalRows;
- private Map<UUID, McastMacsLocal> oldMMacsLocalRows;
private Map<UUID, PhysicalLocatorSet> updatedPLocSetRows;
private Map<UUID, PhysicalLocator> updatedPLocRows;
private Map<UUID, LogicalSwitch> updatedLSRows;
- public McastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public McastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedMMacsLocalRows = TyperUtils.extractRowsUpdated(McastMacsLocal.class, getUpdates(),getDbSchema());
- oldMMacsLocalRows = TyperUtils.extractRowsOld(McastMacsLocal.class, getUpdates(),getDbSchema());
- updatedPLocSetRows = TyperUtils.extractRowsUpdated(PhysicalLocatorSet.class, getUpdates(),getDbSchema());
- updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(),getDbSchema());
- updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(),getDbSchema());
+ updatedMMacsLocalRows = TyperUtils.extractRowsUpdated(McastMacsLocal.class, getUpdates(), getDbSchema());
+ updatedPLocSetRows = TyperUtils.extractRowsUpdated(PhysicalLocatorSet.class, getUpdates(), getDbSchema());
+ updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
+ updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
- if(updatedMMacsLocalRows != null && !updatedMMacsLocalRows.isEmpty()) {
- for (Entry<UUID, McastMacsLocal> entry : updatedMMacsLocalRows.entrySet()) {
- updateData(transaction, entry.getValue());
- }
+ for (McastMacsLocal mcastMacsLocal : updatedMMacsLocalRows.values()) {
+ updateData(transaction, mcastMacsLocal);
}
}
// Update the connection node to let it know it manages this MCastMacsLocal
Node connectionNode = buildConnectionNode(mMacLocal);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
-// TODO: Delete entries that are no longer needed
+ // TODO: Delete entries that are no longer needed
}
}
NodeBuilder connectionNode = new NodeBuilder();
connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId());
HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder();
- LocalMcastMacsBuilder mMacLocalBuilder= new LocalMcastMacsBuilder();
+ LocalMcastMacsBuilder mMacLocalBuilder = new LocalMcastMacsBuilder();
mMacLocalBuilder.setMacEntryKey(new MacAddress(mMacLocal.getMac()));
setIpAddress(mMacLocalBuilder, mMacLocal);
setLocatorSet(mMacLocalBuilder, mMacLocal);
}
private void setLogicalSwitch(LocalMcastMacsBuilder mMacLocalBuilder, McastMacsLocal mMacLocal) {
- LogicalSwitch lSwitch = null;
if (mMacLocal.getLogicalSwitchColumn() != null && mMacLocal.getLogicalSwitchColumn().getData() != null) {
UUID lsUUID = mMacLocal.getLogicalSwitchColumn().getData();
- if (updatedLSRows.get(lsUUID) != null) {
- lSwitch = updatedLSRows.get(lsUUID);
+ LogicalSwitch lSwitch = updatedLSRows.get(lsUUID);
+ if (lSwitch != null) {
mMacLocalBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(lSwitch.getName()));
}
}
}
private void setIpAddress(LocalMcastMacsBuilder mMacLocalBuilder, McastMacsLocal mMacLocal) {
- if(mMacLocal.getIpAddr() != null && !mMacLocal.getIpAddr().isEmpty()) {
+ if (mMacLocal.getIpAddr() != null && !mMacLocal.getIpAddr().isEmpty()) {
mMacLocalBuilder.setIpaddr(new IpAddress(mMacLocal.getIpAddr().toCharArray()));
}
}
private void setLocatorSet(LocalMcastMacsBuilder mMacLocalBuilder, McastMacsLocal mMacLocal) {
if (mMacLocal.getLocatorSetColumn() != null && mMacLocal.getLocatorSetColumn().getData() != null) {
UUID pLocSetUUID = mMacLocal.getLocatorSetColumn().getData();
- if (updatedPLocSetRows.get(pLocSetUUID) != null) {
- PhysicalLocatorSet plSet = updatedPLocSetRows.get(pLocSetUUID);
+ PhysicalLocatorSet plSet = updatedPLocSetRows.get(pLocSetUUID);
+ if (plSet != null) {
if (plSet.getLocatorsColumn() != null && plSet.getLocatorsColumn().getData() != null
- && !plSet.getLocatorsColumn().getData().isEmpty()) {
+ && !plSet.getLocatorsColumn().getData().isEmpty()) {
List<LocatorSet> plsList = new ArrayList<>();
for (UUID pLocUUID : plSet.getLocatorsColumn().getData()) {
PhysicalLocator pLoc = updatedPLocRows.get(pLocUUID);
InstanceIdentifier<TerminationPoint> tpIid = HwvtepSouthboundMapper.createInstanceIdentifier(
- getOvsdbConnectionInstance().getInstanceIdentifier(), pLoc);
+ getOvsdbConnectionInstance().getInstanceIdentifier(), pLoc);
plsList.add(new LocatorSetBuilder()
- .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid)).build());
+ .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid)).build());
}
mMacLocalBuilder.setLocatorSet(plsList);
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class McastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(McastMacsRemoteUpdateCommand.class);
private Map<UUID, McastMacsRemote> updatedMMacsRemoteRows;
- private Map<UUID, McastMacsRemote> oldMMacsRemoteRows;
private Map<UUID, PhysicalLocatorSet> updatedPLocSetRows;
private Map<UUID, PhysicalLocator> updatedPLocRows;
private Map<UUID, LogicalSwitch> updatedLSRows;
- public McastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public McastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedMMacsRemoteRows = TyperUtils.extractRowsUpdated(McastMacsRemote.class, getUpdates(),getDbSchema());
- oldMMacsRemoteRows = TyperUtils.extractRowsOld(McastMacsRemote.class, getUpdates(),getDbSchema());
- updatedPLocSetRows = TyperUtils.extractRowsUpdated(PhysicalLocatorSet.class, getUpdates(),getDbSchema());
- updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(),getDbSchema());
- updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(),getDbSchema());
+ updatedMMacsRemoteRows = TyperUtils.extractRowsUpdated(McastMacsRemote.class, getUpdates(), getDbSchema());
+ updatedPLocSetRows = TyperUtils.extractRowsUpdated(PhysicalLocatorSet.class, getUpdates(), getDbSchema());
+ updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
+ updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
- if(updatedMMacsRemoteRows != null && !updatedMMacsRemoteRows.isEmpty()) {
- for (Entry<UUID, McastMacsRemote> entry : updatedMMacsRemoteRows.entrySet()) {
- updateData(transaction, entry.getValue());
- }
+ for (Entry<UUID, McastMacsRemote> entry : updatedMMacsRemoteRows.entrySet()) {
+ updateData(transaction, entry.getValue());
}
}
// Update the connection node to let it know it manages this MCastMacsRemote
Node connectionNode = buildConnectionNode(mMacRemote);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
-// TODO: Delete entries that are no longer needed
+ // TODO: Delete entries that are no longer needed
}
}
NodeBuilder connectionNode = new NodeBuilder();
connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId());
HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder();
- RemoteMcastMacsBuilder mMacRemoteBuilder= new RemoteMcastMacsBuilder();
+ RemoteMcastMacsBuilder mMacRemoteBuilder = new RemoteMcastMacsBuilder();
mMacRemoteBuilder.setMacEntryKey(new MacAddress(mMacRemote.getMac()));
setIpAddress(mMacRemoteBuilder, mMacRemote);
setLocatorSet(mMacRemoteBuilder, mMacRemote);
}
private void setLogicalSwitch(RemoteMcastMacsBuilder mMacRemoteBuilder, McastMacsRemote mMacRemote) {
- LogicalSwitch lSwitch = null;
if (mMacRemote.getLogicalSwitchColumn() != null && mMacRemote.getLogicalSwitchColumn().getData() != null) {
UUID lsUUID = mMacRemote.getLogicalSwitchColumn().getData();
- if (updatedLSRows.get(lsUUID) != null) {
- lSwitch = updatedLSRows.get(lsUUID);
+ LogicalSwitch lSwitch = updatedLSRows.get(lsUUID);
+ if (lSwitch != null) {
mMacRemoteBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(lSwitch.getName()));
}
}
}
private void setIpAddress(RemoteMcastMacsBuilder mMacRemoteBuilder, McastMacsRemote mMacRemote) {
- if(mMacRemote.getIpAddr() != null && !mMacRemote.getIpAddr().isEmpty()) {
+ if (mMacRemote.getIpAddr() != null && !mMacRemote.getIpAddr().isEmpty()) {
mMacRemoteBuilder.setIpaddr(new IpAddress(mMacRemote.getIpAddr().toCharArray()));
}
}
private void setLocatorSet(RemoteMcastMacsBuilder mMacRemoteBuilder, McastMacsRemote mMacRemote) {
if (mMacRemote.getLocatorSetColumn() != null && mMacRemote.getLocatorSetColumn().getData() != null) {
UUID pLocSetUUID = mMacRemote.getLocatorSetColumn().getData();
- if (updatedPLocSetRows.get(pLocSetUUID) != null) {
- PhysicalLocatorSet plSet = updatedPLocSetRows.get(pLocSetUUID);
+ PhysicalLocatorSet plSet = updatedPLocSetRows.get(pLocSetUUID);
+ if (plSet != null) {
if (plSet.getLocatorsColumn() != null && plSet.getLocatorsColumn().getData() != null
- && !plSet.getLocatorsColumn().getData().isEmpty()) {
+ && !plSet.getLocatorsColumn().getData().isEmpty()) {
List<LocatorSet> plsList = new ArrayList<>();
for (UUID pLocUUID : plSet.getLocatorsColumn().getData()) {
PhysicalLocator pLoc = updatedPLocRows.get(pLocUUID);
InstanceIdentifier<TerminationPoint> tpIid = HwvtepSouthboundMapper.createInstanceIdentifier(
- getOvsdbConnectionInstance().getInstanceIdentifier(), pLoc);
+ getOvsdbConnectionInstance().getInstanceIdentifier(), pLoc);
plsList.add(new LocatorSetBuilder()
- .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid)).build());
+ .setLocatorRef(new HwvtepPhysicalLocatorRef(tpIid)).build());
}
mMacRemoteBuilder.setLocatorSet(plsList);
}
package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
import java.util.Collection;
-import java.util.Map;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
import org.opendaylight.ovsdb.lib.message.TableUpdates;
-import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
-import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalPort;
-import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalSwitch;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class PhysicalLocatorRemoveCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalLocatorRemoveCommand.class);
-
- public PhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public PhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
@Override
public void execute(ReadWriteTransaction transaction) {
- Collection<PhysicalLocator> deletedPLRows = TyperUtils.extractRowsRemoved(PhysicalLocator.class, getUpdates(),getDbSchema()).values();
- if(deletedPLRows != null && !deletedPLRows.isEmpty()) {
- for (PhysicalLocator pLoc : deletedPLRows) {
- final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
- final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
- .createInstanceIdentifier(connectionIId, pLoc);
- transaction.delete(LogicalDatastoreType.OPERATIONAL, nodePath);
- //TODO: Check if any cleanup is required
- }
+ Collection<PhysicalLocator> deletedPLRows =
+ TyperUtils.extractRowsRemoved(PhysicalLocator.class, getUpdates(), getDbSchema()).values();
+ for (PhysicalLocator pLoc : deletedPLRows) {
+ final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
+ final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
+ .createInstanceIdentifier(connectionIId, pLoc);
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, nodePath);
+ //TODO: Check if any cleanup is required
}
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
public class PhysicalLocatorUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalLocatorUpdateCommand.class);
private Map<UUID, PhysicalLocator> updatedPLocRows;
private Map<UUID, PhysicalLocator> oldPLocRows;
- public PhysicalLocatorUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public PhysicalLocatorUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(),getDbSchema());
- oldPLocRows = TyperUtils.extractRowsOld(PhysicalLocator.class, getUpdates(),getDbSchema());
+ updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
+ oldPLocRows = TyperUtils.extractRowsOld(PhysicalLocator.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
- if ( updatedPLocRows == null
- || updatedPLocRows.isEmpty()) {
+ if (updatedPLocRows.isEmpty()) {
return;
}
Optional<Node> node = HwvtepSouthboundUtil.readNode(transaction, connectionIId);
private void setEncapsType(HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder, PhysicalLocator pLoc) {
String encapsType = pLoc.getEncapsulationTypeColumn().getData();
- if(HwvtepSouthboundMapper.createEncapsulationType(encapsType) != null){
+ if (HwvtepSouthboundMapper.createEncapsulationType(encapsType) != null) {
tpAugmentationBuilder.setEncapsulationType(HwvtepSouthboundMapper.createEncapsulationType(encapsType));
}
}
private void setDstIp(HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder, PhysicalLocator pLoc) {
- IpAddress ip = new IpAddress(pLoc.getDstIpColumn().getData().toCharArray());
+ IpAddress ip = new IpAddress(pLoc.getDstIpColumn().getData().toCharArray());
tpAugmentationBuilder.setDstIp(ip);
}
private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
- public PhysicalPortRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public PhysicalPortRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
@Override
public void execute(ReadWriteTransaction transaction) {
- String portName = null;
- Collection<PhysicalPort> deletedPortRows = TyperUtils.extractRowsRemoved(PhysicalPort.class, getUpdates(),getDbSchema()).values();
- Map<UUID, PhysicalSwitch> updatedPSRows = TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(),getDbSchema());
- Map<UUID, PhysicalSwitch> oldPSRows = TyperUtils.extractRowsOld(PhysicalSwitch.class, getUpdates(),getDbSchema());
- if(deletedPortRows != null && !deletedPortRows.isEmpty()) {
- for (PhysicalPort pPort : deletedPortRows) {
- PhysicalSwitch updatedPSwitchData = null;
- for(UUID pSwitchUUID: updatedPSRows.keySet()) {
- PhysicalSwitch oldPSwitchData = oldPSRows.get(pSwitchUUID);
- if(oldPSwitchData.getPortsColumn() != null
- && oldPSwitchData.getPortsColumn().getData().contains(pPort.getUuidColumn().getData())
- && (!updatedPSRows.isEmpty())) {
- updatedPSwitchData = updatedPSRows.get(pSwitchUUID);
- break;
- }
+ Collection<PhysicalPort> deletedPortRows =
+ TyperUtils.extractRowsRemoved(PhysicalPort.class, getUpdates(), getDbSchema()).values();
+ Map<UUID, PhysicalSwitch> updatedPSRows =
+ TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(), getDbSchema());
+ Map<UUID, PhysicalSwitch> oldPSRows =
+ TyperUtils.extractRowsOld(PhysicalSwitch.class, getUpdates(), getDbSchema());
+ for (PhysicalPort pPort : deletedPortRows) {
+ PhysicalSwitch updatedPSwitchData = null;
+ for (Map.Entry<UUID, PhysicalSwitch> updatedEntry : updatedPSRows.entrySet()) {
+ UUID pSwitchUUID = updatedEntry.getKey();
+ PhysicalSwitch oldPSwitchData = oldPSRows.get(pSwitchUUID);
+ if (oldPSwitchData.getPortsColumn() != null
+ && oldPSwitchData.getPortsColumn().getData().contains(pPort.getUuidColumn().getData())
+ && (!updatedPSRows.isEmpty())) {
+ updatedPSwitchData = updatedEntry.getValue();
+ break;
}
- if(updatedPSwitchData == null) {
- LOG.warn("PhysicalSwitch not found for port {}", pPort);
- continue;
- }
- portName = pPort.getName();
- final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
- .createInstanceIdentifier(getOvsdbConnectionInstance(),
- updatedPSwitchData).child(
- TerminationPoint.class,
+ }
+ if (updatedPSwitchData == null) {
+ LOG.warn("PhysicalSwitch not found for port {}", pPort);
+ } else {
+ String portName = pPort.getName();
+ final InstanceIdentifier<TerminationPoint> nodePath =
+ HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(),
+ updatedPSwitchData).child(TerminationPoint.class,
new TerminationPointKey(new TpId(portName)));
transaction.delete(LogicalDatastoreType.OPERATIONAL, nodePath);
}
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Switches;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindings;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindingsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindingsKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
private Map<UUID, PhysicalSwitch> switchUpdatedRows;
private Map<UUID, LogicalSwitch> lSwitchUpdatedRows;
- public PhysicalPortUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public PhysicalPortUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedPPRows = TyperUtils.extractRowsUpdated(PhysicalPort.class, getUpdates(),getDbSchema());
- oldPPRows = TyperUtils.extractRowsOld(PhysicalPort.class, getUpdates(),getDbSchema());
- switchUpdatedRows = TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(),getDbSchema());
- lSwitchUpdatedRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(),getDbSchema());
+ updatedPPRows = TyperUtils.extractRowsUpdated(PhysicalPort.class, getUpdates(), getDbSchema());
+ oldPPRows = TyperUtils.extractRowsOld(PhysicalPort.class, getUpdates(), getDbSchema());
+ switchUpdatedRows = TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(), getDbSchema());
+ lSwitchUpdatedRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
- if ( updatedPPRows == null
- || updatedPPRows.isEmpty()) {
+ if (updatedPPRows.isEmpty()) {
return;
}
LOG.trace("PhysicalPortTable updated: {}", updatedPPRows);
}
private void updateTerminationPoints(ReadWriteTransaction transaction, Node node) {
- for (Entry<UUID, PhysicalPort> pPortUpdate : updatedPPRows.entrySet()) {
- String portName = null;
- portName = pPortUpdate.getValue().getNameColumn().getData();
- Optional<InstanceIdentifier<Node>> switchIid = getTerminationPointSwitch(pPortUpdate.getKey());
+ for (Entry<UUID, PhysicalPort> pPortUpdateEntry : updatedPPRows.entrySet()) {
+ PhysicalPort pPortUpdate = pPortUpdateEntry.getValue();
+ String portName = pPortUpdate.getNameColumn().getData();
+ Optional<InstanceIdentifier<Node>> switchIid = getTerminationPointSwitch(pPortUpdateEntry.getKey());
if (!switchIid.isPresent()) {
- switchIid = getTerminationPointSwitch( transaction, node, portName);
+ switchIid = getTerminationPointSwitch(transaction, node, portName);
}
if (switchIid.isPresent()) {
- NodeId switchId = HwvtepSouthboundMapper.createManagedNodeId(switchIid.get());
TerminationPointKey tpKey = new TerminationPointKey(new TpId(portName));
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setKey(tpKey);
tpBuilder.setTpId(tpKey.getTpId());
- InstanceIdentifier<TerminationPoint> tpPath =
- getInstanceIdentifier(switchIid.get(), pPortUpdate.getValue());
+ InstanceIdentifier<TerminationPoint> tpPath = getInstanceIdentifier(switchIid.get(), pPortUpdate);
HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder =
new HwvtepPhysicalPortAugmentationBuilder();
- buildTerminationPoint(tpAugmentationBuilder,pPortUpdate.getValue());
+ buildTerminationPoint(tpAugmentationBuilder, pPortUpdate);
tpBuilder.addAugmentation(HwvtepPhysicalPortAugmentation.class, tpAugmentationBuilder.build());
- if (oldPPRows.containsKey(pPortUpdate.getKey())) {
+ if (oldPPRows.containsKey(pPortUpdateEntry.getKey())) {
transaction.merge(LogicalDatastoreType.OPERATIONAL,
tpPath, tpBuilder.build());
} else {
}
}
- private void buildTerminationPoint(HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder,
- PhysicalPort portUpdate) {
+ private void buildTerminationPoint(
+ HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder, PhysicalPort portUpdate) {
updatePhysicalPortId(portUpdate, tpAugmentationBuilder);
updatePort(portUpdate, tpAugmentationBuilder);
}
- private void updatePort(PhysicalPort portUpdate,
- HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
+ private void updatePort(
+ PhysicalPort portUpdate, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
updateVlanBindings(portUpdate, tpAugmentationBuilder);
}
- private void updatePhysicalPortId(PhysicalPort portUpdate,
- HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
+ private void updatePhysicalPortId(
+ PhysicalPort portUpdate, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
tpAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName(portUpdate.getName()));
- if(portUpdate.getDescription() != null) {
+ if (portUpdate.getDescription() != null) {
tpAugmentationBuilder.setHwvtepNodeDescription(portUpdate.getDescription());
}
}
- private void updateVlanBindings(PhysicalPort portUpdate,
- HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
+ private void updateVlanBindings(
+ PhysicalPort portUpdate, HwvtepPhysicalPortAugmentationBuilder tpAugmentationBuilder) {
Map<Long, UUID> vlanBindings = portUpdate.getVlanBindingsColumn().getData();
- if(vlanBindings != null && !vlanBindings.isEmpty()) {
- Set<Long> vlanBindingsKeys = vlanBindings.keySet();
+ if (vlanBindings != null && !vlanBindings.isEmpty()) {
List<VlanBindings> vlanBindingsList = new ArrayList<>();
- UUID vlanBindingValue = null;
- for(Long vlanBindingKey: vlanBindingsKeys) {
- vlanBindingValue = vlanBindings.get(vlanBindingKey);
- if(vlanBindingValue != null && vlanBindingKey != null) {
- vlanBindingsList.add(createVlanBinding(portUpdate, vlanBindingKey, vlanBindingValue));
+ for (Map.Entry<Long, UUID> vlanBindingEntry : vlanBindings.entrySet()) {
+ Long vlanBindingKey = vlanBindingEntry.getKey();
+ UUID vlanBindingValue = vlanBindingEntry.getValue();
+ if (vlanBindingValue != null && vlanBindingKey != null) {
+ vlanBindingsList.add(createVlanBinding(vlanBindingKey, vlanBindingValue));
}
}
tpAugmentationBuilder.setVlanBindings(vlanBindingsList);
}
}
- private VlanBindings createVlanBinding(PhysicalPort portUpdate, Long key, UUID value) {
+ private VlanBindings createVlanBinding(Long key, UUID value) {
VlanBindingsBuilder vbBuilder = new VlanBindingsBuilder();
VlanBindingsKey vbKey = new VlanBindingsKey(new VlanId(key.intValue()));
vbBuilder.setKey(vbKey);
vbBuilder.setVlanIdKey(vbKey.getVlanIdKey());
- HwvtepLogicalSwitchRef lSwitchRef = this.getLogicalSwitchRef(value, portUpdate.getUuid());
+ HwvtepLogicalSwitchRef lSwitchRef = this.getLogicalSwitchRef(value);
vbBuilder.setLogicalSwitchRef(lSwitchRef);
return vbBuilder.build();
}
- private HwvtepLogicalSwitchRef getLogicalSwitchRef( UUID switchUUID, UUID portUUID) {
- if (lSwitchUpdatedRows.get(switchUUID) != null) {
- return new HwvtepLogicalSwitchRef(lSwitchUpdatedRows.get(switchUUID).getName());
- }
+ private HwvtepLogicalSwitchRef getLogicalSwitchRef(UUID switchUUID) {
+ if (lSwitchUpdatedRows.get(switchUUID) != null) {
+ return new HwvtepLogicalSwitchRef(lSwitchUpdatedRows.get(switchUUID).getName());
+ }
return null;
}
- private Optional<InstanceIdentifier<Node>> getTerminationPointSwitch( UUID portUUID) {
- for (UUID switchUUID : this.switchUpdatedRows.keySet()) {
- if (this.switchUpdatedRows.get(switchUUID).getPortsColumn().getData().contains(portUUID)) {
+ private Optional<InstanceIdentifier<Node>> getTerminationPointSwitch(UUID portUUID) {
+ for (PhysicalSwitch updatedPhysicalSwitch : switchUpdatedRows.values()) {
+ if (updatedPhysicalSwitch.getPortsColumn().getData().contains(portUUID)) {
return Optional.of(HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(),
- this.switchUpdatedRows.get(switchUUID)));
+ updatedPhysicalSwitch));
}
}
return Optional.absent();
}
private Optional<InstanceIdentifier<Node>> getTerminationPointSwitch(
- final ReadWriteTransaction transaction, Node node, String tpName) {
- HwvtepGlobalAugmentation hwvtepNode = node.getAugmentation(HwvtepGlobalAugmentation.class);
- List<Switches> switchNodes = hwvtepNode.getSwitches();
- for ( Switches managedNodeEntry : switchNodes ) {
- @SuppressWarnings("unchecked")
- Node switchNode = HwvtepSouthboundUtil.readNode(transaction,
- (InstanceIdentifier<Node>)managedNodeEntry.getSwitchRef().getValue()).get();
- TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
- TerminationPointKey tpKey = new TerminationPointKey(new TpId(tpName));
- tpBuilder.setKey(tpKey);
- if (switchNode.getTerminationPoint() != null
- && switchNode.getTerminationPoint().contains(tpBuilder.build())) {
- PhysicalSwitchAugmentation pSwitchAugment
- = switchNode.getAugmentation(PhysicalSwitchAugmentation.class);
- return Optional.of((InstanceIdentifier<Node>)managedNodeEntry.getSwitchRef().getValue());
- }
- }
- return Optional.absent();
+ final ReadWriteTransaction transaction, Node node, String tpName) {
+ HwvtepGlobalAugmentation hwvtepNode = node.getAugmentation(HwvtepGlobalAugmentation.class);
+ List<Switches> switchNodes = hwvtepNode.getSwitches();
+ for (Switches managedNodeEntry : switchNodes) {
+ @SuppressWarnings("unchecked")
+ Node switchNode = HwvtepSouthboundUtil.readNode(transaction,
+ (InstanceIdentifier<Node>) managedNodeEntry.getSwitchRef().getValue()).get();
+ TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
+ TerminationPointKey tpKey = new TerminationPointKey(new TpId(tpName));
+ tpBuilder.setKey(tpKey);
+ if (switchNode.getTerminationPoint() != null
+ && switchNode.getTerminationPoint().contains(tpBuilder.build())) {
+ return Optional.of((InstanceIdentifier<Node>) managedNodeEntry.getSwitchRef().getValue());
}
+ }
+ return Optional.absent();
+ }
private InstanceIdentifier<TerminationPoint> getInstanceIdentifier(InstanceIdentifier<Node> switchIid,
- PhysicalPort pPort) {
+ PhysicalPort pPort) {
return switchIid.child(TerminationPoint.class, new TerminationPointKey(new TpId(pPort.getName())));
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.SwitchesKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class PhysicalSwitchRemoveCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalSwitchRemoveCommand.class);
-
- public PhysicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public PhysicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
@Override
public void execute(ReadWriteTransaction transaction) {
- Collection<PhysicalSwitch> deletedPSRows = TyperUtils.extractRowsRemoved(PhysicalSwitch.class, getUpdates(),getDbSchema()).values();
- if(deletedPSRows != null && !deletedPSRows.isEmpty()) {
- for (PhysicalSwitch pSwitch : deletedPSRows) {
- InstanceIdentifier<Node> nodeIid = HwvtepSouthboundMapper.createInstanceIdentifier(
- getOvsdbConnectionInstance(), pSwitch);
- InstanceIdentifier<Switches> switchIid = getOvsdbConnectionInstance().getInstanceIdentifier()
- .augmentation(HwvtepGlobalAugmentation.class)
- .child(Switches.class, new SwitchesKey(new HwvtepPhysicalSwitchRef(nodeIid)));
- // TODO handle removal of reference to managed switch from model
- transaction.delete(LogicalDatastoreType.OPERATIONAL, nodeIid);
- transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid);
- }
+ Collection<PhysicalSwitch> deletedPSRows =
+ TyperUtils.extractRowsRemoved(PhysicalSwitch.class, getUpdates(), getDbSchema()).values();
+ for (PhysicalSwitch pSwitch : deletedPSRows) {
+ InstanceIdentifier<Node> nodeIid = HwvtepSouthboundMapper.createInstanceIdentifier(
+ getOvsdbConnectionInstance(), pSwitch);
+ InstanceIdentifier<Switches> switchIid = getOvsdbConnectionInstance().getInstanceIdentifier()
+ .augmentation(HwvtepGlobalAugmentation.class)
+ .child(Switches.class, new SwitchesKey(new HwvtepPhysicalSwitchRef(nodeIid)));
+ // TODO handle removal of reference to managed switch from model
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, nodeIid);
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid);
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIpsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelIpsKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.Tunnels;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
private static final Logger LOG = LoggerFactory.getLogger(PhysicalSwitchUpdateCommand.class);
private Map<UUID, PhysicalSwitch> updatedPSRows;
- private Map<UUID, PhysicalSwitch> oldPSRows;
- public PhysicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public PhysicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedPSRows = TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(),getDbSchema());
- oldPSRows = TyperUtils.extractRowsOld(PhysicalSwitch.class, getUpdates(),getDbSchema());
+ updatedPSRows = TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
- if(updatedPSRows != null && !updatedPSRows.isEmpty()) {
- for (Entry<UUID, PhysicalSwitch> entry : updatedPSRows.entrySet()) {
- updatePhysicalSwitch(transaction, entry.getValue());
- }
+ for (PhysicalSwitch physicalSwitch : updatedPSRows.values()) {
+ updatePhysicalSwitch(transaction, physicalSwitch);
}
}
final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
Optional<Node> connection = HwvtepSouthboundUtil.readNode(transaction, connectionIId);
if (connection.isPresent()) {
- LOG.debug("Connection {} is present",connection);
+ LOG.debug("Connection {} is present", connection);
// Update the connection node to let it know it manages this Physical Switch
Node connectionNode = buildConnectionNode(pSwitch);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
InstanceIdentifier<Node> psIid = getInstanceIdentifier(pSwitch);
Node psNode = buildPhysicalSwitchNode(pSwitch);
transaction.merge(LogicalDatastoreType.OPERATIONAL, psIid, psNode);
-// TODO: Delete entries that are no longer needed
+ // TODO: Delete entries that are no longer needed
}
}
psNodeBuilder.setNodeId(psNodeId);
PhysicalSwitchAugmentationBuilder psAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
psAugmentationBuilder.setPhysicalSwitchUuid(new Uuid(pSwitch.getUuid().toString()));
- setManagedBy(psAugmentationBuilder, pSwitch);
+ setManagedBy(psAugmentationBuilder);
setPhysicalSwitchId(psAugmentationBuilder, pSwitch);
setManagementIps(psAugmentationBuilder, pSwitch);
setTunnelIps(psAugmentationBuilder, pSwitch);
return psNodeBuilder.build();
}
- private void setManagedBy(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
+ private void setManagedBy(PhysicalSwitchAugmentationBuilder psAugmentationBuilder) {
InstanceIdentifier<Node> connectionNodePath = getOvsdbConnectionInstance().getInstanceIdentifier();
psAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(connectionNodePath));
}
private void setPhysicalSwitchId(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
- if(pSwitch.getName() != null) {
+ if (pSwitch.getName() != null) {
psAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName(pSwitch.getName()));
}
- if(pSwitch.getDescription() != null) {
+ if (pSwitch.getDescription() != null) {
psAugmentationBuilder.setHwvtepNodeDescription(pSwitch.getDescription());
}
}
private void setManagementIps(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
- if(pSwitch.getManagementIpsColumn() != null
+ if (pSwitch.getManagementIpsColumn() != null
&& pSwitch.getManagementIpsColumn().getData() != null
- && !pSwitch.getManagementIpsColumn().getData().isEmpty() ) {
+ && !pSwitch.getManagementIpsColumn().getData().isEmpty()) {
List<ManagementIps> mgmtIps = new ArrayList<>();
- for(String mgmtIp: pSwitch.getManagementIpsColumn().getData()) {
+ for (String mgmtIp : pSwitch.getManagementIpsColumn().getData()) {
IpAddress ip = new IpAddress(mgmtIp.toCharArray());
mgmtIps.add(new ManagementIpsBuilder()
.setKey(new ManagementIpsKey(ip))
}
private void setTunnelIps(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
- if(pSwitch.getTunnelIpsColumn() != null
- && pSwitch.getTunnelIpsColumn().getData() != null
- && !pSwitch.getTunnelIpsColumn().getData().isEmpty()) {
+ if (pSwitch.getTunnelIpsColumn() != null
+ && pSwitch.getTunnelIpsColumn().getData() != null
+ && !pSwitch.getTunnelIpsColumn().getData().isEmpty()) {
List<TunnelIps> tunnelIps = new ArrayList<>();
- for(String tunnelIp: pSwitch.getTunnelIpsColumn().getData()) {
+ for (String tunnelIp : pSwitch.getTunnelIpsColumn().getData()) {
IpAddress ip = new IpAddress(tunnelIp.toCharArray());
tunnelIps.add(new TunnelIpsBuilder()
.setKey(new TunnelIpsKey(ip))
private void setUcastMacsLocal(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
// TODO Auto-generated method stub
-
+
}
private void setUcastMacsRemote(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
// TODO Auto-generated method stub
-
+
}
private void setMcastMacsLocal(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
// TODO Auto-generated method stub
-
+
}
private void setMcastMacsRemote(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
// TODO Auto-generated method stub
-
+
}
private Node buildConnectionNode(PhysicalSwitch pSwitch) {
HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder();
List<Switches> switches = new ArrayList<>();
- InstanceIdentifier<Node> switchIid = HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(),
- pSwitch);
+ InstanceIdentifier<Node> switchIid =
+ HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), pSwitch);
hgAugmentationBuilder.setSwitches(switches);
Switches physicalSwitch = new SwitchesBuilder().setSwitchRef(
- new HwvtepPhysicalSwitchRef(switchIid)).build();
+ new HwvtepPhysicalSwitchRef(switchIid)).build();
switches.add(physicalSwitch);
connectionNode.addAugmentation(HwvtepGlobalAugmentation.class, hgAugmentationBuilder.build());
}
private NodeId getNodeId(PhysicalSwitch pSwitch) {
- NodeKey nodeKey = getInstanceIdentifier(pSwitch).firstKeyOf(Node.class, NodeKey.class);
+ NodeKey nodeKey = getInstanceIdentifier(pSwitch).firstKeyOf(Node.class);
return nodeKey.getNodeId();
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class UcastMacsLocalUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(UcastMacsLocalUpdateCommand.class);
private Map<UUID, UcastMacsLocal> updatedUMacsLocalRows;
- private Map<UUID, UcastMacsLocal> oldUMacsLocalRows;
private Map<UUID, PhysicalLocator> updatedPLocRows;
private Map<UUID, LogicalSwitch> updatedLSRows;
- public UcastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public UcastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
- updatedUMacsLocalRows = TyperUtils.extractRowsUpdated(UcastMacsLocal.class, getUpdates(),getDbSchema());
- oldUMacsLocalRows = TyperUtils.extractRowsOld(UcastMacsLocal.class, getUpdates(),getDbSchema());
- updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(),getDbSchema());
- updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(),getDbSchema());
+ updatedUMacsLocalRows = TyperUtils.extractRowsUpdated(UcastMacsLocal.class, getUpdates(), getDbSchema());
+ updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
+ updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
- if(updatedUMacsLocalRows != null && !updatedUMacsLocalRows.isEmpty()) {
- for (Entry<UUID, UcastMacsLocal> entry : updatedUMacsLocalRows.entrySet()) {
- updateData(transaction, entry.getValue());
- }
+ for (UcastMacsLocal ucastMacsLocal : updatedUMacsLocalRows.values()) {
+ updateData(transaction, ucastMacsLocal);
}
}
// Update the connection node to let it know it manages this UCastMacsLocal
Node connectionNode = buildConnectionNode(ucml);
transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
-// TODO: Delete entries that are no longer needed
+ // TODO: Delete entries that are no longer needed
}
}
InstanceIdentifier<Node> nodeIid = getOvsdbConnectionInstance().getInstanceIdentifier();
HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder();
LocalUcastMacsBuilder ucmlBuilder = new LocalUcastMacsBuilder();
- if(ucml.getIpAddr()!=null && !ucml.getIpAddr().isEmpty()){
+ if (ucml.getIpAddr() != null && !ucml.getIpAddr().isEmpty()) {
ucmlBuilder.setIpaddr(new IpAddress(ucml.getIpAddr().toCharArray()));
}
ucmlBuilder.setMacEntryKey(new MacAddress(ucml.getMac()));
- if(ucml.getLocatorColumn() !=null && ucml.getLocatorColumn().getData() !=null){
+ if (ucml.getLocatorColumn() != null && ucml.getLocatorColumn().getData() != null) {
UUID plocUUID = ucml.getLocatorColumn().getData();
- if(updatedPLocRows.get(plocUUID) != null ){
- InstanceIdentifier<TerminationPoint> plIid = HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid, updatedPLocRows.get(plocUUID));
+ PhysicalLocator physicalLocator = updatedPLocRows.get(plocUUID);
+ if (physicalLocator != null) {
+ InstanceIdentifier<TerminationPoint> plIid =
+ HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid, physicalLocator);
ucmlBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid));
}
}
if (ucml.getLogicalSwitchColumn() != null && ucml.getLogicalSwitchColumn().getData() != null) {
UUID lsUUID = ucml.getLogicalSwitchColumn().getData();
- if (updatedLSRows.get(lsUUID) != null) {
- ucmlBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(updatedLSRows.get(lsUUID).getName()));
+ LogicalSwitch logicalSwitch = updatedLSRows.get(lsUUID);
+ if (logicalSwitch != null) {
+ ucmlBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(logicalSwitch.getName()));
}
}
List<LocalUcastMacs> umclList = new ArrayList<>();
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
public class UcastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
private final Map<UUID, UcastMacsRemote> updatedUMacsRemoteRows;
- private final Map<UUID, UcastMacsRemote> oldUMacsRemoteRows;
private final Map<UUID, PhysicalLocator> updatedPLocRows;
private final Map<UUID, LogicalSwitch> updatedLSRows;
- public UcastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates,
- DatabaseSchema dbSchema) {
+ public UcastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedUMacsRemoteRows = TyperUtils.extractRowsUpdated(UcastMacsRemote.class, getUpdates(), getDbSchema());
- oldUMacsRemoteRows = TyperUtils.extractRowsOld(UcastMacsRemote.class, getUpdates(), getDbSchema());
updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
@Override
public void execute(ReadWriteTransaction transaction) {
- for (Entry<UUID, UcastMacsRemote> umrUpdate : updatedUMacsRemoteRows.entrySet()) {
- updateUcastMacsRemote(transaction, umrUpdate.getValue());
+ for (UcastMacsRemote ucastMacsRemote : updatedUMacsRemoteRows.values()) {
+ updateUcastMacsRemote(transaction, ucastMacsRemote);
}
}
if (uMacRemote.getLocatorColumn() != null
&& uMacRemote.getLocatorColumn().getData() != null) {
UUID pLocUUID = uMacRemote.getLocatorColumn().getData();
- if (updatedPLocRows.get(pLocUUID) != null) {
- InstanceIdentifier<TerminationPoint> plIid = HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid, updatedPLocRows.get(pLocUUID));
+ PhysicalLocator physicalLocator = updatedPLocRows.get(pLocUUID);
+ if (physicalLocator != null) {
+ InstanceIdentifier<TerminationPoint> plIid = HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid,
+ physicalLocator);
rumBuilder.setLocatorRef(new HwvtepPhysicalLocatorRef(plIid));
}
}
if (uMacRemote.getLogicalSwitchColumn() != null
&& uMacRemote.getLogicalSwitchColumn().getData() != null) {
UUID lsUUID = uMacRemote.getLogicalSwitchColumn().getData();
- if (updatedLSRows.get(lsUUID) != null) {
- rumBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(updatedLSRows.get(lsUUID).getName()));
+ final LogicalSwitch logicalSwitch = updatedLSRows.get(lsUUID);
+ if (logicalSwitch != null) {
+ rumBuilder.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(logicalSwitch.getName()));
}
}
remoteUMacs.add(rumBuilder.build());
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>commons</artifactId>
- <groupId>org.opendaylight.ovsdb</groupId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/parent/pom.xml</relativePath>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<artifactId>utils.config</artifactId>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</scm>
+ <properties>
+ <powermock.version>1.5.2</powermock.version>
+ </properties>
+
<dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
+ <!-- testing dependencies -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
+ <version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
+ <version>${powermock.version}</version>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
</project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>commons</artifactId>
- <groupId>org.opendaylight.ovsdb</groupId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/parent/pom.xml</relativePath>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<artifactId>utils.mdsal-node</artifactId>
</scm>
<dependencies>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.dependencymanager</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
+ <!-- controller dependencies -->
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
+ <!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
</project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>commons</artifactId>
- <groupId>org.opendaylight.ovsdb</groupId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/parent/pom.xml</relativePath>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<artifactId>utils.mdsal-openflow</artifactId>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</scm>
+ <properties>
+ <openflowplugin.version>0.2.0-SNAPSHOT</openflowplugin.version>
+ </properties>
+
<dependencies>
- <!-- Yang Models -->
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types</artifactId>
- </dependency>
+ <!-- controller dependencies -->
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-inventory</artifactId>
</dependency>
+ <!-- mdsal dependencies -->
<dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
- <artifactId>model-flow-base</artifactId>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>opendaylight-l2-types</artifactId>
</dependency>
+ <!-- openflowplugin dependencies -->
+ <dependency>
+ <groupId>org.opendaylight.openflowplugin.model</groupId>
+ <artifactId>model-flow-base</artifactId>
+ <version>${openflowplugin.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowjava-extension-nicira</artifactId>
+ <version>${openflowplugin.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-extension-api</artifactId>
+ <version>${openflowplugin.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-extension-nicira</artifactId>
+ <version>${openflowplugin.version}</version>
</dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
+ <!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- </plugin>
</plugins>
</build>
</project>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>binding-parent</artifactId>
- <version>0.8.0-SNAPSHOT</version>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
<relativePath/>
</parent>
</scm>
<dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
+ <!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>binding-parent</artifactId>
- <version>0.8.0-SNAPSHOT</version>
- <relativePath/>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<groupId>org.opendaylight.ovsdb</groupId>
<packaging>bundle</packaging>
<dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
+ <!-- project specific dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>utils.mdsal-utils</artifactId>
<version>${project.version}</version>
</dependency>
+ <!-- neutron dependencies -->
<dependency>
<groupId>org.opendaylight.neutron</groupId>
<artifactId>model</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- </plugin>
- </plugins>
- </build>
-
</project>
\ No newline at end of file
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>commons</artifactId>
- <groupId>org.opendaylight.ovsdb</groupId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../commons/parent/pom.xml</relativePath>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>odlparent</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
+ <groupId>org.opendaylight.ovsdb</groupId>
<artifactId>utils</artifactId>
<version>1.1.0-SNAPSHOT</version>
<name>${project.artifactId}</name>
<module>servicehelper</module>
<module>southbound-utils</module>
</modules>
+
+<!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>commons</artifactId>
- <groupId>org.opendaylight.ovsdb</groupId>
- <version>1.4.0-SNAPSHOT</version>
- <relativePath>../../commons/parent/pom.xml</relativePath>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<artifactId>utils.servicehelper</artifactId>
<url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
</scm>
+ <properties>
+ <powermock.version>1.5.2</powermock.version>
+ </properties>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
+ <version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<scope>test</scope>
+ <version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
+ <version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- </plugin>
</plugins>
</build>
</project>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>binding-parent</artifactId>
- <version>0.8.0-SNAPSHOT</version>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
<relativePath/>
</parent>
<packaging>bundle</packaging>
<dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.3.0-SNAPSHOT</version>
- </dependency>
+ <!-- project specific dependencies -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>southbound-api</artifactId>
<artifactId>utils.mdsal-utils</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
+ <!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
</project>
\ No newline at end of file