use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project genius by opendaylight.
the class AlivenessMonitor method stopMonitoringTask.
private boolean stopMonitoringTask(Long monitorId, boolean interruptTask) {
Optional<MonitoringInfo> optInfo = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, getMonitoringInfoId(monitorId));
if (!optInfo.isPresent()) {
LOG.warn("There is no monitoring info present for monitor id {}", monitorId);
return false;
}
MonitoringInfo monitoringInfo = optInfo.get();
Optional<MonitorProfile> optProfile = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, getMonitorProfileId(monitoringInfo.getProfileId()));
EtherTypes protocolType = optProfile.get().getProtocolType();
if (protocolType == EtherTypes.Bfd) {
LOG.debug("disabling bfd for hwvtep tunnel montior id {}", monitorId);
((HwVtepTunnelsStateHandler) alivenessProtocolHandlerRegistry.get(protocolType)).resetMonitoringTask(false);
return true;
}
ScheduledFuture<?> scheduledFutureResult = monitoringTasks.get(monitorId);
if (scheduledFutureResult != null) {
scheduledFutureResult.cancel(interruptTask);
return true;
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel 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.model.match.types.rev131026.match.Tunnel in project genius by opendaylight.
the class InterfaceManagerTestUtil method updateTunnelMonitoringAttributes.
static void updateTunnelMonitoringAttributes(DataBroker dataBroker, String ifaceName) throws TransactionCommitFailedException {
InstanceIdentifier<Interface> tunnelInstanceIdentifier = IfmUtil.buildId(ifaceName);
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifaceName)).setName(ifaceName);
IfTunnel tunnel = new IfTunnelBuilder().setMonitorProtocol(TunnelMonitoringTypeBfd.class).setMonitorEnabled(true).build();
builder.addAugmentation(IfTunnel.class, tunnel);
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(CONFIGURATION, tunnelInstanceIdentifier, builder.build());
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project genius by opendaylight.
the class InterfaceManagerTestUtil method buildInterface.
static Interface buildInterface(String ifName, String desc, boolean enabled, Object ifType, String parentInterface, IfL2vlan.L2vlanMode l2vlanMode) {
InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType((Class<? extends InterfaceType>) ifType);
ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
builder.addAugmentation(ParentRefs.class, parentRefs);
if (ifType.equals(L2vlan.class)) {
IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
if (IfL2vlan.L2vlanMode.TrunkMember.equals(l2vlanMode)) {
ifL2vlanBuilder.setVlanId(new VlanId(100));
} else {
ifL2vlanBuilder.setVlanId(VlanId.getDefaultInstance("0"));
}
builder.addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
} else if (ifType.equals(IfTunnel.class)) {
IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(null).setTunnelGateway(null).setTunnelSource(null).setTunnelInterfaceType(null).build();
builder.addAugmentation(IfTunnel.class, tunnel);
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel in project genius by opendaylight.
the class RemoveExternalEndpoint method doExecute.
@SuppressWarnings({ "checkstyle:IllegalCatch", "checkstyle:RegexpSinglelineJava" })
@Override
protected Object doExecute() {
try {
LOG.debug("RemoveExternalEndpoint: destinationIP {} with tunnelType {}", destinationIp, tunnelType);
Class<? extends TunnelTypeBase> tunType;
if (tunnelType.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_VXLAN)) {
tunType = TunnelTypeVxlan.class;
} else if (tunnelType.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_GRE)) {
tunType = TunnelTypeGre.class;
} else if (tunnelType.equalsIgnoreCase(ITMConstants.TUNNEL_TYPE_MPLSoGRE)) {
tunType = TunnelTypeMplsOverGre.class;
} else {
System.out.println("Invalid tunnel-type " + tunnelType);
return null;
}
if (!itmProvider.validateIP(destinationIp)) {
System.out.println("Invalid IpAddress " + destinationIp);
return null;
}
IpAddress dcgwIPAddr = IpAddressBuilder.getDefaultInstance(destinationIp);
itmProvider.remExternalEndpoint(tunType, dcgwIPAddr);
} catch (IllegalArgumentException e) {
System.out.println(e.getMessage());
} catch (Exception e) {
System.out.println(e.getMessage());
LOG.error("Exception occurred during execution of command \"tep:configure-tunnelType\": ", e);
}
return null;
}
Aggregations