import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
+import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
+import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalSwitch;
/*
* HwvtepDeviceInfo is used to store some of the table entries received
* in updates from a Hwvtep device. There will be one instance of this per
* Hwvtep device connected. Table entries are stored in a map keyed by
* uuids of respective rows.
- *
+ *
* Purpose of this class is to provide data present in tables which
* were updated in a previous transaction and are not available in
* current updatedRows. This allows us to handle updates for Tables
* which reference other tables and need information in those tables
* to add data to Operational data store.
- *
+ *
* e.g. Mac-entries in data store use logical-switch-ref as one of the
* keys. Mac-entry updates from switch rarely contain Logical_Switch
* table entries. To add mac-entries we need table entries from
* Logical_Switch table which were created in an earlier update.
- *
+ *
*/
public class HwvtepDeviceInfo {
private Map<UUID, LogicalSwitch> logicalSwitches = null;
+ private Map<UUID, PhysicalSwitch> physicalSwitches = null;
+ private Map<UUID, PhysicalLocator> physicalLocators = null;
+ private Map<UUID, UUID> mapTunnelToPhysicalSwitch = null;
public HwvtepDeviceInfo() {
this.logicalSwitches = new HashMap<>();
+ this.physicalSwitches = new HashMap<>();
+ this.physicalLocators = new HashMap<>();
+ this.mapTunnelToPhysicalSwitch = new HashMap<>();
}
public void putLogicalSwitch(UUID uuid, LogicalSwitch lSwitch) {
public Map<UUID, LogicalSwitch> getLogicalSwitches() {
return logicalSwitches;
}
+
+ public void putPhysicalSwitch(UUID uuid, PhysicalSwitch pSwitch) {
+ physicalSwitches.put(uuid, pSwitch);
+ }
+
+ public PhysicalSwitch getPhysicalSwitch(UUID uuid) {
+ return physicalSwitches.get(uuid);
+ }
+
+ public PhysicalSwitch removePhysicalSwitch(UUID uuid) {
+ return physicalSwitches.remove(uuid);
+ }
+
+ public Map<UUID, PhysicalSwitch> getPhysicalSwitches() {
+ return physicalSwitches;
+ }
+
+ public void putPhysicalLocator(UUID uuid, PhysicalLocator pLocator) {
+ physicalLocators.put(uuid, pLocator);
+ }
+
+ public PhysicalLocator getPhysicalLocator(UUID uuid) {
+ return physicalLocators.get(uuid);
+ }
+
+ public PhysicalLocator removePhysicalLocator(UUID uuid) {
+ return physicalLocators.remove(uuid);
+ }
+
+ public Map<UUID, PhysicalLocator> getPhysicalLocators() {
+ return physicalLocators;
+ }
+
+ public void putPhysicalSwitchForTunnel(UUID uuid, UUID psUUID) {
+ mapTunnelToPhysicalSwitch.put(uuid, psUUID);
+ }
+
+ public PhysicalSwitch getPhysicalSwitchForTunnel(UUID uuid) {
+ return physicalSwitches.get(mapTunnelToPhysicalSwitch.get(uuid));
+ }
+
+ public void removePhysicalSwitchForTunnel(UUID uuid) {
+ mapTunnelToPhysicalSwitch.remove(uuid);
+ }
+
+ public Map<UUID, UUID> getPhysicalSwitchesForTunnels() {
+ return mapTunnelToPhysicalSwitch;
+ }
+
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfo;
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.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.TunnelsKey;
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.VlanBindingsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.EncapsulationTypeVxlanOverIpv4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
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.HwvtepPhysicalLocatorRef;
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.PhysicalSwitchAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfoBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
return iid;
}
+ public static InstanceIdentifier<Tunnels> createInstanceIdentifier( InstanceIdentifier<Node> nodeIid,
+ InstanceIdentifier<TerminationPoint> localTpIid, InstanceIdentifier<TerminationPoint> remoteTpIid) {
+
+ TunnelsKey tunnelsKey = new TunnelsKey(new HwvtepPhysicalLocatorRef(localTpIid),
+ new HwvtepPhysicalLocatorRef(remoteTpIid));
+ InstanceIdentifier<Tunnels> tunnelInstanceId = nodeIid.builder().augmentation(PhysicalSwitchAugmentation.class)
+ .child(Tunnels.class, tunnelsKey).build();
+ return tunnelInstanceId;
+ }
+
public static Class<? extends EncapsulationTypeBase> createEncapsulationType(String type) {
Preconditions.checkNotNull(type);
if (type.isEmpty()) {
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;
-public class LogicalSwitchRemoveCommand extends AbstractTransactionCommand {
+public class HwvtepLogicalSwitchRemoveCommand extends AbstractTransactionCommand {
- public LogicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepLogicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
import com.google.common.base.Optional;
-public class LogicalSwitchUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepLogicalSwitchUpdateCommand extends AbstractTransactionCommand {
private Map<UUID, LogicalSwitch> updatedLSRows;
- public LogicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepLogicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedLSRows = TyperUtils.extractRowsUpdated(LogicalSwitch.class, getUpdates(), getDbSchema());
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class MacEntriesRemoveCommand extends AbstractTransactionCommand {
+public class HwvtepMacEntriesRemoveCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(MacEntriesRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(HwvtepMacEntriesRemoveCommand.class);
- public MacEntriesRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepMacEntriesRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
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;
-public class McastMacsLocalUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepMcastMacsLocalUpdateCommand extends AbstractTransactionCommand {
private Map<UUID, McastMacsLocal> updatedMMacsLocalRows;
private Map<UUID, PhysicalLocatorSet> updatedPLocSetRows;
private Map<UUID, PhysicalLocator> updatedPLocRows;
- public McastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepMcastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedMMacsLocalRows = TyperUtils.extractRowsUpdated(McastMacsLocal.class, getUpdates(), getDbSchema());
updatedPLocSetRows = TyperUtils.extractRowsUpdated(PhysicalLocatorSet.class, getUpdates(), getDbSchema());
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;
-public class McastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepMcastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
private Map<UUID, McastMacsRemote> updatedMMacsRemoteRows;
private Map<UUID, PhysicalLocatorSet> updatedPLocSetRows;
private Map<UUID, PhysicalLocator> updatedPLocRows;
- public McastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepMcastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedMMacsRemoteRows = TyperUtils.extractRowsUpdated(McastMacsRemote.class, getUpdates(), getDbSchema());
updatedPLocSetRows = TyperUtils.extractRowsUpdated(PhysicalLocatorSet.class, getUpdates(), getDbSchema());
public HwvtepOperationalCommandAggregator(HwvtepConnectionInstance key,TableUpdates updates,
DatabaseSchema dbSchema) {
commands.add(new GlobalUpdateCommand(key, updates, dbSchema));
- commands.add(new PhysicalSwitchUpdateCommand(key, updates, dbSchema));
- commands.add(new PhysicalSwitchRemoveCommand(key, updates, dbSchema));
+ commands.add(new HwvtepPhysicalSwitchUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepPhysicalSwitchRemoveCommand(key, updates, dbSchema));
commands.add(new HwvtepManagerUpdateCommand(key, updates, dbSchema));
commands.add(new HwvtepManagerRemoveCommand(key, updates, dbSchema));
- commands.add(new LogicalSwitchUpdateCommand(key, updates, dbSchema));
- commands.add(new LogicalSwitchRemoveCommand(key, updates, dbSchema));
- commands.add(new PhysicalPortUpdateCommand(key, updates, dbSchema));
- commands.add(new PhysicalPortRemoveCommand(key, updates, dbSchema));
- commands.add(new PhysicalLocatorUpdateCommand(key, updates, dbSchema));
- commands.add(new PhysicalLocatorRemoveCommand(key, updates, dbSchema));
- commands.add(new UcastMacsLocalUpdateCommand(key, updates, dbSchema));
- commands.add(new UcastMacsRemoteUpdateCommand(key, updates, dbSchema));
- commands.add(new McastMacsLocalUpdateCommand(key, updates, dbSchema));
- commands.add(new McastMacsRemoteUpdateCommand(key, updates, dbSchema));
- commands.add(new MacEntriesRemoveCommand(key, updates, dbSchema));
+ commands.add(new HwvtepLogicalSwitchUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepLogicalSwitchRemoveCommand(key, updates, dbSchema));
+ commands.add(new HwvtepPhysicalPortUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepPhysicalPortRemoveCommand(key, updates, dbSchema));
+ commands.add(new HwvtepPhysicalLocatorUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepTunnelUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepTunnelRemoveCommand(key, updates, dbSchema));
+ commands.add(new HwvtepPhysicalLocatorRemoveCommand(key, updates, dbSchema));
+ commands.add(new HwvtepUcastMacsLocalUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepUcastMacsRemoteUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepMcastMacsLocalUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepMcastMacsRemoteUpdateCommand(key, updates, dbSchema));
+ commands.add(new HwvtepMacEntriesRemoveCommand(key, updates, dbSchema));
}
@Override
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
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;
-public class PhysicalLocatorRemoveCommand extends AbstractTransactionCommand {
+public class HwvtepPhysicalLocatorRemoveCommand extends AbstractTransactionCommand {
- public PhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepPhysicalLocatorRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
final InstanceIdentifier<TerminationPoint> nodePath = HwvtepSouthboundMapper
.createInstanceIdentifier(connectionIId, pLoc);
transaction.delete(LogicalDatastoreType.OPERATIONAL, nodePath);
+ getOvsdbConnectionInstance().getDeviceInfo().removePhysicalLocator(pLoc.getUuid());
//TODO: Check if any cleanup is required
}
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import com.google.common.base.Optional;
-public class PhysicalLocatorUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepPhysicalLocatorUpdateCommand extends AbstractTransactionCommand {
private Map<UUID, PhysicalLocator> updatedPLocRows;
private Map<UUID, PhysicalLocator> oldPLocRows;
- public PhysicalLocatorUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepPhysicalLocatorUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
oldPLocRows = TyperUtils.extractRowsOld(PhysicalLocator.class, getUpdates(), getDbSchema());
} else {
transaction.put(LogicalDatastoreType.OPERATIONAL,
tpPath, tpBuilder.build());
+ getOvsdbConnectionInstance().getDeviceInfo().putPhysicalLocator(pLoc.getUuid(), pLoc);
}
}
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class PhysicalPortRemoveCommand extends AbstractTransactionCommand {
+public class HwvtepPhysicalPortRemoveCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortRemoveCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(HwvtepPhysicalPortRemoveCommand.class);
- public PhysicalPortRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepPhysicalPortRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
import com.google.common.base.Optional;
-public class PhysicalPortUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepPhysicalPortUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalPortUpdateCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(HwvtepPhysicalPortUpdateCommand.class);
private Map<UUID, PhysicalPort> updatedPPRows;
private Map<UUID, PhysicalPort> oldPPRows;
private Map<UUID, PhysicalSwitch> switchUpdatedRows;
- public PhysicalPortUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepPhysicalPortUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedPPRows = TyperUtils.extractRowsUpdated(PhysicalPort.class, getUpdates(), getDbSchema());
oldPPRows = TyperUtils.extractRowsOld(PhysicalPort.class, getUpdates(), getDbSchema());
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;
-public class PhysicalSwitchRemoveCommand extends AbstractTransactionCommand {
+public class HwvtepPhysicalSwitchRemoveCommand extends AbstractTransactionCommand {
- public PhysicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepPhysicalSwitchRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
}
// TODO handle removal of reference to managed switch from model
transaction.delete(LogicalDatastoreType.OPERATIONAL, nodeIid);
transaction.delete(LogicalDatastoreType.OPERATIONAL, switchIid);
+ getOvsdbConnectionInstance().getDeviceInfo().removePhysicalSwitch(pSwitch.getUuid());
}
}
/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-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.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.PhysicalSwitch;
import org.opendaylight.ovsdb.schema.hardwarevtep.Tunnel;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalRef;
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.HwvtepPhysicalLocatorRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalSwitchRef;
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.PhysicalSwitchAugmentationBuilder;
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.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdLocalConfigs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdLocalConfigsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParamsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdStatus;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdStatusBuilder;
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;
import com.google.common.base.Optional;
-public class PhysicalSwitchUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepPhysicalSwitchUpdateCommand extends AbstractTransactionCommand {
- private static final Logger LOG = LoggerFactory.getLogger(PhysicalSwitchUpdateCommand.class);
+ private static final Logger LOG = LoggerFactory.getLogger(HwvtepPhysicalSwitchUpdateCommand.class);
private Map<UUID, PhysicalSwitch> updatedPSRows;
private Map<UUID, Tunnel> updatedTunnelRows;
- private Map<UUID, PhysicalLocator> updatedPLocRows;
- public PhysicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepPhysicalSwitchUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedPSRows = TyperUtils.extractRowsUpdated(PhysicalSwitch.class, getUpdates(), getDbSchema());
- updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
try {
updatedTunnelRows = TyperUtils.extractRowsUpdated(Tunnel.class, getUpdates(), getDbSchema());
} catch (IllegalArgumentException e) {
InstanceIdentifier<Node> psIid = getInstanceIdentifier(pSwitch);
Node psNode = buildPhysicalSwitchNode(connection.get(), pSwitch);
transaction.merge(LogicalDatastoreType.OPERATIONAL, psIid, psNode);
+ getOvsdbConnectionInstance().getDeviceInfo().putPhysicalSwitch(pSwitch.getUuid(), pSwitch);
// TODO: Delete entries that are no longer needed
// TODO: Deletion of tunnels
// TODO: Deletion of Tunnel BFD config and params
setPhysicalSwitchId(psAugmentationBuilder, pSwitch);
setManagementIps(psAugmentationBuilder, pSwitch);
setTunnelIps(psAugmentationBuilder, pSwitch);
- setTunnels(node, psAugmentationBuilder, pSwitch);
+ setTunnels(psAugmentationBuilder, pSwitch);
psNodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, psAugmentationBuilder.build());
return psNodeBuilder.build();
}
- private void setTunnels(Node node, PhysicalSwitchAugmentationBuilder psAugmentationBuilder,
- PhysicalSwitch pSwitch) {
+ private void setTunnels(PhysicalSwitchAugmentationBuilder psAugmentationBuilder, PhysicalSwitch pSwitch) {
if (updatedTunnelRows != null && pSwitch.getTunnels() != null && pSwitch.getTunnels().getData() != null
&& !pSwitch.getTunnels().getData().isEmpty()) {
- Set<UUID> uuidList = pSwitch.getTunnels().getData();
- List<Tunnels> tunnelList = new ArrayList<>();
- TunnelsBuilder tBuilder = new TunnelsBuilder();
- for (UUID uuid : uuidList) {
- Tunnel tunnel = updatedTunnelRows.get(uuid);
- if (tunnel.getLocalColumn().getData() != null) {
- PhysicalLocator pLoc = updatedPLocRows.get(tunnel.getLocalColumn().getData());
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint> tpPath =
- HwvtepSouthboundMapper.createInstanceIdentifier(
- HwvtepSouthboundMapper.createInstanceIdentifier(node.getNodeId()), pLoc);
- tBuilder.setLocalLocatorRef(new HwvtepPhysicalLocatorRef(tpPath));
- }
- tBuilder.setTunnelUuid(new Uuid(uuid.toString()));
- setBfdLocalConfigs(tBuilder, tunnel);
- setBfdRemoteConfigs(tBuilder, tunnel);
- setBfdParams(tBuilder, tunnel);
- setBfdStatus(tBuilder, tunnel);
-
- if (tunnel.getRemoteColumn().getData() != null) {
- PhysicalLocator pLoc = updatedPLocRows.get(tunnel.getRemoteColumn().getData());
- InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint> tpPath =
- HwvtepSouthboundMapper.createInstanceIdentifier(
- HwvtepSouthboundMapper.createInstanceIdentifier(node.getNodeId()), pLoc);
- tBuilder.setRemoteLocatorRef(new HwvtepPhysicalLocatorRef(tpPath));
- }
- tunnelList.add(tBuilder.build());
- }
- psAugmentationBuilder.setTunnels(tunnelList);
- }
-
- }
-
- private void setBfdLocalConfigs(TunnelsBuilder tBuilder, Tunnel tunnel) {
- Map<String, String> localConfigs = tunnel.getBfdConfigLocalColumn().getData();
- if(localConfigs != null && !localConfigs.isEmpty()) {
- Set<String> localConfigKeys = localConfigs.keySet();
- List<BfdLocalConfigs> localConfigsList = new ArrayList<>();
- String localConfigValue = null;
- for(String localConfigKey: localConfigKeys) {
- localConfigValue = localConfigs.get(localConfigKey);
- if(localConfigValue != null && localConfigKey != null) {
- localConfigsList.add(new BfdLocalConfigsBuilder()
- .setBfdLocalConfigKey(localConfigKey)
- .setBfdLocalConfigValue(localConfigValue)
- .build());
- }
- }
- tBuilder.setBfdLocalConfigs(localConfigsList);
- }
- }
-
- private void setBfdRemoteConfigs(TunnelsBuilder tBuilder, Tunnel tunnel) {
- Map<String, String> remoteConfigs = tunnel.getBfdConfigRemoteColumn().getData();
- if(remoteConfigs != null && !remoteConfigs.isEmpty()) {
- Set<String> remoteConfigKeys = remoteConfigs.keySet();
- List<BfdRemoteConfigs> remoteConfigsList = new ArrayList<>();
- String remoteConfigValue = null;
- for(String remoteConfigKey: remoteConfigKeys) {
- remoteConfigValue = remoteConfigs.get(remoteConfigKey);
- if(remoteConfigValue != null && remoteConfigKey != null) {
- remoteConfigsList.add(new BfdRemoteConfigsBuilder()
- .setBfdRemoteConfigKey(remoteConfigKey)
- .setBfdRemoteConfigValue(remoteConfigValue)
- .build());
- }
+ // Nothing to do but update deviceInfo cache
+ for(UUID uuid: pSwitch.getTunnels().getData()) {
+ getOvsdbConnectionInstance().getDeviceInfo().putPhysicalSwitchForTunnel(uuid, pSwitch.getUuid());
}
- tBuilder.setBfdRemoteConfigs(remoteConfigsList);
- }
- }
-
-
- private void setBfdParams(TunnelsBuilder tBuilder, Tunnel tunnel) {
- Map<String, String> params = tunnel.getBfdParamsColumn().getData();
- if(params != null && !params.isEmpty()) {
- Set<String> paramKeys = params.keySet();
- List<BfdParams> paramsList = new ArrayList<>();
- String paramValue = null;
- for(String paramKey: paramKeys) {
- paramValue = params.get(paramKey);
- if(paramValue != null && paramKey != null) {
- paramsList.add(new BfdParamsBuilder()
- .setBfdParamKey(paramKey)
- .setBfdParamValue(paramValue)
- .build());
- }
- }
- tBuilder.setBfdParams(paramsList);
- }
- }
-
- private void setBfdStatus(TunnelsBuilder tBuilder, Tunnel tunnel) {
- Map<String, String> status = tunnel.getBfdStatusColumn().getData();
- if(status != null && !status.isEmpty()) {
- Set<String> paramKeys = status.keySet();
- List<BfdStatus> statusList = new ArrayList<>();
- String paramValue = null;
- for(String paramKey: paramKeys) {
- paramValue = status.get(paramKey);
- if(paramValue != null && paramKey != null) {
- statusList.add(new BfdStatusBuilder()
- .setBfdStatusKey(paramKey)
- .setBfdStatusValue(paramValue)
- .build());
- }
- }
- tBuilder.setBfdStatus(statusList);
}
}
NodeKey nodeKey = getInstanceIdentifier(pSwitch).firstKeyOf(Node.class);
return nodeKey.getNodeId();
}
+
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+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.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.PhysicalSwitch;
+import org.opendaylight.ovsdb.schema.hardwarevtep.Tunnel;
+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.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.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HwvtepTunnelRemoveCommand extends AbstractTransactionCommand {
+
+ private static final Logger LOG = LoggerFactory.getLogger(HwvtepTunnelRemoveCommand.class);
+ Collection<Tunnel> deletedTunnelRows = null;
+
+ public HwvtepTunnelRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ super(key, updates, dbSchema);
+ try {
+ deletedTunnelRows = TyperUtils.extractRowsRemoved(Tunnel.class, getUpdates(), getDbSchema()).values();
+ } catch (IllegalArgumentException e) {
+ LOG.debug("Tunnel Table not supported on this HWVTEP device", e.getMessage());
+ }
+ }
+
+ @Override
+ public void execute(ReadWriteTransaction transaction) {
+ for (Tunnel tunnel : deletedTunnelRows) {
+ try {
+ InstanceIdentifier<Tunnels> tunnelIid = getInstanceIdentifier(getOvsdbConnectionInstance(), tunnel);
+ if(tunnelIid != null) {
+ transaction.delete(LogicalDatastoreType.OPERATIONAL, tunnelIid);
+ LOG.trace("Deleting tunnel {}", tunnelIid);
+ }
+ getOvsdbConnectionInstance().getDeviceInfo().removePhysicalSwitchForTunnel(tunnel.getUuid());
+ } catch (Exception e) {
+ LOG.warn("Failed to delete tunnel {}", tunnel, e);
+ }
+ }
+ }
+
+ private InstanceIdentifier<Tunnels> getInstanceIdentifier(HwvtepConnectionInstance client, Tunnel tunnel) {
+ InstanceIdentifier<Tunnels> result = null;
+
+ PhysicalSwitch pSwitch = client.getDeviceInfo().getPhysicalSwitchForTunnel(tunnel.getUuid());
+ if(pSwitch == null){
+ //PhysicalSwitch has already been removed, nothing to do here
+ return null;
+ }
+ InstanceIdentifier<Node> psIid = HwvtepSouthboundMapper.createInstanceIdentifier(client, pSwitch);
+ PhysicalLocator plLocal = getPhysicalLocatorFromUUID((tunnel.getLocalColumn().getData()));
+ PhysicalLocator plRemote = getPhysicalLocatorFromUUID((tunnel.getRemoteColumn().getData()));
+ if(plLocal != null && plRemote != null) {
+ InstanceIdentifier<TerminationPoint> localTpPath = HwvtepSouthboundMapper.createInstanceIdentifier(
+ client.getInstanceIdentifier(), plLocal);
+ InstanceIdentifier<TerminationPoint> remoteTpPath = HwvtepSouthboundMapper.createInstanceIdentifier(
+ client.getInstanceIdentifier(), plRemote);
+ result = HwvtepSouthboundMapper.createInstanceIdentifier(psIid, localTpPath, remoteTpPath);
+ }
+ return result;
+ }
+
+ private PhysicalLocator getPhysicalLocatorFromUUID(UUID uuid) {
+ PhysicalLocator pLoc = getOvsdbConnectionInstance().getDeviceInfo().getPhysicalLocator(uuid);
+ if(pLoc == null) {
+ LOG.trace("Available PhysicalLocators: ",
+ getOvsdbConnectionInstance().getDeviceInfo().getPhysicalLocators());
+ }
+ return pLoc;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+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.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
+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.PhysicalSwitch;
+import org.opendaylight.ovsdb.schema.hardwarevtep.Tunnel;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorRef;
+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.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdLocalConfigs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdLocalConfigsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParamsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdRemoteConfigsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdStatusBuilder;
+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.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+
+public class HwvtepTunnelUpdateCommand extends AbstractTransactionCommand {
+
+ private static final Logger LOG = LoggerFactory.getLogger(HwvtepTunnelUpdateCommand.class);
+ private Map<UUID, Tunnel> updatedTunnelRows;
+
+ public HwvtepTunnelUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ super(key, updates, dbSchema);
+ try {
+ updatedTunnelRows = TyperUtils.extractRowsUpdated(Tunnel.class, getUpdates(), getDbSchema());
+ } catch (IllegalArgumentException e) {
+ LOG.debug("Tunnel Table not supported on this HWVTEP device", e.getMessage());
+ }
+ }
+
+ @Override
+ public void execute(ReadWriteTransaction transaction) {
+ if(updatedTunnelRows != null && !updatedTunnelRows.isEmpty()) {
+ for (Tunnel tunnel : updatedTunnelRows.values()) {
+ try {
+ updateTunnel(transaction, tunnel);
+ } catch (Exception e) {
+ LOG.warn("Exception updating tunnel {}", tunnel, e);
+ }
+ }
+ }
+ }
+
+ private void updateTunnel(ReadWriteTransaction transaction, Tunnel tunnel) {
+ Preconditions.checkNotNull(tunnel.getLocalColumn().getData());
+ Preconditions.checkNotNull(tunnel.getRemoteColumn().getData());
+ final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
+ Optional<Node> connection = HwvtepSouthboundUtil.readNode(transaction, connectionIId);
+ PhysicalSwitch pSwitch =
+ getOvsdbConnectionInstance().getDeviceInfo().getPhysicalSwitchForTunnel(tunnel.getUuid());
+ InstanceIdentifier<Node> psIid =
+ HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), pSwitch);
+ InstanceIdentifier<Tunnels> tunnelIid = getInstanceIdentifier(psIid, tunnel);
+ if (connection.isPresent() && pSwitch != null && tunnelIid != null) {
+ TunnelsBuilder tBuilder = new TunnelsBuilder();
+ tBuilder.setLocalLocatorRef(new HwvtepPhysicalLocatorRef(
+ getPhysicalLocatorRefFromUUID(psIid, (tunnel.getLocalColumn().getData()))));
+ tBuilder.setRemoteLocatorRef(new HwvtepPhysicalLocatorRef(
+ getPhysicalLocatorRefFromUUID(psIid, (tunnel.getRemoteColumn().getData()))));
+ tBuilder.setTunnelUuid(new Uuid(tunnel.getUuid().toString()));
+ setBfdLocalConfigs(tBuilder, tunnel);
+ setBfdRemoteConfigs(tBuilder, tunnel);
+ setBfdParams(tBuilder, tunnel);
+ setBfdStatus(tBuilder, tunnel);
+ Tunnels updatedTunnel = tBuilder.build();
+ LOG.trace("Built with the intent to store tunnel data {}", updatedTunnel);
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, tunnelIid, updatedTunnel);
+ // TODO: Deletion of Tunnel BFD config and params
+ } else {
+ LOG.warn("Insuficient information. Unable to update tunnel {}", tunnel.getUuid());
+ }
+ }
+
+ private void setBfdLocalConfigs(TunnelsBuilder tBuilder, Tunnel tunnel) {
+ Map<String, String> localConfigs = tunnel.getBfdConfigLocalColumn().getData();
+ if(localConfigs != null && !localConfigs.isEmpty()) {
+ Set<String> localConfigKeys = localConfigs.keySet();
+ List<BfdLocalConfigs> localConfigsList = new ArrayList<>();
+ String localConfigValue = null;
+ for(String localConfigKey: localConfigKeys) {
+ localConfigValue = localConfigs.get(localConfigKey);
+ if(localConfigValue != null && localConfigKey != null) {
+ localConfigsList.add(new BfdLocalConfigsBuilder()
+ .setBfdLocalConfigKey(localConfigKey)
+ .setBfdLocalConfigValue(localConfigValue)
+ .build());
+ }
+ }
+ tBuilder.setBfdLocalConfigs(localConfigsList);
+ }
+ }
+
+ private void setBfdRemoteConfigs(TunnelsBuilder tBuilder, Tunnel tunnel) {
+ Map<String, String> remoteConfigs = tunnel.getBfdConfigRemoteColumn().getData();
+ if(remoteConfigs != null && !remoteConfigs.isEmpty()) {
+ Set<String> remoteConfigKeys = remoteConfigs.keySet();
+ List<BfdRemoteConfigs> remoteConfigsList = new ArrayList<>();
+ String remoteConfigValue = null;
+ for(String remoteConfigKey: remoteConfigKeys) {
+ remoteConfigValue = remoteConfigs.get(remoteConfigKey);
+ if(remoteConfigValue != null && remoteConfigKey != null) {
+ remoteConfigsList.add(new BfdRemoteConfigsBuilder()
+ .setBfdRemoteConfigKey(remoteConfigKey)
+ .setBfdRemoteConfigValue(remoteConfigValue)
+ .build());
+ }
+ }
+ tBuilder.setBfdRemoteConfigs(remoteConfigsList);
+ }
+ }
+
+
+ private void setBfdParams(TunnelsBuilder tBuilder, Tunnel tunnel) {
+ Map<String, String> params = tunnel.getBfdParamsColumn().getData();
+ if(params != null && !params.isEmpty()) {
+ Set<String> paramKeys = params.keySet();
+ List<BfdParams> paramsList = new ArrayList<>();
+ String paramValue = null;
+ for(String paramKey: paramKeys) {
+ paramValue = params.get(paramKey);
+ if(paramValue != null && paramKey != null) {
+ paramsList.add(new BfdParamsBuilder()
+ .setBfdParamKey(paramKey)
+ .setBfdParamValue(paramValue)
+ .build());
+ }
+ }
+ tBuilder.setBfdParams(paramsList);
+ }
+ }
+
+ private void setBfdStatus(TunnelsBuilder tBuilder, Tunnel tunnel) {
+ Map<String, String> status = tunnel.getBfdStatusColumn().getData();
+ if(status != null && !status.isEmpty()) {
+ Set<String> paramKeys = status.keySet();
+ List<BfdStatus> statusList = new ArrayList<>();
+ String paramValue = null;
+ for(String paramKey: paramKeys) {
+ paramValue = status.get(paramKey);
+ if(paramValue != null && paramKey != null) {
+ statusList.add(new BfdStatusBuilder()
+ .setBfdStatusKey(paramKey)
+ .setBfdStatusValue(paramValue)
+ .build());
+ }
+ }
+ tBuilder.setBfdStatus(statusList);
+ }
+ }
+
+ private InstanceIdentifier<Tunnels> getInstanceIdentifier(InstanceIdentifier<Node> psIid, Tunnel tunnel) {
+ InstanceIdentifier<Tunnels> result = null;
+ InstanceIdentifier<TerminationPoint> localTpPath =
+ getPhysicalLocatorRefFromUUID(getOvsdbConnectionInstance().getInstanceIdentifier(),
+ (tunnel.getLocalColumn().getData()));
+ InstanceIdentifier<TerminationPoint> remoteTpPath =
+ getPhysicalLocatorRefFromUUID(getOvsdbConnectionInstance().getInstanceIdentifier(),
+ (tunnel.getRemoteColumn().getData()));
+ if(remoteTpPath != null && localTpPath != null ) {
+ result = HwvtepSouthboundMapper.createInstanceIdentifier(psIid, localTpPath, remoteTpPath);
+ }
+ return result;
+ }
+
+ private InstanceIdentifier<TerminationPoint> getPhysicalLocatorRefFromUUID(InstanceIdentifier<Node> nodeIid,
+ UUID uuid) {
+ PhysicalLocator pLoc = getOvsdbConnectionInstance().getDeviceInfo().getPhysicalLocator(uuid);
+ if(pLoc == null) {
+ LOG.trace("Available PhysicalLocators: ",
+ getOvsdbConnectionInstance().getDeviceInfo().getPhysicalLocators());
+ return null;
+ }
+ return HwvtepSouthboundMapper.createInstanceIdentifier(nodeIid, pLoc);
+ }
+
+}
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;
-public class UcastMacsLocalUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepUcastMacsLocalUpdateCommand extends AbstractTransactionCommand {
private Map<UUID, UcastMacsLocal> updatedUMacsLocalRows;
private Map<UUID, PhysicalLocator> updatedPLocRows;
- public UcastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepUcastMacsLocalUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedUMacsLocalRows = TyperUtils.extractRowsUpdated(UcastMacsLocal.class, getUpdates(), getDbSchema());
updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());
import com.google.common.base.Optional;
-public class UcastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
+public class HwvtepUcastMacsRemoteUpdateCommand extends AbstractTransactionCommand {
private final Map<UUID, UcastMacsRemote> updatedUMacsRemoteRows;
private final Map<UUID, PhysicalLocator> updatedPLocRows;
- public UcastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+ public HwvtepUcastMacsRemoteUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
super(key, updates, dbSchema);
updatedUMacsRemoteRows = TyperUtils.extractRowsUpdated(UcastMacsRemote.class, getUpdates(), getDbSchema());
updatedPLocRows = TyperUtils.extractRowsUpdated(PhysicalLocator.class, getUpdates(), getDbSchema());