use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams in project genius by opendaylight.
the class HwVtepTunnelsStateHandler method startMonitoringTask.
@Override
public void startMonitoringTask(MonitoringInfo monitorInfo) {
EndpointType source = monitorInfo.getSource().getEndpointType();
if (source instanceof Interface) {
Interface intf = (Interface) source;
intf.getInterfaceName();
} else {
LOG.warn("Invalid source endpoint. Could not retrieve source interface to configure BFD");
return;
}
MonitorProfile profile;
long profileId = monitorInfo.getProfileId();
Optional<MonitorProfile> optProfile = alivenessMonitor.getMonitorProfile(profileId);
if (optProfile.isPresent()) {
profile = optProfile.get();
} else {
LOG.warn("No monitor profile associated with id {}. " + "Could not send Monitor packet for monitor-id {}", profileId, monitorInfo);
return;
}
// TODO: get the corresponding hwvtep tunnel from the sourceInterface
// once InterfaceMgr
// Implements renderer for hwvtep VXLAN tunnels
String tunnelLocalMacAddress = "<TODO>";
String tunnelLocalIpAddress = "<TODO>";
String tunnelRemoteMacAddress = "<TODO>";
List<BfdParams> bfdParams = new ArrayList<>();
fillBfdParams(bfdParams, profile);
List<BfdLocalConfigs> bfdLocalConfigs = new ArrayList<>();
fillBfdLocalConfigs(bfdLocalConfigs, tunnelLocalMacAddress, tunnelLocalIpAddress);
List<BfdRemoteConfigs> bfdRemoteConfigs = new ArrayList<>();
fillBfdRemoteConfigs(bfdRemoteConfigs, tunnelRemoteMacAddress);
// tunnelKey is initialized to null and passed to setKey which FindBugs flags as a
// "Load of known null value" violation. Not sure sure what the intent is...
// TunnelsKey tunnelKey = null;
Tunnels tunnelWithBfd = new TunnelsBuilder().setKey(/*tunnelKey*/
null).setBfdParams(bfdParams).setBfdLocalConfigs(bfdLocalConfigs).setBfdRemoteConfigs(bfdRemoteConfigs).build();
// TODO: get the following parameters from the interface and use it to
// update hwvtep datastore
// and not sure sure tunnels are creating immediately once interface mgr
// writes termination point
// into hwvtep datastore. if tunnels are not created during that time,
// then start monitoring has to
// be done as part of tunnel add DCN handling.
String topologyId = "";
String nodeId = "";
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, getTunnelIdentifier(topologyId, nodeId, new TunnelsKey(/*localRef*/
null, /*remoteRef*/
null)), tunnelWithBfd);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams 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.tunnel.attributes.BfdParams in project genius by opendaylight.
the class SouthboundUtils method addTerminationPoint.
private void addTerminationPoint(InstanceIdentifier<?> bridgeIid, String portName, int vlanId, Class<? extends InterfaceTypeBase> type, Map<String, String> options, IfTunnel ifTunnel) {
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
tpAugmentationBuilder.setName(portName);
if (type != null) {
tpAugmentationBuilder.setInterfaceType(type);
}
if (options != null) {
List<Options> optionsList = new ArrayList<>();
for (Map.Entry<String, String> entry : options.entrySet()) {
OptionsBuilder optionsBuilder = new OptionsBuilder();
optionsBuilder.setKey(new OptionsKey(entry.getKey()));
optionsBuilder.setOption(entry.getKey());
optionsBuilder.setValue(entry.getValue());
optionsList.add(optionsBuilder.build());
}
tpAugmentationBuilder.setOptions(optionsList);
}
if (vlanId != 0) {
tpAugmentationBuilder.setVlanMode(OvsdbPortInterfaceAttributes.VlanMode.Access);
tpAugmentationBuilder.setVlanTag(new VlanId(vlanId));
}
if (bfdMonitoringEnabled(ifTunnel)) {
if (isOfTunnel(ifTunnel)) {
LOG.warn("BFD Monitoring not supported for OFTunnels");
} else {
List<InterfaceBfd> bfdParams = getBfdParams(ifTunnel);
tpAugmentationBuilder.setInterfaceBfd(bfdParams);
}
}
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), portName);
tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid));
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
batchingUtils.write(tpIid, tpBuilder.build(), BatchingUtils.EntityType.TOPOLOGY_CONFIG);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.tunnel.attributes.BfdParams in project genius by opendaylight.
the class SouthboundUtils method updateBfdParamtersForTerminationPoint.
// Update is allowed only for tunnel monitoring attributes
public static void updateBfdParamtersForTerminationPoint(InstanceIdentifier<?> bridgeIid, IfTunnel ifTunnel, String portName, WriteTransaction transaction) {
InstanceIdentifier<TerminationPoint> tpIid = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), portName);
if (isOfTunnel(ifTunnel)) {
LOG.warn("BFD monitoring not supported for OFTunnels. Skipping BFD parameters for {}", portName);
return;
}
LOG.debug("update bfd parameters for interface {}", tpIid);
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
List<InterfaceBfd> bfdParams = getBfdParams(ifTunnel);
tpAugmentationBuilder.setInterfaceBfd(bfdParams);
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setKey(InstanceIdentifier.keyOf(tpIid));
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
transaction.merge(LogicalDatastoreType.CONFIGURATION, tpIid, tpBuilder.build(), true);
}
Aggregations