use of org.opendaylight.genius.infra.ManagedNewTransactionRunner in project genius by opendaylight.
the class HwVTEPConfigRemoveHelper method removeConfiguration.
public static List<ListenableFuture<Void>> removeConfiguration(ManagedNewTransactionRunner txRunner, Interface interfaceOld, InstanceIdentifier<Node> physicalSwitchNodeId, InstanceIdentifier<Node> globalNodeId) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
LOG.info("removing hwvtep configuration for {}", interfaceOld.getName());
if (globalNodeId != null) {
IfTunnel ifTunnel = interfaceOld.getAugmentation(IfTunnel.class);
// removeTunnelTableEntry(defaultOperShardTransaction, ifTunnel, physicalSwitchNodeId);
// Topology configuration shard
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> removeTerminationEndPoint(tx, ifTunnel, globalNodeId)));
// Default operational shard
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
InterfaceManagerCommonUtils.deleteStateEntry(interfaceOld.getName(), tx);
InterfaceMetaUtils.removeTunnelToInterfaceMap(physicalSwitchNodeId, tx, ifTunnel);
}));
}
return futures;
}
use of org.opendaylight.genius.infra.ManagedNewTransactionRunner in project genius by opendaylight.
the class HwVTEPInterfaceConfigUpdateHelper method updateBfdMonitoring.
/*
* BFD monitoring interval and enable/disable attributes can be modified
*/
public static List<ListenableFuture<Void>> updateBfdMonitoring(ManagedNewTransactionRunner txRunner, InstanceIdentifier<Node> globalNodeId, InstanceIdentifier<Node> physicalSwitchId, IfTunnel ifTunnel) {
TunnelsBuilder tunnelsBuilder = new TunnelsBuilder();
InstanceIdentifier<TerminationPoint> localTEPInstanceIdentifier = SouthboundUtils.createTEPInstanceIdentifier(globalNodeId, ifTunnel.getTunnelSource());
InstanceIdentifier<TerminationPoint> remoteTEPInstanceIdentifier = SouthboundUtils.createTEPInstanceIdentifier(globalNodeId, ifTunnel.getTunnelDestination());
InstanceIdentifier<Tunnels> tunnelsInstanceIdentifier = SouthboundUtils.createTunnelsInstanceIdentifier(physicalSwitchId, localTEPInstanceIdentifier, remoteTEPInstanceIdentifier);
LOG.debug("updating bfd monitoring parameters for the hwvtep {}", tunnelsInstanceIdentifier);
tunnelsBuilder.setKey(new TunnelsKey(new HwvtepPhysicalLocatorRef(localTEPInstanceIdentifier), new HwvtepPhysicalLocatorRef(remoteTEPInstanceIdentifier)));
List<BfdParams> bfdParams = new ArrayList<>();
SouthboundUtils.fillBfdParameters(bfdParams, ifTunnel);
tunnelsBuilder.setBfdParams(bfdParams);
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.merge(LogicalDatastoreType.CONFIGURATION, tunnelsInstanceIdentifier, tunnelsBuilder.build(), WriteTransaction.CREATE_MISSING_PARENTS)));
}
use of org.opendaylight.genius.infra.ManagedNewTransactionRunner in project genius by opendaylight.
the class FlowBasedServicesUtils method installLportIngressFlow.
public static void installLportIngressFlow(BigInteger dpId, long portNo, Interface iface, List<ListenableFuture<Void>> futures, ManagedNewTransactionRunner txRunner, int lportTag) {
int vlanId = 0;
boolean isVlanTransparent = false;
IfL2vlan l2vlan = iface.getAugmentation(IfL2vlan.class);
if (l2vlan != null) {
vlanId = l2vlan.getVlanId() == null ? 0 : l2vlan.getVlanId().getValue();
isVlanTransparent = l2vlan.getL2vlanMode() == IfL2vlan.L2vlanMode.Transparent;
}
int instructionKey = 0;
List<Instruction> instructions = new ArrayList<>();
final SplitHorizon splitHorizon = iface.getAugmentation(SplitHorizon.class);
boolean overrideSplitHorizonProtection = splitHorizon != null && splitHorizon.isOverrideSplitHorizonProtection();
int actionKey = -1;
List<Action> actions = new ArrayList<>();
if (vlanId != 0 && !isVlanTransparent) {
actions.add(MDSALUtil.createPopVlanAction(++actionKey));
}
if (overrideSplitHorizonProtection) {
actions.add(MDSALUtil.createNxOfInPortAction(++actionKey, 0));
}
if (!actions.isEmpty()) {
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, instructionKey++));
}
BigInteger metadata = MetaDataUtil.getMetaDataForLPortDispatcher(lportTag, (short) 0, BigInteger.ZERO, isExternal(iface));
BigInteger metadataMask = MetaDataUtil.getMetaDataMaskForLPortDispatcher(MetaDataUtil.METADATA_MASK_LPORT_TAG_SH_FLAG);
instructions.add(MDSALUtil.buildAndGetWriteMetadaInstruction(metadata, metadataMask, instructionKey++));
instructions.add(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.LPORT_DISPATCHER_TABLE, instructionKey++));
int priority = isVlanTransparent ? 1 : vlanId == 0 ? IfmConstants.FLOW_PRIORITY_FOR_UNTAGGED_VLAN : IfmConstants.FLOW_HIGH_PRIORITY;
String flowRef = getFlowRef(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, dpId, iface.getName());
List<MatchInfo> matches = getMatchInfoForVlanPortAtIngressTable(dpId, portNo, iface);
Flow ingressFlow = MDSALUtil.buildFlowNew(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, flowRef, priority, flowRef, 0, 0, NwConstants.VLAN_TABLE_COOKIE, matches, instructions);
LOG.debug("Installing ingress flow {} for {}", flowRef, iface.getName());
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> installFlow(dpId, ingressFlow, tx)));
}
use of org.opendaylight.genius.infra.ManagedNewTransactionRunner in project genius by opendaylight.
the class FlowBasedServicesUtils method removeIngressFlow.
public static void removeIngressFlow(String interfaceName, BigInteger dpId, ManagedNewTransactionRunner txRunner, List<ListenableFuture<Void>> futures) {
if (dpId == null) {
return;
}
LOG.debug("Removing Ingress Flows for {}", interfaceName);
futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
String flowKeyStr = getFlowRef(IfmConstants.VLAN_INTERFACE_INGRESS_TABLE, dpId, interfaceName);
FlowKey flowKey = new FlowKey(new FlowId(flowKeyStr));
Node nodeDpn = buildInventoryDpnNode(dpId);
InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(NwConstants.VLAN_INTERFACE_INGRESS_TABLE)).child(Flow.class, flowKey).build();
tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
}));
}
use of org.opendaylight.genius.infra.ManagedNewTransactionRunner in project genius by opendaylight.
the class HwVTEPInterfaceStateUpdateHelper method startBfdMonitoring.
public static List<ListenableFuture<Void>> startBfdMonitoring(ManagedNewTransactionRunner txRunner, InstanceIdentifier<Tunnels> tunnelsInstanceIdentifier, Tunnels tunnelsNew) {
LOG.debug("starting bfd monitoring for the hwvtep {}", tunnelsInstanceIdentifier);
TunnelsBuilder tunnelsBuilder = new TunnelsBuilder();
tunnelsBuilder.setKey(new TunnelsKey(tunnelsNew.getLocalLocatorRef(), tunnelsNew.getRemoteLocatorRef()));
tunnelsBuilder.setLocalLocatorRef(tunnelsNew.getLocalLocatorRef());
tunnelsBuilder.setRemoteLocatorRef(tunnelsNew.getLocalLocatorRef());
List<BfdParams> bfdParams = new ArrayList<>();
SouthboundUtils.fillBfdParameters(bfdParams, null);
tunnelsBuilder.setBfdParams(bfdParams);
return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> tx.put(LogicalDatastoreType.CONFIGURATION, tunnelsInstanceIdentifier, tunnelsBuilder.build(), WriteTransaction.CREATE_MISSING_PARENTS)));
}
Aggregations