use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getTunnelType.
@Override
public ListenableFuture<GetTunnelTypeOutput> getTunnelType(GetTunnelTypeInput input) {
String interfaceName = input.getIntfName();
InterfaceKey interfaceKey = new InterfaceKey(interfaceName);
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
if (interfaceInfo == null) {
throw new IllegalArgumentException(String.format("Retrieval of Tunnel Type for the key {%s} failed due to missing Interface in Config DataStore", interfaceName));
}
if (Tunnel.class.equals(interfaceInfo.getType())) {
IfTunnel tnl = interfaceInfo.getAugmentation(IfTunnel.class);
Class<? extends TunnelTypeBase> tunType = tnl.getTunnelInterfaceType();
return Futures.immediateFuture(new GetTunnelTypeOutputBuilder().setTunnelType(tunType).build());
} else {
throw new IllegalArgumentException("Retrieval of interface type failed for key: " + interfaceName);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class InterfaceManagerServiceImpl method getEndpointIpForDpn.
@Override
public ListenableFuture<GetEndpointIpForDpnOutput> getEndpointIpForDpn(GetEndpointIpForDpnInput input) {
BridgeEntryKey bridgeEntryKey = new BridgeEntryKey(input.getDpid());
InstanceIdentifier<BridgeEntry> bridgeEntryInstanceIdentifier = InterfaceMetaUtils.getBridgeEntryIdentifier(bridgeEntryKey);
BridgeEntry bridgeEntry = interfaceMetaUtils.getBridgeEntryFromConfigDS(bridgeEntryInstanceIdentifier);
// local ip of any of the bridge interface entry will be the dpn end
// point ip
BridgeInterfaceEntry bridgeInterfaceEntry = bridgeEntry.getBridgeInterfaceEntry().get(0);
InterfaceKey interfaceKey = new InterfaceKey(bridgeInterfaceEntry.getInterfaceName());
Interface interfaceInfo = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
IfTunnel tunnel = interfaceInfo.getAugmentation(IfTunnel.class);
return Futures.immediateFuture(new GetEndpointIpForDpnOutputBuilder().setLocalIps(Collections.singletonList(tunnel.getTunnelSource())).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel in project genius by opendaylight.
the class HwVTEPConfigRemoveHelper method removeTerminationEndPoint.
private static void removeTerminationEndPoint(WriteTransaction transaction, IfTunnel ifTunnel, InstanceIdentifier<Node> globalNodeId) {
LOG.info("removing remote termination end point {}", ifTunnel.getTunnelDestination());
TerminationPointKey tpKey = SouthboundUtils.getTerminationPointKey(ifTunnel.getTunnelDestination().getIpv4Address().getValue());
InstanceIdentifier<TerminationPoint> tpPath = SouthboundUtils.createInstanceIdentifier(globalNodeId, tpKey);
transaction.delete(LogicalDatastoreType.CONFIGURATION, tpPath);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel 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.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel 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)));
}
Aggregations