use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder in project netvirt by opendaylight.
the class ExternalRoutersListener method getTunnelInterfaceName.
protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
try {
Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
tunType = TunnelTypeGre.class;
result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
} catch (InterruptedException | ExecutionException | NullPointerException e) {
LOG.error("getTunnelInterfaceName : Exception when getting tunnel interface Id for tunnel " + "between {} and {}", srcDpId, dstDpId, e);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder in project netvirt by opendaylight.
the class ElanItmUtils method getInternalTunnelItmEgressAction.
/**
* Builds the list of actions to be taken when sending the packet over an internal VxLAN tunnel interface, such
* as setting the serviceTag/segmentationID on the VNI field of the VxLAN header, setting the vlanId if it proceeds
* and output the packet over the right port.
*
* @param sourceDpnId
* Dpn where the tunnelInterface is located
* @param destinationDpnId
* Dpn where the packet must be sent to. It is used here in order
* to select the right tunnel interface.
* @param tunnelKey
* Tunnel key to be sent on the VxLAN header.
* @return the internal itm egress action
*/
public List<Action> getInternalTunnelItmEgressAction(BigInteger sourceDpnId, BigInteger destinationDpnId, long tunnelKey) {
List<Action> result = Collections.emptyList();
LOG.trace("In getInternalItmEgressAction Action source {}, destination {}, serviceTag/Vni {}", sourceDpnId, destinationDpnId, tunnelKey);
Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
GetTunnelInterfaceNameInput input = new GetTunnelInterfaceNameInputBuilder().setDestinationDpid(destinationDpnId).setSourceDpid(sourceDpnId).setTunnelType(tunType).build();
Future<RpcResult<GetTunnelInterfaceNameOutput>> output = itmRpcService.getTunnelInterfaceName(input);
try {
if (output.get().isSuccessful()) {
GetTunnelInterfaceNameOutput tunnelInterfaceNameOutput = output.get().getResult();
String tunnelIfaceName = tunnelInterfaceNameOutput.getInterfaceName();
LOG.info("Received tunnelInterfaceName from getTunnelInterfaceName RPC {}", tunnelIfaceName);
result = buildTunnelItmEgressActions(tunnelIfaceName, tunnelKey);
} else {
LOG.trace("Tunnel interface doesn't exist between srcDpId {} dstDpId {}", sourceDpnId, destinationDpnId);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error in RPC call getTunnelInterfaceName {}", e);
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder in project genius by opendaylight.
the class ItmManagerRpcServiceTest method setUp.
@Before
public void setUp() throws Exception {
deviceVteps = new DeviceVtepsBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setKey(new DeviceVtepsKey(ItmTestConstants.IP_ADDRESS_3, ItmTestConstants.SOURCE_DEVICE)).setNodeId(ItmTestConstants.SOURCE_DEVICE).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
deviceVtepsList.add(deviceVteps);
stringList.add(ItmTestConstants.SOURCE_DEVICE);
dpId1List.add(ItmTestConstants.DP_ID_1);
stringList.add(ItmTestConstants.SOURCE_DEVICE_2);
trunkInterfaceName = ItmUtils.getTrunkInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME, String.valueOf(ItmTestConstants.IP_ADDRESS_3.getValue()), String.valueOf(ItmTestConstants.IP_ADDRESS_3.getValue()), ItmTestConstants.TUNNEL_TYPE_VXLAN.getName());
interfaceIdentifier = ItmUtils.buildId(trunkInterfaceName);
tunnelEndPointsVxlan = new TunnelEndPointsBuilder().setVLANID(ItmTestConstants.VLAN_ID).setPortname(ItmTestConstants.PORT_NAME_1).setIpAddress(ItmTestConstants.IP_ADDRESS_3).setGwIpAddress(ItmTestConstants.GTWY_IP_1).setInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).setTzMembership(ItmUtils.createTransportZoneMembership(ItmTestConstants.TZ_NAME)).setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setSubnetMask(ItmTestConstants.IP_PREFIX_TEST).setKey(new TunnelEndPointsKey(ItmTestConstants.IP_ADDRESS_3, ItmTestConstants.PORT_NAME_1, ItmTestConstants.TUNNEL_TYPE_VXLAN, ItmTestConstants.VLAN_ID)).build();
tunnelEndPointsListVxlan.add(tunnelEndPointsVxlan);
dpntePsInfoVxlan = new DPNTEPsInfoBuilder().setDPNID(ItmTestConstants.DP_ID_1).setKey(new DPNTEPsInfoKey(ItmTestConstants.DP_ID_1)).setUp(true).setTunnelEndPoints(tunnelEndPointsListVxlan).build();
cfgdDpnListVxlan.add(dpntePsInfoVxlan);
dpnEndpoints = new DpnEndpointsBuilder().setDPNTEPsInfo(cfgdDpnListVxlan).build();
internalTunnel = new InternalTunnelBuilder().setTunnelInterfaceNames(Collections.singletonList(ItmTestConstants.PARENT_INTERFACE_NAME)).setDestinationDPN(ItmTestConstants.DP_ID_2).setSourceDPN(ItmTestConstants.DP_ID_1).setTransportType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setKey(new InternalTunnelKey(ItmTestConstants.DP_ID_2, ItmTestConstants.DP_ID_1, ItmTestConstants.TUNNEL_TYPE_VXLAN)).build();
getExternalInterfaceNameInput = new GetInternalOrExternalInterfaceNameInputBuilder().setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setSourceDpid(ItmTestConstants.DP_ID_1).setTunnelType(ItmTestConstants.TUNNEL_TYPE_MPLS_OVER_GRE).build();
getInternalInterfaceNameInput = new GetInternalOrExternalInterfaceNameInputBuilder().setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setSourceDpid(ItmTestConstants.DP_ID_1).setTunnelType(ItmTestConstants.TUNNEL_TYPE_MPLS_OVER_GRE).build();
addExternalTunnelEndpointInput = new AddExternalTunnelEndpointInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).build();
addL2GwDeviceInput = new AddL2GwDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(ItmTestConstants.SOURCE_DEVICE).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
deleteL2GwDeviceInput = new DeleteL2GwDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(ItmTestConstants.SOURCE_DEVICE).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
addL2GwMlagDeviceInput = new AddL2GwMlagDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(stringList).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
deleteL2GwMlagDeviceInput = new DeleteL2GwMlagDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(stringList).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
buildExternalTunnelFromDpnsInput = new BuildExternalTunnelFromDpnsInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setDpnId(dpId1List).build();
removeExternalTunnelFromDpnsInput = new RemoveExternalTunnelFromDpnsInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setDpnId(dpId1List).build();
removeExternalTunnelEndpointInput = new RemoveExternalTunnelEndpointInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).build();
getTunnelInterfaceNameInput = new GetTunnelInterfaceNameInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setSourceDpid(ItmTestConstants.DP_ID_1).setDestinationDpid(ItmTestConstants.DP_ID_2).build();
getExternalTunnelInterfaceNameInput = new GetExternalTunnelInterfaceNameInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationNode(ItmTestConstants.DESTINATION_DEVICE).setSourceNode(ItmTestConstants.SOURCE_DEVICE).build();
iface = ItmUtils.buildTunnelInterface(ItmTestConstants.DP_ID_1, trunkInterfaceName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(ItmTestConstants.TUNNEL_TYPE_VXLAN), "Trunk Interface"), true, ItmTestConstants.TUNNEL_TYPE_VXLAN, tunnelEndPointsVxlan.getIpAddress(), ItmTestConstants.IP_ADDRESS_3, ItmTestConstants.GTWY_IP_1, tunnelEndPointsVxlan.getVLANID(), false, false, ItmTestConstants.MONITOR_PROTOCOL, null, false, null);
subnetsTest = new SubnetsBuilder().setGatewayIp(ItmTestConstants.GTWY_IP_1).setVlanId(ItmTestConstants.VLAN_ID).setKey(new SubnetsKey(ItmTestConstants.IP_PREFIX_TEST)).setDeviceVteps(deviceVtepsList).build();
subnetsList.add(subnetsTest);
transportZone = new TransportZoneBuilder().setZoneName(ItmTestConstants.TZ_NAME).setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setKey(new TransportZoneKey(ItmTestConstants.TZ_NAME)).setSubnets(subnetsList).build();
transportZoneList.add(transportZone);
transportZones = new TransportZonesBuilder().setTransportZone(transportZoneList).build();
// build external tunnel objects
externalTunnel = new ExternalTunnelBuilder().setSourceDevice(ItmTestConstants.DP_ID_1.toString()).setDestinationDevice(String.valueOf(ItmTestConstants.IP_ADDRESS_3.getValue())).setTransportType(TunnelTypeMplsOverGre.class).setTunnelInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).build();
externalTunnel2 = new ExternalTunnelBuilder().setSourceDevice(ItmTestConstants.SOURCE_DEVICE).setDestinationDevice(ItmTestConstants.DESTINATION_DEVICE).setTransportType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setTunnelInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).build();
getInternalOrExternalInterfaceNameOutput = new GetInternalOrExternalInterfaceNameOutputBuilder().setInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).build();
// commit external tunnel into config DS
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier, externalTunnel, dataBroker);
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier2, externalTunnel2, dataBroker);
// commit internal tunnel into config DS
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifier, internalTunnel, dataBroker);
// commit dpnEndpoints into config DS
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, dpnEndpointsIdentifier, dpnEndpoints, dataBroker);
// commit TZ into config DS
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier, transportZones, dataBroker);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder in project netvirt by opendaylight.
the class AbstractSnatService method getTunnelInterfaceName.
protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
try {
Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
tunType = TunnelTypeGre.class;
result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
} catch (InterruptedException | ExecutionException | NullPointerException e) {
LOG.error("getTunnelInterfaceName : Exception when getting tunnel interface Id for tunnel " + "between {} and {}", srcDpId, dstDpId);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder in project netvirt by opendaylight.
the class NaptSwitchHA method getTunnelInterfaceName.
protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
try {
Future<RpcResult<GetTunnelInterfaceNameOutput>> result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
tunType = TunnelTypeGre.class;
result = itmManager.getTunnelInterfaceName(new GetTunnelInterfaceNameInputBuilder().setSourceDpid(srcDpId).setDestinationDpid(dstDpId).setTunnelType(tunType).build());
rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
LOG.warn("getTunnelInterfaceName : RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("getTunnelInterfaceName :Exception when getting tunnel interface Id for tunnel between {} and {}", srcDpId, dstDpId, e);
}
LOG.error("getTunnelInterfaceName : Tunnel missing between dpn {}:{}", srcDpId, dstDpId);
return null;
}
Aggregations