builder.setDpId(dpnId).setInterfaceName(interfaceName).setSpa(dhcpIpAddress).setSha(dhcpMacAddress)
.setLportTag(lportTag);
builder.setInstructions(ArpResponderUtil.getInterfaceInstructions(interfaceManager, interfaceName,
- dhcpIpAddress, dhcpMacAddress));
+ dhcpIpAddress, dhcpMacAddress, itmRpcService));
elanService.addExternalTunnelArpResponderFlow(builder.buildForInstallFlow(), elanInstanceName);
}
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
private final IInterfaceManager interfaceManager;
private final IElanService elanService;
private final DhcpPortCache dhcpPortCache;
+ private final ItmRpcService itmRpcService;
public DhcpInterfaceEventListener(DhcpManager dhcpManager, DataBroker dataBroker,
DhcpExternalTunnelManager dhcpExternalTunnelManager,
IInterfaceManager interfaceManager, IElanService elanService,
- DhcpPortCache dhcpPortCache, JobCoordinator jobCoordinator) {
+ DhcpPortCache dhcpPortCache, JobCoordinator jobCoordinator,
+ ItmRpcService itmRpcService) {
super(Interface.class, DhcpInterfaceEventListener.class);
this.dhcpManager = dhcpManager;
this.dataBroker = dataBroker;
this.elanService = elanService;
this.dhcpPortCache = dhcpPortCache;
this.jobCoordinator = jobCoordinator;
+ this.itmRpcService = itmRpcService;
registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
BigInteger dpnId = BigInteger.valueOf(MDSALUtil.getDpnIdFromPortName(nodeConnectorId));
DhcpInterfaceAddJob job = new DhcpInterfaceAddJob(dhcpManager, dhcpExternalTunnelManager, dataBroker,
- add, dpnId, interfaceManager, elanService);
+ add, dpnId, interfaceManager, elanService, itmRpcService);
jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(interfaceName), job, DhcpMConstants.RETRY_COUNT);
}
import org.opendaylight.netvirt.dhcpservice.api.DhcpMConstants;
import org.opendaylight.netvirt.elanmanager.api.IElanService;
import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet;
private final IElanService elanService;
private final JobCoordinator jobCoordinator;
private DhcpPortCache dhcpPortCache;
+ private final ItmRpcService itmRpcService;
private volatile int dhcpOptLeaseTime = 0;
private volatile String dhcpOptDefDomainName;
final DhcpserviceConfig config, final DataBroker dataBroker,
final DhcpExternalTunnelManager dhcpExternalTunnelManager, final IInterfaceManager interfaceManager,
@Named("elanService") IElanService ielanService, final DhcpPortCache dhcpPortCache,
- final JobCoordinator jobCoordinator) {
+ final JobCoordinator jobCoordinator, final ItmRpcService itmRpcService) {
this.mdsalUtil = mdsalApiManager;
this.neutronVpnService = neutronVpnManager;
this.config = config;
this.elanService = ielanService;
this.dhcpPortCache = dhcpPortCache;
this.jobCoordinator = jobCoordinator;
+ this.itmRpcService = itmRpcService;
configureLeaseDuration(DhcpMConstants.DEFAULT_LEASE_TIME);
}
LOG.trace("Netvirt DHCP Manager Init .... {}",config.isControllerDhcpEnabled());
if (config.isControllerDhcpEnabled()) {
dhcpInterfaceEventListener = new DhcpInterfaceEventListener(this, broker, dhcpExternalTunnelManager,
- interfaceManager, elanService, dhcpPortCache, jobCoordinator);
+ interfaceManager, elanService, dhcpPortCache, jobCoordinator, itmRpcService);
dhcpInterfaceConfigListener = new DhcpInterfaceConfigListener(broker, dhcpExternalTunnelManager, this,
jobCoordinator);
LOG.info("DHCP Service initialized");
import org.opendaylight.netvirt.elanmanager.api.IElanService;
import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports;
private final IInterfaceManager interfaceManager;
private final JobCoordinator jobCoordinator;
private final DhcpManager dhcpManager;
+ private final ItmRpcService itmRpcService;
@Inject
public DhcpNeutronPortListener(DataBroker db, DhcpExternalTunnelManager dhcpExternalTunnelManager,
@Named("elanService") IElanService ielanService, IInterfaceManager interfaceManager,
- DhcpserviceConfig config, final JobCoordinator jobCoordinator, DhcpManager dhcpManager) {
+ DhcpserviceConfig config, final JobCoordinator jobCoordinator, DhcpManager dhcpManager,
+ ItmRpcService itmRpcService) {
+
super(Port.class, DhcpNeutronPortListener.class);
this.dhcpExternalTunnelManager = dhcpExternalTunnelManager;
this.elanService = ielanService;
this.config = config;
this.jobCoordinator = jobCoordinator;
this.dhcpManager = dhcpManager;
+ this.itmRpcService = itmRpcService;
}
@PostConstruct
arpInput.getDpId());
ArpReponderInputBuilder builder = new ArpReponderInputBuilder(arpInput);
builder.setInstructions(ArpResponderUtil.getInterfaceInstructions(interfaceManager,
- arpInput.getInterfaceName(), arpInput.getSpa(), arpInput.getSha()));
+ arpInput.getInterfaceName(), arpInput.getSpa(), arpInput.getSha(), itmRpcService));
elanService.addArpResponderFlow(builder.buildForInstallFlow());
});
})));
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceFromIfIndexOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.network.AllocationPool;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
private final DhcpserviceConfig config;
private final DhcpAllocationPoolManager dhcpAllocationPoolMgr;
private final DataBroker broker;
+ private final ItmRpcService itmRpcService;
@Inject
public DhcpPktHandler(final DhcpManager dhcpManager,
final IInterfaceManager interfaceManager,
final DhcpserviceConfig config,
final DhcpAllocationPoolManager dhcpAllocationPoolMgr,
- final DataBroker dataBroker) {
+ final DataBroker dataBroker,
+ final ItmRpcService itmRpcService) {
this.interfaceManagerRpc = interfaceManagerRpc;
this.pktService = pktService;
this.dhcpExternalTunnelManager = dhcpExternalTunnelManager;
this.config = config;
this.dhcpAllocationPoolMgr = dhcpAllocationPoolMgr;
this.broker = dataBroker;
+ this.itmRpcService = itmRpcService;
}
//TODO: Handle this in a separate thread
}
private List<Action> getEgressAction(String interfaceName, BigInteger tunnelId) {
- List<Action> actions = null;
try {
- GetEgressActionsForInterfaceInputBuilder egressAction =
- new GetEgressActionsForInterfaceInputBuilder().setIntfName(interfaceName);
- if (tunnelId != null) {
+ if (interfaceManager.isItmDirectTunnelsEnabled() && tunnelId != null) {
+ GetEgressActionsForTunnelInputBuilder egressAction =
+ new GetEgressActionsForTunnelInputBuilder().setIntfName(interfaceName);
egressAction.setTunnelKey(tunnelId.longValue());
- }
- Future<RpcResult<GetEgressActionsForInterfaceOutput>> result =
- interfaceManagerRpc.getEgressActionsForInterface(egressAction.build());
- RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
- if (!rpcResult.isSuccessful()) {
- LOG.warn("RPC Call to Get egress actions for interface {} returned with Errors {}",
- interfaceName, rpcResult.getErrors());
+ RpcResult<GetEgressActionsForTunnelOutput> rpcResult =
+ itmRpcService.getEgressActionsForTunnel(egressAction.build()).get();
+ if (!rpcResult.isSuccessful()) {
+ LOG.warn("RPC Call to Get egress actions for interface {} returned with Errors {}",
+ interfaceName, rpcResult.getErrors());
+ } else {
+ return rpcResult.getResult().getAction();
+ }
} else {
- actions = rpcResult.getResult().getAction();
+ GetEgressActionsForInterfaceInputBuilder egressAction =
+ new GetEgressActionsForInterfaceInputBuilder().setIntfName(interfaceName);
+ if (tunnelId != null) {
+ egressAction.setTunnelKey(tunnelId.longValue());
+ }
+ Future<RpcResult<GetEgressActionsForInterfaceOutput>> result =
+ interfaceManagerRpc.getEgressActionsForInterface(egressAction.build());
+ RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
+ if (!rpcResult.isSuccessful()) {
+ LOG.warn("RPC Call to Get egress actions for interface {} returned with Errors {}",
+ interfaceName, rpcResult.getErrors());
+ } else {
+ return rpcResult.getResult().getAction();
+ }
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when egress actions for interface {}", interfaceName, e);
}
- return actions;
+ return Collections.emptyList();
}
}
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dhcpservice.api.rev150710.subnet.dhcp.port.data.SubnetToDhcpPort;
private final BigInteger dpnId;
private final IInterfaceManager interfaceManager;
private final IElanService elanService;
+ private final ItmRpcService itmRpcService;
public DhcpInterfaceAddJob(DhcpManager dhcpManager, DhcpExternalTunnelManager dhcpExternalTunnelManager,
DataBroker dataBroker, Interface interfaceAdd, BigInteger dpnId,
- IInterfaceManager interfaceManager, IElanService elanService) {
+ IInterfaceManager interfaceManager, IElanService elanService,
+ ItmRpcService itmRpcService) {
this.dhcpManager = dhcpManager;
this.dhcpExternalTunnelManager = dhcpExternalTunnelManager;
this.dataBroker = dataBroker;
this.dpnId = dpnId;
this.interfaceManager = interfaceManager;
this.elanService = elanService;
+ this.itmRpcService = itmRpcService;
}
@Override
builder.setDpId(dpnId).setInterfaceName(interfaceName).setSpa(subnetToDhcp.get().getPortFixedip())
.setSha(subnetToDhcp.get().getPortMacaddress()).setLportTag(interfaceAdd.getIfIndex());
builder.setInstructions(ArpResponderUtil.getInterfaceInstructions(interfaceManager, interfaceName,
- subnetToDhcp.get().getPortFixedip(), subnetToDhcp.get().getPortMacaddress()));
+ subnetToDhcp.get().getPortFixedip(), subnetToDhcp.get().getPortMacaddress(), itmRpcService));
elanService.addArpResponderFlow(builder.buildForInstallFlow());
return futures;
}
<artifactId>interfacemanager-api</artifactId>
<version>${genius.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>itm-api</artifactId>
+ <version>${genius.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>neutronvpn-api</artifactId>
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.add.group.input.buckets.bucket.action.action.NxActionResubmitRpcAddGroupCase;
* MacAddress for which ARP Response packet is to be generated
* @return List of ARP Responder Actions actions
*/
- public static List<Action> getActions(IInterfaceManager ifaceMgrRpcService, String ifName, String ipAddress,
- String macAddress) {
+ public static List<Action> getActions(IInterfaceManager ifaceMgrRpcService, ItmRpcService itmRpcService,
+ String ifName, String ipAddress, String macAddress,
+ boolean isTunnelInterface) {
AtomicInteger actionCounter = new AtomicInteger();
List<Action> actions = arpActions.apply(actionCounter, macAddress, ipAddress);
- actions.addAll(getEgressActionsForInterface(ifaceMgrRpcService, ifName, actionCounter.get()));
+ actions.addAll(getEgressActionsForInterface(ifaceMgrRpcService, itmRpcService, ifName, actionCounter.get(),
+ isTunnelInterface));
LOG.trace("Total Number of actions is {}", actionCounter);
return actions;
* Get instruction list for ARP responder flows.
*/
public static List<Instruction> getInterfaceInstructions(IInterfaceManager ifaceMgrRpcService, String interfaceName,
- String ipAddress, String macAddress) {
- List<Action> actions = ArpResponderUtil.getActions(ifaceMgrRpcService, interfaceName, ipAddress, macAddress);
+ String ipAddress, String macAddress, ItmRpcService itmRpcService) {
+ List<Action> actions = ArpResponderUtil.getActions(ifaceMgrRpcService, itmRpcService, interfaceName, ipAddress,
+ macAddress, false);
return Collections.singletonList(MDSALUtil.buildApplyActionsInstruction(actions));
}
* action needs to be replaced with goto instruction.
*/
public static List<Instruction> getExtInterfaceInstructions(IInterfaceManager ifaceMgrRpcService,
- String extInterfaceName, String ipAddress, String macAddress) {
+ ItmRpcService itmRpcService,
+ String extInterfaceName, String ipAddress,
+ String macAddress) {
AtomicInteger tableId = new AtomicInteger(-1);
List<Instruction> instructions = new ArrayList<>();
- List<Action> actions = getActions(ifaceMgrRpcService, extInterfaceName, ipAddress, macAddress);
+ List<Action> actions = getActions(ifaceMgrRpcService, itmRpcService, extInterfaceName, ipAddress, macAddress,
+ false);
actions.removeIf(v -> {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v
.getAction();
* Action Key
* @return List of Egress Actions
*/
- public static List<Action> getEgressActionsForInterface(IInterfaceManager ifaceMgrRpcService, String ifName,
- int actionCounter) {
- List<ActionInfo> actionInfos = ifaceMgrRpcService.getInterfaceEgressActions(ifName);
- AtomicInteger counter = new AtomicInteger(actionCounter);
- return actionInfos.stream().map(v -> v.buildAction(counter.getAndIncrement())).collect(Collectors.toList());
+ public static List<Action> getEgressActionsForInterface(IInterfaceManager ifaceMgrRpcService,
+ ItmRpcService itmRpcService, String ifName,
+ int actionCounter, boolean isTunnelInterface) {
+ if (isTunnelInterface && ifaceMgrRpcService.isItmDirectTunnelsEnabled()) {
+ try {
+ RpcResult result = itmRpcService.getEgressActionsForTunnel(new GetEgressActionsForTunnelInputBuilder()
+ .setIntfName(ifName).build()).get();
+ List<Action> listActions = new ArrayList<>();
+ if (!result.isSuccessful()) {
+ LOG.error("getEgressActionsForInterface: RPC Call to Get egress actions for interface {} "
+ + "returned with Errors {}", ifName, result.getErrors());
+ } else {
+ listActions = ((GetEgressActionsForTunnelOutput) result.getResult()).getAction();
+ }
+ return listActions;
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("getEgressActionsForInterface: Exception when egress actions for interface {}", ifName, e);
+ }
+ } else {
+ List<ActionInfo> actionInfos = ifaceMgrRpcService.getInterfaceEgressActions(ifName);
+ AtomicInteger counter = new AtomicInteger(actionCounter);
+ return actionInfos.stream().map(v -> v.buildAction(counter.getAndIncrement())).collect(Collectors.toList());
+ }
+ return Collections.emptyList();
}
/**
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameOutput;
private final DataBroker broker;
private final ItmRpcService itmRpcService;
private final OdlInterfaceRpcService interfaceManagerRpcService;
+ private final IInterfaceManager interfaceManager;
@Inject
- public ElanItmUtils(DataBroker broker, ItmRpcService itmRpcService,
- OdlInterfaceRpcService interfaceManagerRpcService) {
+ public ElanItmUtils(final DataBroker broker, final ItmRpcService itmRpcService,
+ final OdlInterfaceRpcService interfaceManagerRpcService, final IInterfaceManager interfaceManager) {
this.broker = broker;
this.itmRpcService = itmRpcService;
this.interfaceManagerRpcService = interfaceManagerRpcService;
+ this.interfaceManager = interfaceManager;
}
/**
*/
@SuppressWarnings("checkstyle:IllegalCatch")
public List<Action> buildItmEgressActions(String interfaceName, Long tunnelKey) {
- List<Action> result = Collections.emptyList();
try {
GetEgressActionsForInterfaceInput getEgressActInput = new GetEgressActionsForInterfaceInputBuilder()
.setIntfName(interfaceName).setTunnelKey(tunnelKey).build();
Future<RpcResult<GetEgressActionsForInterfaceOutput>> egressActionsOutputFuture = interfaceManagerRpcService
.getEgressActionsForInterface(getEgressActInput);
- if (egressActionsOutputFuture.get().isSuccessful()) {
- GetEgressActionsForInterfaceOutput egressActionsOutput = egressActionsOutputFuture.get().getResult();
- result = egressActionsOutput.getAction();
+
+ GetEgressActionsForTunnelInput getEgressActInputItm = new GetEgressActionsForTunnelInputBuilder()
+ .setIntfName(interfaceName).setTunnelKey(tunnelKey).build();
+
+ Future<RpcResult<GetEgressActionsForTunnelOutput>> egressActionsOutputItm =
+ itmRpcService.getEgressActionsForTunnel(getEgressActInputItm);
+ if (egressActionsOutputFuture.get().isSuccessful() && !interfaceManager.isItmDirectTunnelsEnabled()) {
+ return egressActionsOutputFuture.get().getResult().getAction();
+ } else if (egressActionsOutputItm.get().isSuccessful() && interfaceManager.isItmDirectTunnelsEnabled()) {
+ return egressActionsOutputItm.get().getResult().getAction();
}
} catch (Exception e) {
LOG.error("Error in RPC call getEgressActionsForInterface {}", e);
}
-
- if (result == null || result.isEmpty()) {
- LOG.warn("Could not build Egress actions for interface {} and tunnelId {}", interfaceName, tunnelKey);
- }
- return result;
+ LOG.warn("Could not build Egress actions for interface {} and tunnelId {}", interfaceName, tunnelKey);
+ return Collections.emptyList();
}
/**
protected void addTunnelInterfaceActions(AdjacencyResult adjacencyResult, long vpnId, VrfEntry vrfEntry,
List<ActionInfo> actionInfos, String rd) {
Class<? extends TunnelTypeBase> tunnelType =
- VpnExtraRouteHelper.getTunnelType(nextHopManager.getInterfaceManager(),
- adjacencyResult.getInterfaceName());
+ VpnExtraRouteHelper.getTunnelType(nextHopManager.getItmManager(), adjacencyResult.getInterfaceName());
if (tunnelType == null) {
LOG.debug("Tunnel type not found for vrfEntry {}", vrfEntry);
return;
addRewriteDstMacAction(vpnId, vrfEntry, null, actionInfos);
}
List<ActionInfo> egressActions = nextHopManager.getEgressActionsForInterface(egressInterface,
- actionInfos.size());
+ actionInfos.size(), true);
if (egressActions.isEmpty()) {
LOG.error(
"Failed to retrieve egress action for prefix {} route-paths {} interface {}. "
@Override
protected void addTunnelInterfaceActions(NexthopManager.AdjacencyResult adjacencyResult, long vpnId,
VrfEntry vrfEntry, List<ActionInfo> actionInfos, String rd) {
- Class<? extends TunnelTypeBase> tunnelType =
- VpnExtraRouteHelper.getTunnelType(getNextHopManager().getInterfaceManager(),
- adjacencyResult.getInterfaceName());
+ Class<? extends TunnelTypeBase> tunnelType = VpnExtraRouteHelper
+ .getTunnelType(getNextHopManager().getItmManager(), adjacencyResult.getInterfaceName());
if (tunnelType == null) {
LOG.debug("Tunnel type not found for vrfEntry {}", vrfEntry);
return;
}
actionInfos.add(new ActionSetFieldTunnelId(tunnelId));
List<ActionInfo> egressActions =
- nexthopManager.getEgressActionsForInterface(adjacencyResult.getInterfaceName(), actionInfos.size());
+ nexthopManager.getEgressActionsForInterface(adjacencyResult.getInterfaceName(), actionInfos.size(),
+ true);
if (egressActions.isEmpty()) {
LOG.error("Failed to retrieve egress action for prefix {} route-paths {} interface {}."
+ " Aborting remote FIB entry creation..", vrfEntry.getDestPrefix(),
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.itm.globals.ITMConstants;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelsState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder;
private final DataBroker dataBroker;
private final IMdsalApiManager mdsalApiManager;
- private final OdlInterfaceRpcService interfaceManager;
+ private final OdlInterfaceRpcService odlInterfaceRpcService;
private final ItmRpcService itmManager;
private final IdManagerService idManager;
private final IElanService elanService;
private final SalGroupService salGroupService;
private final JobCoordinator jobCoordinator;
private final FibUtil fibUtil;
+ private final IInterfaceManager interfaceManager;
private volatile L3VPNTransportTypes configuredTransportTypeL3VPN = L3VPNTransportTypes.Invalid;
/**
* @param dataBroker - dataBroker reference
* @param mdsalApiManager - mdsalApiManager reference
* @param idManager - idManager reference
- * @param interfaceManager - interfaceManager reference
+ * @param odlInterfaceRpcService - odlInterfaceRpcService reference
* @param itmManager - itmManager reference
*/
@Inject
public NexthopManager(final DataBroker dataBroker,
final IMdsalApiManager mdsalApiManager,
final IdManagerService idManager,
- final OdlInterfaceRpcService interfaceManager,
+ final OdlInterfaceRpcService odlInterfaceRpcService,
final ItmRpcService itmManager,
final LockManagerService lockManager,
final IElanService elanService,
final SalGroupService salGroupService,
final JobCoordinator jobCoordinator,
- final FibUtil fibUtil) {
+ final FibUtil fibUtil,
+ final IInterfaceManager interfaceManager) {
this.dataBroker = dataBroker;
this.mdsalApiManager = mdsalApiManager;
this.idManager = idManager;
- this.interfaceManager = interfaceManager;
+ this.odlInterfaceRpcService = odlInterfaceRpcService;
this.itmManager = itmManager;
this.elanService = elanService;
this.salGroupService = salGroupService;
this.jobCoordinator = jobCoordinator;
this.fibUtil = fibUtil;
this.lockManager = lockManager;
+ this.interfaceManager = interfaceManager;
createIdPool();
}
return "nexthop." + vpnId + ipAddress;
}
- public OdlInterfaceRpcService getInterfaceManager() {
- return interfaceManager;
+ public ItmRpcService getItmManager() {
+ return itmManager;
}
protected long createNextHopPointer(String nexthopKey) {
}
}
- protected List<ActionInfo> getEgressActionsForInterface(final String ifName, int actionKey) {
- List<ActionInfo> listActionInfo = new ArrayList<>();
+ protected List<ActionInfo> getEgressActionsForInterface(final String ifName, int actionKey,
+ boolean isTunnelInterface) {
+ RpcResult rpcResult;
+ List<Action> actions;
try {
- Future<RpcResult<GetEgressActionsForInterfaceOutput>> result =
- interfaceManager.getEgressActionsForInterface(
- new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName).build());
- RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
- if (!rpcResult.isSuccessful()) {
- LOG.error("RPC Call to Get egress actions for interface {} returned with Errors {}",
- ifName, rpcResult.getErrors());
+ if (isTunnelInterface && interfaceManager.isItmDirectTunnelsEnabled()) {
+ rpcResult = itmManager.getEgressActionsForTunnel(
+ new GetEgressActionsForTunnelInputBuilder().setIntfName(ifName).build()).get();
+ if (!rpcResult.isSuccessful()) {
+ LOG.error("RPC Call to Get egress tunnel actions for interface {} returned with Errors {}",
+ ifName, rpcResult.getErrors());
+ return Collections.emptyList();
+ } else {
+ GetEgressActionsForInterfaceOutput output =
+ (GetEgressActionsForInterfaceOutput)rpcResult.getResult();
+ actions = output.getAction();
+ }
} else {
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions =
- rpcResult.getResult().getAction();
- for (Action action : actions) {
- actionKey = action.getKey().getOrder() + actionKey;
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
- actionClass = action.getAction();
- if (actionClass instanceof OutputActionCase) {
- listActionInfo.add(new ActionOutput(actionKey,
- ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
- } else if (actionClass instanceof PushVlanActionCase) {
- listActionInfo.add(new ActionPushVlan(actionKey));
- } else if (actionClass instanceof SetFieldCase) {
- if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
- int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch()
- .getVlanId().getVlanId().getValue();
- listActionInfo.add(new ActionSetFieldVlanVid(actionKey, vlanVid));
- }
- } else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
- Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
- listActionInfo.add(new ActionNxResubmit(actionKey, tableId));
- } else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
- NxRegLoad nxRegLoad =
- ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
- listActionInfo.add(new ActionRegLoad(actionKey, NxmNxReg6.class,
- nxRegLoad.getDst().getStart(), nxRegLoad.getDst().getEnd(),
- nxRegLoad.getValue().longValue()));
+ rpcResult = odlInterfaceRpcService.getEgressActionsForInterface(
+ new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName).build()).get();
+ if (!rpcResult.isSuccessful()) {
+ LOG.error("RPC Call to Get egress vm actions for interface {} returned with Errors {}",
+ ifName, rpcResult.getErrors());
+ return Collections.emptyList();
+ } else {
+ GetEgressActionsForInterfaceOutput output =
+ (GetEgressActionsForInterfaceOutput)rpcResult.getResult();
+ actions = output.getAction();
+ }
+ }
+ List<ActionInfo> listActionInfo = new ArrayList<>();
+ for (Action action : actions) {
+ actionKey = action.getKey().getOrder() + actionKey;
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
+ actionClass = action.getAction();
+ if (actionClass instanceof OutputActionCase) {
+ listActionInfo.add(new ActionOutput(actionKey,
+ ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
+ } else if (actionClass instanceof PushVlanActionCase) {
+ listActionInfo.add(new ActionPushVlan(actionKey));
+ } else if (actionClass instanceof SetFieldCase) {
+ if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
+ int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch()
+ .getVlanId().getVlanId().getValue();
+ listActionInfo.add(new ActionSetFieldVlanVid(actionKey, vlanVid));
}
+ } else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
+ Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
+ listActionInfo.add(new ActionNxResubmit(actionKey, tableId));
+ } else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
+ NxRegLoad nxRegLoad =
+ ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
+ listActionInfo.add(new ActionRegLoad(actionKey, NxmNxReg6.class,
+ nxRegLoad.getDst().getStart(), nxRegLoad.getDst().getEnd(),
+ nxRegLoad.getValue().longValue()));
}
}
+ return listActionInfo;
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when egress actions for interface {}", ifName, e);
}
- return listActionInfo;
+ LOG.warn("Exception when egress actions for interface {}", ifName);
+ return Collections.emptyList();
}
protected String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId) {
// FIXME: Log message here.
LOG.debug("mac address for new local nexthop is null");
}
- listActionInfo.addAll(getEgressActionsForInterface(ifName, actionKey));
+ listActionInfo.addAll(getEgressActionsForInterface(ifName, actionKey, false));
BucketInfo bucket = new BucketInfo(listActionInfo);
listBucketInfo.add(bucket);
if (!FibUtil.isTunnelInterface(adjacencyResult)) {
return;
}
- Class<? extends TunnelTypeBase> tunnelType = VpnExtraRouteHelper
- .getTunnelType(interfaceManager,
- egressInterface);
+ Class<? extends TunnelTypeBase> tunnelType = VpnExtraRouteHelper.getTunnelType(itmManager, egressInterface);
Interface ifState = fibUtil.getInterfaceStateFromOperDS(egressInterface);
if (ifState == null || ifState.getOperStatus() != OperStatus.Up) {
LOG.trace("Tunnel not up {}", egressInterface);
if (egressActionMap.containsKey(egressInterface)) {
egressActions = egressActionMap.get(egressInterface);
} else {
- egressActions = getEgressActionsForInterface(egressInterface, actionInfos.size());
+ egressActions = getEgressActionsForInterface(egressInterface, actionInfos.size(), true);
egressActionMap.put(egressInterface, egressActions);
}
if (egressActions.isEmpty()) {
GetEgressActionsForInterfaceInputBuilder egressAction =
new GetEgressActionsForInterfaceInputBuilder().setIntfName(interfaceName).setActionKey(actionKey);
Future<RpcResult<GetEgressActionsForInterfaceOutput>> result =
- interfaceManager.getEgressActionsForInterface(egressAction.build());
+ odlInterfaceRpcService.getEgressActionsForInterface(egressAction.build());
RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.warn("RPC Call to Get egress actions for interface {} returned with Errors {}",
<reference id="interVpnLinkCache"
interface="org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache"
availability="optional"/>
+ <reference id="iInterfaceManager"
+ interface="org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager" />
<odl:rpc-service id="idManagerService"
interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService"/>
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
protected final IdManagerService idManager;
protected final NAPTSwitchSelector naptSwitchSelector;
protected final ItmRpcService itmManager;
- protected final OdlInterfaceRpcService interfaceManager;
+ protected final OdlInterfaceRpcService odlInterfaceRpcService;
+ protected final IInterfaceManager interfaceManager;
protected AbstractSnatService(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
- final ItmRpcService itmManager,
- final OdlInterfaceRpcService interfaceManager,
- final IdManagerService idManager,
- final NAPTSwitchSelector naptSwitchSelector) {
+ final ItmRpcService itmManager, final OdlInterfaceRpcService odlInterfaceRpcService,
+ final IdManagerService idManager, final NAPTSwitchSelector naptSwitchSelector,
+ final IInterfaceManager interfaceManager) {
this.dataBroker = dataBroker;
this.mdsalManager = mdsalManager;
this.itmManager = itmManager;
this.interfaceManager = interfaceManager;
this.idManager = idManager;
this.naptSwitchSelector = naptSwitchSelector;
+ this.odlInterfaceRpcService = odlInterfaceRpcService;
}
protected DataBroker getDataBroker() {
List<BucketInfo> listBucketInfo = new ArrayList<>();
if (ifNamePrimary != null) {
LOG.debug("installSnatMissEntry : On Non- Napt switch , Primary Tunnel interface is {}", ifNamePrimary);
- listActionInfoPrimary = NatUtil.getEgressActionsForInterface(interfaceManager, ifNamePrimary, routerId);
+ listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager,
+ interfaceManager, ifNamePrimary, routerId);
}
BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
listBucketInfo.add(0, bucketPrimary);
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
import org.opendaylight.genius.mdsalutil.MatchInfo;
protected static final int DNAT_CT_STATE_MASK = 0x80;
public ConntrackBasedSnatService(DataBroker dataBroker, IMdsalApiManager mdsalManager, ItmRpcService itmManager,
- OdlInterfaceRpcService interfaceManager, IdManagerService idManager,
- NAPTSwitchSelector naptSwitchSelector) {
- super(dataBroker, mdsalManager, itmManager, interfaceManager, idManager, naptSwitchSelector);
+ IdManagerService idManager, NAPTSwitchSelector naptSwitchSelector,
+ OdlInterfaceRpcService odlInterfaceRpcService,
+ IInterfaceManager interfaceManager) {
+ super(dataBroker, mdsalManager, itmManager, odlInterfaceRpcService, idManager, naptSwitchSelector,
+ interfaceManager);
}
@Override
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.genius.mdsalutil.GroupEntity;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.subnetmaps.Subnetmap;
import org.slf4j.Logger;
private final IMdsalApiManager mdsalManager;
private final IElanService elanService;
private final IdManagerService idManager;
- private final OdlInterfaceRpcService interfaceManager;
+ private final OdlInterfaceRpcService odlInterfaceRpcService;
private final JobCoordinator coordinator;
+ private final ItmRpcService itmRpcService;
+ private final IInterfaceManager interfaceManager;
@Inject
public ExternalNetworkGroupInstaller(final DataBroker broker, final IMdsalApiManager mdsalManager,
- final IElanService elanService, final IdManagerService idManager,
- final OdlInterfaceRpcService interfaceManager,
- final JobCoordinator coordinator) {
+ final IElanService elanService, final IdManagerService idManager,
+ final OdlInterfaceRpcService odlInterfaceRpcService,
+ final JobCoordinator coordinator, final ItmRpcService itmRpcService,
+ final IInterfaceManager interfaceManager) {
+
this.broker = broker;
this.mdsalManager = mdsalManager;
this.elanService = elanService;
this.idManager = idManager;
- this.interfaceManager = interfaceManager;
+ this.odlInterfaceRpcService = odlInterfaceRpcService;
this.coordinator = coordinator;
+ this.itmRpcService = itmRpcService;
+ this.interfaceManager = interfaceManager;
}
public void installExtNetGroupEntries(Subnetmap subnetMap) {
LOG.info("installExtNetGroupEntries : Installing ext-net group {} entry for subnet {} with macAddress {} "
+ "(extInterfaces: {})", groupId, subnetName, macAddress, Arrays.toString(extInterfaces.toArray()));
for (String extInterface : extInterfaces) {
- BigInteger dpId = NatUtil.getDpnForInterface(interfaceManager, extInterface);
+ BigInteger dpId = NatUtil.getDpnForInterface(odlInterfaceRpcService, extInterface);
if (BigInteger.ZERO.equals(dpId)) {
LOG.info("installExtNetGroupEntries: No DPN for interface {}. NAT ext-net flow will not be installed "
+ "for subnet {}", extInterface, subnetName);
final int setFieldEthDestActionPos = 0;
List<ActionInfo> egressActionList = new ArrayList<>();
if (extInterface != null) {
- egressActionList = NatUtil.getEgressActionsForInterface(interfaceManager, extInterface, null,
- setFieldEthDestActionPos + 1);
+ egressActionList = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmRpcService,
+ interfaceManager, extInterface, null, setFieldEthDestActionPos + 1);
}
if (Strings.isNullOrEmpty(macAddress) || egressActionList.isEmpty()) {
if (Strings.isNullOrEmpty(macAddress)) {
}
private GroupEntity buildEmptyExtNetGroupEntity(String subnetName, long groupId, String extInterface) {
- BigInteger dpId = NatUtil.getDpnForInterface(interfaceManager, extInterface);
+ BigInteger dpId = NatUtil.getDpnForInterface(odlInterfaceRpcService, extInterface);
if (BigInteger.ZERO.equals(dpId)) {
LOG.error("buildEmptyExtNetGroupEntity: No DPN for interface {}. NAT ext-net flow will not be installed "
+ "for subnet {}", extInterface, subnetName);
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
private final DataBroker dataBroker;
private final IMdsalApiManager mdsalManager;
private final ItmRpcService itmManager;
- private final OdlInterfaceRpcService interfaceManager;
+ private final OdlInterfaceRpcService odlInterfaceRpcService;
private final IdManagerService idManager;
private final NaptManager naptManager;
private final NAPTSwitchSelector naptSwitchSelector;
private final IElanService elanManager;
private final JobCoordinator coordinator;
private final UpgradeState upgradeState;
+ private final IInterfaceManager interfaceManager;
@Inject
public ExternalRoutersListener(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
final ItmRpcService itmManager,
- final OdlInterfaceRpcService interfaceManager,
+ final OdlInterfaceRpcService odlInterfaceRpcService,
final IdManagerService idManager,
final NaptManager naptManager,
final NAPTSwitchSelector naptSwitchSelector,
final NatserviceConfig config,
final IElanService elanManager,
final JobCoordinator coordinator,
- final UpgradeState upgradeState) {
+ final UpgradeState upgradeState,
+ final IInterfaceManager interfaceManager) {
super(Routers.class, ExternalRoutersListener.class);
this.dataBroker = dataBroker;
this.mdsalManager = mdsalManager;
this.itmManager = itmManager;
- this.interfaceManager = interfaceManager;
+ this.odlInterfaceRpcService = odlInterfaceRpcService;
this.idManager = idManager;
this.naptManager = naptManager;
this.naptSwitchSelector = naptSwitchSelector;
this.centralizedSwitchScheduler = centralizedSwitchScheduler;
this.coordinator = coordinator;
this.upgradeState = upgradeState;
+ this.interfaceManager = interfaceManager;
if (config != null) {
this.natMode = config.getNatMode();
} else {
if (ifNamePrimary != null) {
LOG.debug("handleSwitches : On Non- Napt switch , Primary Tunnel interface is {}", ifNamePrimary);
- listActionInfoPrimary = NatUtil.getEgressActionsForInterface(interfaceManager, ifNamePrimary, routerId);
+ listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager,
+ interfaceManager, ifNamePrimary, routerId);
if (listActionInfoPrimary.isEmpty()) {
LOG.error("handleSwitches : Unable to retrieve output actions on Non-NAPT switch {} for router {}"
+ " towards Napt-switch {} via tunnel interface {}", dpnId, routerName, primarySwitchId,
if (ifNamePrimary != null) {
LOG.debug("getBucketInfoForNonNaptSwitches : On Non- Napt switch , Primary Tunnel interface is {}",
ifNamePrimary);
- listActionInfoPrimary = NatUtil.getEgressActionsForInterface(interfaceManager, ifNamePrimary, routerId);
+ listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager,
+ interfaceManager, ifNamePrimary, routerId);
if (listActionInfoPrimary.isEmpty()) {
LOG.error("getBucketInfoForNonNaptSwitches : Unable to retrieve output actions on Non-NAPT switch {} "
+ "for router {} towards Napt-switch {} via tunnel interface {}",
import java.math.BigInteger;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
private static final Logger LOG = LoggerFactory.getLogger(FlatVlanConntrackBasedSnatService.class);
public FlatVlanConntrackBasedSnatService(DataBroker dataBroker, IMdsalApiManager mdsalManager,
- ItmRpcService itmManager, OdlInterfaceRpcService interfaceManager, IdManagerService idManager,
- NAPTSwitchSelector naptSwitchSelector) {
- super(dataBroker, mdsalManager, itmManager, interfaceManager, idManager, naptSwitchSelector);
+ ItmRpcService itmManager, OdlInterfaceRpcService odlInterfaceRpcService,
+ IdManagerService idManager, NAPTSwitchSelector naptSwitchSelector,
+ IInterfaceManager interfaceManager) {
+ super(dataBroker, mdsalManager, itmManager, idManager, naptSwitchSelector,
+ odlInterfaceRpcService, interfaceManager);
}
@Override
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
private final DataBroker dataBroker;
private final IMdsalApiManager mdsalManager;
private final ItmRpcService itmManager;
- private final OdlInterfaceRpcService interfaceManager;
+ private final OdlInterfaceRpcService odlInterfaceRpcService;
private final IdManagerService idManager;
private final NAPTSwitchSelector naptSwitchSelector;
private final ExternalRoutersListener externalRouterListener;
private final EvpnNaptSwitchHA evpnNaptSwitchHA;
private final SnatServiceManager natServiceManager;
private final NatMode natMode;
+ private final IInterfaceManager interfaceManager;
private volatile Collection<String> externalIpsCache;
public NaptSwitchHA(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
final ExternalRoutersListener externalRouterListener,
final ItmRpcService itmManager,
- final OdlInterfaceRpcService interfaceManager,
+ final OdlInterfaceRpcService odlInterfaceRpcService,
final IdManagerService idManager,
final NAPTSwitchSelector naptSwitchSelector,
final IFibManager fibManager,
final IElanService elanManager,
final SnatServiceManager natServiceManager,
final NatserviceConfig config,
- final NaptEventHandler naptEventHandler) {
+ final NaptEventHandler naptEventHandler,
+ final IInterfaceManager interfaceManager) {
this.dataBroker = dataBroker;
this.mdsalManager = mdsalManager;
this.externalRouterListener = externalRouterListener;
this.itmManager = itmManager;
- this.interfaceManager = interfaceManager;
+ this.odlInterfaceRpcService = odlInterfaceRpcService;
this.idManager = idManager;
this.naptSwitchSelector = naptSwitchSelector;
this.naptEventHandler = naptEventHandler;
this.evpnNaptSwitchHA = evpnNaptSwitchHA;
this.elanManager = elanManager;
this.natServiceManager = natServiceManager;
+ this.interfaceManager = interfaceManager;
if (config != null) {
this.natMode = config.getNatMode();
} else {
LOG.debug("handleGroupInNeighborSwitches : TunnelInterface {} between ordinary switch {} and naptSwitch {}",
ifNamePrimary, dpnId, naptSwitch);
List<ActionInfo> listActionInfoPrimary =
- NatUtil.getEgressActionsForInterface(interfaceManager, ifNamePrimary, routerId);
+ NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager, interfaceManager,
+ ifNamePrimary, routerId);
BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
listBucketInfo.add(bucketPrimary);
} else {
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.FlowEntityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetEgressActionsForTunnelOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
}
@Nonnull
- public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService interfaceManager, String ifName,
+ public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService odlInterfaceRpcService,
+ ItmRpcService itmRpcService,
+ IInterfaceManager interfaceManager, String ifName,
Long tunnelKey) {
- return getEgressActionsForInterface(interfaceManager, ifName, tunnelKey, 0);
+ return getEgressActionsForInterface(odlInterfaceRpcService, itmRpcService, interfaceManager,
+ ifName, tunnelKey, 0);
}
@Nonnull
- public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService interfaceManager, String ifName,
- Long tunnelKey, int pos) {
+ public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService odlInterfaceRpcService,
+ ItmRpcService itmRpcService,
+ IInterfaceManager interfaceManager,
+ String ifName, Long tunnelKey, int pos) {
LOG.debug("getEgressActionsForInterface : called for interface {}", ifName);
- GetEgressActionsForInterfaceInputBuilder egressActionsBuilder = new GetEgressActionsForInterfaceInputBuilder()
+ GetEgressActionsForInterfaceInputBuilder egressActionsIfmBuilder =
+ new GetEgressActionsForInterfaceInputBuilder().setIntfName(ifName);
+ GetEgressActionsForTunnelInputBuilder egressActionsItmBuilder = new GetEgressActionsForTunnelInputBuilder()
.setIntfName(ifName);
if (tunnelKey != null) {
- egressActionsBuilder.setTunnelKey(tunnelKey);
+ egressActionsIfmBuilder.setTunnelKey(tunnelKey);
+ egressActionsItmBuilder.setTunnelKey(tunnelKey);
}
- List<ActionInfo> listActionInfo = new ArrayList<>();
try {
- Future<RpcResult<GetEgressActionsForInterfaceOutput>> result = interfaceManager
- .getEgressActionsForInterface(egressActionsBuilder.build());
- RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = result.get();
- if (!rpcResult.isSuccessful()) {
- LOG.error("getEgressActionsForInterface : RPC Call to Get egress actions for interface {} "
- + "returned with Errors {}", ifName, rpcResult.getErrors());
+ RpcResult<GetEgressActionsForTunnelOutput> rpcResultItm = null;
+ RpcResult<GetEgressActionsForInterfaceOutput> rpcResult = null;
+ List<Action> actions = Collections.emptyList();
+ if (interfaceManager.isItmDirectTunnelsEnabled()) {
+ rpcResultItm =
+ itmRpcService.getEgressActionsForTunnel(egressActionsItmBuilder.build()).get();
} else {
- List<Action> actions = rpcResult.getResult().getAction();
- for (Action action : actions) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
- actionClass = action.getAction();
- if (actionClass instanceof OutputActionCase) {
- listActionInfo.add(new ActionOutput(pos++,
- ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
- } else if (actionClass instanceof PushVlanActionCase) {
- listActionInfo.add(new ActionPushVlan(pos++));
- } else if (actionClass instanceof SetFieldCase) {
- if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
- int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch().getVlanId()
- .getVlanId().getValue();
- listActionInfo.add(new ActionSetFieldVlanVid(pos++, vlanVid));
- }
- } else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
- Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
- listActionInfo.add(new ActionNxResubmit(pos++, tableId));
- } else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
- NxRegLoad nxRegLoad =
- ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
- listActionInfo.add(new ActionRegLoad(pos++, NxmNxReg6.class, nxRegLoad.getDst().getStart(),
- nxRegLoad.getDst().getEnd(), nxRegLoad.getValue().longValue()));
+ rpcResult =
+ odlInterfaceRpcService.getEgressActionsForInterface(egressActionsIfmBuilder.build()).get();
+ }
+
+ if (!interfaceManager.isItmDirectTunnelsEnabled() && rpcResult != null) {
+ if (!rpcResult.isSuccessful()) {
+ LOG.error("getEgressActionsForInterface : RPC Call to Get egress actions for interface {} "
+ + "returned with Errors {}", ifName, rpcResult.getErrors());
+ } else {
+ actions = rpcResult.getResult().getAction();
+ }
+ } else if (interfaceManager.isItmDirectTunnelsEnabled() && rpcResultItm != null) {
+ if (!rpcResultItm.isSuccessful()) {
+ LOG.error("getEgressActionsForTunnels : RPC Call to Get egress actions for Tunnels {} "
+ + "returned with Errors {}", ifName, rpcResultItm.getErrors());
+ } else {
+ actions = rpcResultItm.getResult().getAction();
+ }
+ }
+ List<ActionInfo> listActionInfo = new ArrayList<>();
+ for (Action action : actions) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action
+ actionClass = action.getAction();
+ if (actionClass instanceof OutputActionCase) {
+ listActionInfo.add(new ActionOutput(pos++,
+ ((OutputActionCase) actionClass).getOutputAction().getOutputNodeConnector()));
+ } else if (actionClass instanceof PushVlanActionCase) {
+ listActionInfo.add(new ActionPushVlan(pos++));
+ } else if (actionClass instanceof SetFieldCase) {
+ if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
+ int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch().getVlanId()
+ .getVlanId().getValue();
+ listActionInfo.add(new ActionSetFieldVlanVid(pos++, vlanVid));
}
+ } else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
+ Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
+ listActionInfo.add(new ActionNxResubmit(pos++, tableId));
+ } else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
+ NxRegLoad nxRegLoad =
+ ((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
+ listActionInfo.add(new ActionRegLoad(pos++, NxmNxReg6.class, nxRegLoad.getDst().getStart(),
+ nxRegLoad.getDst().getEnd(), nxRegLoad.getValue().longValue()));
}
}
+ return listActionInfo;
} catch (InterruptedException | ExecutionException e) {
LOG.error("Exception when egress actions for interface {}", ifName, e);
}
- return listActionInfo;
+ LOG.error("Error when getting egress actions for interface {}", ifName);
+ return Collections.emptyList();
}
public static Port getNeutronPortForRouterGetewayIp(DataBroker broker, IpAddress targetIP) {
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.inject.AbstractLifecycle;
import org.opendaylight.netvirt.elanmanager.api.IElanService;
private final DataBroker dataBroker;
private final IMdsalApiManager mdsalManager;
private final ItmRpcService itmManager;
- private final OdlInterfaceRpcService interfaceManager;
+ private final OdlInterfaceRpcService odlInterfaceRpcService;
private final IdManagerService idManager;
private final NAPTSwitchSelector naptSwitchSelector;
private final NatMode natMode;
private final INeutronVpnManager nvpnManager;
private final ExternalRoutersListener externalRouterListener;
private final IElanService elanManager;
+ private final IInterfaceManager interfaceManager;
@Inject
public SnatServiceImplFactory(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
- final ItmRpcService itmManager,
- final OdlInterfaceRpcService interfaceManager,
- final IdManagerService idManager,
- final NAPTSwitchSelector naptSwitchSelector,
- final NatserviceConfig config,
- final INeutronVpnManager nvpnManager,
- final ExternalRoutersListener externalRouterListener,
- final IElanService elanManager) {
+ final ItmRpcService itmManager,
+ final OdlInterfaceRpcService odlInterfaceRpcService,
+ final IdManagerService idManager,
+ final NAPTSwitchSelector naptSwitchSelector,
+ final NatserviceConfig config,
+ final INeutronVpnManager nvpnManager,
+ final ExternalRoutersListener externalRouterListener,
+ final IElanService elanManager,
+ final IInterfaceManager interfaceManager) {
this.dataBroker = dataBroker;
this.mdsalManager = mdsalManager;
this.itmManager = itmManager;
- this.interfaceManager = interfaceManager;
+ this.odlInterfaceRpcService = odlInterfaceRpcService;
this.idManager = idManager;
this.naptSwitchSelector = naptSwitchSelector;
if (config != null) {
this.nvpnManager = nvpnManager;
this.externalRouterListener = externalRouterListener;
this.elanManager = elanManager;
+ this.interfaceManager = interfaceManager;
}
@Override
public AbstractSnatService createFlatVlanSnatServiceImpl() {
if (natMode == NatMode.Conntrack) {
- return new FlatVlanConntrackBasedSnatService(dataBroker, mdsalManager, itmManager, interfaceManager,
- idManager, naptSwitchSelector);
+ return new FlatVlanConntrackBasedSnatService(dataBroker, mdsalManager, itmManager, odlInterfaceRpcService,
+ idManager, naptSwitchSelector, interfaceManager);
}
return null;
}
if (natMode == NatMode.Conntrack) {
NatOverVxlanUtil.validateAndCreateVxlanVniPool(dataBroker, nvpnManager, idManager,
NatConstants.ODL_VNI_POOL_NAME);
- return new VxlanGreConntrackBasedSnatService(dataBroker, mdsalManager, itmManager, interfaceManager,
- idManager, naptSwitchSelector, externalRouterListener, elanManager);
+ return new VxlanGreConntrackBasedSnatService(dataBroker, mdsalManager, itmManager, odlInterfaceRpcService,
+ idManager, naptSwitchSelector, externalRouterListener, elanManager, interfaceManager);
}
return null;
}
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.BucketInfo;
import org.opendaylight.genius.mdsalutil.GroupEntity;
private final IElanService elanManager;
public VxlanGreConntrackBasedSnatService(DataBroker dataBroker, IMdsalApiManager mdsalManager,
- ItmRpcService itmManager, OdlInterfaceRpcService interfaceManager, IdManagerService idManager,
- NAPTSwitchSelector naptSwitchSelector,
- ExternalRoutersListener externalRouterListener, IElanService elanManager) {
- super(dataBroker, mdsalManager, itmManager, interfaceManager, idManager, naptSwitchSelector);
+ ItmRpcService itmManager, OdlInterfaceRpcService odlInterfaceRpcService,
+ IdManagerService idManager, NAPTSwitchSelector naptSwitchSelector,
+ ExternalRoutersListener externalRouterListener, IElanService elanManager,
+ IInterfaceManager interfaceManager) {
+ super(dataBroker, mdsalManager, itmManager, idManager, naptSwitchSelector, odlInterfaceRpcService,
+ interfaceManager);
this.externalRouterListener = externalRouterListener;
this.elanManager = elanManager;
}
List<BucketInfo> listBucketInfo = new ArrayList<>();
if (ifNamePrimary != null) {
LOG.debug("installSnatMissEntry : On Non- Napt switch , Primary Tunnel interface is {}", ifNamePrimary);
- listActionInfoPrimary = NatUtil.getEgressActionsForInterface(interfaceManager, ifNamePrimary, routerId);
+ listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager,
+ interfaceManager, ifNamePrimary, routerId);
}
BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
listBucketInfo.add(0, bucketPrimary);
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetTunnelTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetTunnelTypeOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelTypeInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelTypeOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.ExtrarouteRdsMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.extraroute.rds.map.ExtrarouteRds;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.extraroute.rds.map.ExtrarouteRdsKey;
return extraRoutesList;
}
- public static Class<? extends TunnelTypeBase> getTunnelType(OdlInterfaceRpcService interfaceManager,
- String ifName) {
+ public static Class<? extends TunnelTypeBase> getTunnelType(ItmRpcService itmRpcService, String ifName) {
try {
- Future<RpcResult<GetTunnelTypeOutput>> result = interfaceManager.getTunnelType(
- new GetTunnelTypeInputBuilder().setIntfName(ifName).build());
+ Future<RpcResult<GetTunnelTypeOutput>> result =
+ itmRpcService.getTunnelType(new GetTunnelTypeInputBuilder().setIntfName(ifName).build());
RpcResult<GetTunnelTypeOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.warn("RPC Call to getTunnelInterfaceId returned with Errors {}", rpcResult.getErrors());
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency;
private final InterVpnLinkCache interVpnLinkCache;
private final DataTreeEventCallbackRegistrar eventCallbacks;
private final UpgradeState upgradeState;
+ private final ItmRpcService itmRpcService;
@Inject
public VpnManagerImpl(final DataBroker dataBroker,
final IBgpManager bgpManager,
final InterVpnLinkCache interVpnLinkCache,
final DataTreeEventCallbackRegistrar dataTreeEventCallbackRegistrar,
- final UpgradeState upgradeState) {
+ final UpgradeState upgradeState,
+ final ItmRpcService itmRpcService) {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.idManager = idManagerService;
this.interVpnLinkCache = interVpnLinkCache;
this.eventCallbacks = dataTreeEventCallbackRegistrar;
this.upgradeState = upgradeState;
+ this.itmRpcService = itmRpcService;
}
@PostConstruct
instructions.add(
new InstructionWriteMetadata(BigInteger.ZERO, MetaDataUtil.METADATA_MASK_SH_FLAG).buildInstruction(1));
instructions.addAll(
- ArpResponderUtil.getExtInterfaceInstructions(interfaceManager, extInterfaceName, fixedIp, macAddress));
+ ArpResponderUtil.getExtInterfaceInstructions(interfaceManager, itmRpcService, extInterfaceName,
+ fixedIp, macAddress));
ArpReponderInputBuilder builder = new ArpReponderInputBuilder().setDpId(dpnId)
.setInterfaceName(extInterfaceName).setSpa(fixedIp).setSha(macAddress).setLportTag(lportTag);
builder.setInstructions(instructions);
import org.opendaylight.netvirt.vpnmanager.VpnUtil;
import org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.neutron.vpn.portip.port.data.VpnPortipToPort;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
private final IInterfaceManager interfaceManager;
+ /**
+ * RPC to access ITM APIs.
+ */
+ private final ItmRpcService itmRpcService;
+
/**
* Constructor.
*
*
*/
@Inject
- public ArpResponderHandler(DataBroker dataBroker, IElanService elanService, IInterfaceManager interfaceManager) {
+ public ArpResponderHandler(DataBroker dataBroker, IElanService elanService, IInterfaceManager interfaceManager,
+ ItmRpcService itmRpcService) {
this.dataBroker = dataBroker;
this.elanService = elanService;
this.interfaceManager = interfaceManager;
+ this.itmRpcService = itmRpcService;
}
/**
LOG.trace("Creating the ARP Responder flow for VPN Interface {}", interfaceName);
ArpReponderInputBuilder builder = new ArpReponderInputBuilder();
builder.setDpId(dpnId).setInterfaceName(interfaceName).setSpa(gatewayIp).setSha(mac).setLportTag(lportTag);
- builder.setInstructions(
- ArpResponderUtil.getInterfaceInstructions(interfaceManager, interfaceName, gatewayIp, mac));
+ builder.setInstructions(ArpResponderUtil
+ .getInterfaceInstructions(interfaceManager, interfaceName, gatewayIp, mac, itmRpcService));
elanService.addArpResponderFlow(builder.buildForInstallFlow());
}
interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService" />
<odl:rpc-service id="alivenessMonitorService"
interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService" />
+ <odl:rpc-service id="itmRpcService"
+ interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService"/>
<service ref="dpnInVpnChangeListener" odl:type="default"
interface="org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.OdlL3vpnListener" />