use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey in project genius by opendaylight.
the class HwVtepTunnelsStateHandler method resetMonitoringTask.
// tunnelKey, nodeId, topologyId are initialized to null and immediately passed to getTunnelIdentifier which
// FindBugs as a "Load of known null value" violation. Not sure sure what the intent...
@SuppressFBWarnings("NP_LOAD_OF_KNOWN_NULL_VALUE")
void resetMonitoringTask(boolean isEnable) {
// TODO: get the corresponding hwvtep tunnel from the sourceInterface
// once InterfaceMgr implements renderer for HWVTEP VXLAN tunnels
// tunnelKey, nodeId, topologyId are initialized to null and immediately passed to getTunnelIdentifier which
// FindBugs flags as a "Load of known null value" violation. Not sure sure what the intent...
TunnelsKey tunnelKey = null;
String nodeId = null;
String topologyId = null;
Optional<Tunnels> tunnelsOptional = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, getTunnelIdentifier(topologyId, nodeId, tunnelKey));
if (!tunnelsOptional.isPresent()) {
LOG.warn("Tunnel {} is not present on the Node {}. So not disabling the BFD monitoring", tunnelKey, nodeId);
return;
}
Tunnels tunnel = tunnelsOptional.get();
List<BfdParams> tunnelBfdParams = tunnel.getBfdParams();
if (tunnelBfdParams == null || tunnelBfdParams.isEmpty()) {
LOG.debug("there is no bfd params available for the tunnel {}", tunnel);
return;
}
Iterator<BfdParams> tunnelBfdParamsIterator = tunnelBfdParams.iterator();
while (tunnelBfdParamsIterator.hasNext()) {
BfdParams bfdParam = tunnelBfdParamsIterator.next();
if (bfdParam.getBfdParamKey().equals(AlivenessMonitorConstants.BFD_PARAM_ENABLE)) {
tunnelBfdParamsIterator.remove();
break;
}
}
setBfdParamForEnable(tunnelBfdParams, isEnable);
Tunnels tunnelWithBfdReset = new TunnelsBuilder().setKey(tunnelKey).setBfdParams(tunnelBfdParams).build();
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, getTunnelIdentifier(topologyId, nodeId, tunnelKey), tunnelWithBfdReset);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey 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)));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical._switch.attributes.TunnelsKey in project genius by opendaylight.
the class SouthboundUtils method createTunnelsInstanceIdentifier.
public static InstanceIdentifier<Tunnels> createTunnelsInstanceIdentifier(InstanceIdentifier<Node> nodeId, InstanceIdentifier<TerminationPoint> localTEPInstanceIdentifier, InstanceIdentifier<TerminationPoint> remoteTEPInstanceIdentifier) {
TunnelsKey tunnelsKey = new TunnelsKey(new HwvtepPhysicalLocatorRef(localTEPInstanceIdentifier), new HwvtepPhysicalLocatorRef(remoteTEPInstanceIdentifier));
InstanceIdentifier<Tunnels> tunnelInstanceId = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(HWVTEP_TOPOLOGY_ID)).child(Node.class, new NodeKey(nodeId.firstKeyOf(Node.class))).augmentation(PhysicalSwitchAugmentation.class).child(Tunnels.class, tunnelsKey).build();
return tunnelInstanceId;
}
Aggregations