DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance();
RendererConfigRemoveWorker configWorker = new RendererConfigRemoveWorker(key, interfaceOld,
SouthboundUtils.createPhysicalSwitchInstanceIdentifier(nodeIdentifier.getNodeId()),
- SouthboundUtils.createGlobalNodeInstanceIdentifier(dataBroker,
- nodeIdentifier.getNodeId()));
+ SouthboundUtils.createGlobalNodeInstanceIdentifier(nodeIdentifier.getNodeId()));
coordinator.enqueueJob(interfaceOld.getName(), configWorker, IfmConstants.JOB_MAX_RETRIES);
}
}
DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance();
RendererConfigUpdateWorker configWorker = new RendererConfigUpdateWorker(key, interfaceNew,
SouthboundUtils.createPhysicalSwitchInstanceIdentifier(nodeIdentifier.getNodeId()),
- SouthboundUtils.createGlobalNodeInstanceIdentifier(dataBroker,
- nodeIdentifier.getNodeId()),
+ SouthboundUtils.createGlobalNodeInstanceIdentifier(nodeIdentifier.getNodeId()),
ifTunnel);
coordinator.enqueueJob(interfaceNew.getName(), configWorker, IfmConstants.JOB_MAX_RETRIES);
}
DataStoreJobCoordinator coordinator = DataStoreJobCoordinator.getInstance();
RendererConfigAddWorker configWorker = new RendererConfigAddWorker(key, interfaceNew,
SouthboundUtils.createPhysicalSwitchInstanceIdentifier(nodeIdentifier.getNodeId()),
- SouthboundUtils.createGlobalNodeInstanceIdentifier(dataBroker,
- nodeIdentifier.getNodeId()),
+ SouthboundUtils.createGlobalNodeInstanceIdentifier(nodeIdentifier.getNodeId()),
ifTunnel);
coordinator.enqueueJob(interfaceNew.getName(), configWorker, IfmConstants.JOB_MAX_RETRIES);
}
public static List<ListenableFuture<Void>> removeConfiguration(DataBroker dataBroker, Interface interfaceOld,
InstanceIdentifier<Node> globalNodeId, InstanceIdentifier<Node> physicalSwitchNodeId) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
- WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
+ WriteTransaction defaultOperShardTransaction = dataBroker.newWriteOnlyTransaction();
+ WriteTransaction topologyConfigShardTransaction = dataBroker.newWriteOnlyTransaction();
LOG.info("removing hwvtep configuration for {}", interfaceOld.getName());
if (globalNodeId != null) {
IfTunnel ifTunnel = interfaceOld.getAugmentation(IfTunnel.class);
- // removeTunnelTableEntry(transaction, ifTunnel,
- // physicalSwitchNodeId);
- removeTerminationEndPoint(transaction, ifTunnel, globalNodeId);
- InterfaceManagerCommonUtils.deleteStateEntry(interfaceOld.getName(), transaction);
- InterfaceMetaUtils.removeTunnelToInterfaceMap(physicalSwitchNodeId, transaction, ifTunnel);
+ //removeTunnelTableEntry(defaultOperShardTransaction, ifTunnel, physicalSwitchNodeId);
+ removeTerminationEndPoint(topologyConfigShardTransaction, ifTunnel, globalNodeId);
+ InterfaceManagerCommonUtils.deleteStateEntry(interfaceOld.getName(), defaultOperShardTransaction);
+ InterfaceMetaUtils.removeTunnelToInterfaceMap(physicalSwitchNodeId, defaultOperShardTransaction, ifTunnel);
}
- futures.add(transaction.submit());
+ futures.add(defaultOperShardTransaction.submit());
+ futures.add(topologyConfigShardTransaction.submit());
return futures;
}
LOG.info("adding hwvtep configuration for {}", interfaceNew.getName());
// create hwvtep through ovsdb plugin
- WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
- InterfaceMetaUtils.createTunnelToInterfaceMap(interfaceNew.getName(), physicalSwitchNodeId, transaction,
- ifTunnel);
+ WriteTransaction defaultOperShardTransaction = dataBroker.newWriteOnlyTransaction();
+ WriteTransaction topologyConfigShardTransaction = dataBroker.newWriteOnlyTransaction();
+ InterfaceMetaUtils.createTunnelToInterfaceMap(interfaceNew.getName(), physicalSwitchNodeId,
+ defaultOperShardTransaction, ifTunnel);
if (globalNodeId != null) {
- addTerminationPoints(transaction, futures, globalNodeId, ifTunnel);
- SouthboundUtils.addStateEntry(interfaceNew, interfaceNew.getAugmentation(IfTunnel.class), transaction);
- } else {
- LOG.debug("specified physical switch is not connected {}", physicalSwitchNodeId);
+ addTerminationPoints(topologyConfigShardTransaction, futures, globalNodeId,ifTunnel);
+ SouthboundUtils.addStateEntry(interfaceNew, interfaceNew.getAugmentation(IfTunnel.class),
+ defaultOperShardTransaction);
}
- futures.add(transaction.submit());
+ futures.add(defaultOperShardTransaction.submit());
+ futures.add(topologyConfigShardTransaction.submit());
return futures;
}
InstanceIdentifier<Node> physicalSwitchNodeId, InstanceIdentifier<Node> globalNodeId,
Interface interfaceNew, IfTunnel ifTunnel) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
- LOG.info("adding hwvtep configuration for {}", interfaceNew.getName());
+ LOG.info("updating hwvtep configuration for {}", interfaceNew.getName());
// Create hwvtep through OVSDB plugin
WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
public static final String TEP_PREFIX = "vxlan_over_ipv4:";
public static final String BFD_OP_STATE = "state";
public static final String BFD_STATE_UP = "up";
+ public static final String PS_NODE_ID_PREFIX = "/physicalswitch";
+
// BFD parameters
static final String BFD_PARAM_ENABLE = "enable";
static final String BFD_PARAM_MIN_RX = "min_rx";
return (InstanceIdentifier<Node>) physicalSwitchAugmentation.getManagedBy().getValue();
}
+ public static @Nullable InstanceIdentifier<Node> createGlobalNodeInstanceIdentifier(String psNodeIdString) {
+ String globalNodeIdStr;
+ try {
+ globalNodeIdStr = psNodeIdString.substring(0, psNodeIdString.indexOf(PS_NODE_ID_PREFIX));
+ } catch (StringIndexOutOfBoundsException ex) {
+ LOG.error("cannot determine global-node-id for the physical node {}", psNodeIdString);
+ return null;
+ }
+ NodeId globalNodeId = new NodeId(globalNodeIdStr);
+ InstanceIdentifier<Node> globalNodeInstanceId = InstanceIdentifier
+ .create(NetworkTopology.class)
+ .child(Topology.class, new TopologyKey(HWVTEP_TOPOLOGY_ID))
+ .child(Node.class,new NodeKey(globalNodeId));
+ return globalNodeInstanceId;
+ }
+
public static InstanceIdentifier<TerminationPoint> createTEPInstanceIdentifier(InstanceIdentifier<Node> nodeIid,
IpAddress ipAddress) {
TerminationPointKey localTEP = SouthboundUtils.getTerminationPointKey(ipAddress.getIpv4Address().getValue());