use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project netvirt by opendaylight.
the class DhcpPktHandler method getEgressAction.
private List<Action> getEgressAction(String interfaceName, BigInteger tunnelId) {
List<Action> actions = null;
try {
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 {
actions = rpcResult.getResult().getAction();
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when egress actions for interface {}", interfaceName, e);
}
return actions;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project netvirt by opendaylight.
the class DhcpPktHandler method sendPacketOut.
private void sendPacketOut(byte[] pktOut, BigInteger dpnId, String interfaceName, BigInteger tunnelId) {
List<Action> action = getEgressAction(interfaceName, tunnelId);
TransmitPacketInput output = MDSALUtil.getPacketOut(action, pktOut, dpnId);
LOG.trace("Transmitting packet: {}", output);
JdkFutures.addErrorLogging(pktService.transmitPacket(output), LOG, "Transmit packet");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project netvirt by opendaylight.
the class VrfListener method programLabelInAllVpnDpns.
/**
* Adds or Removes a VPN's route in all the DPNs where the VPN has footprint.
*
* @param vpnRd Route-Distinguisher of the VPN
* @param vrfEntry The route to add or remove
* @param addOrRemove States if the route must be added or removed
*/
protected void programLabelInAllVpnDpns(String vpnRd, VrfEntry vrfEntry, int addOrRemove) {
Long vpnPseudoLPortTag = vpnPseudoPortCache.get(vpnRd);
if (vpnPseudoLPortTag == null) {
LOG.debug("Vpn with rd={} not related to any VpnPseudoPort", vpnRd);
return;
}
Optional<VpnInstanceOpDataEntry> vpnOpData = VpnServiceChainUtils.getVpnInstanceOpData(broker, vpnRd);
if (!vpnOpData.isPresent()) {
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.error("VrfEntry added: Could not find operational data for VPN with RD={}", vpnRd);
} else {
LOG.warn("VrfEntry removed: No Operational data found for VPN with RD={}. No further action", vpnRd);
}
return;
}
Collection<VpnToDpnList> vpnToDpnList = vpnOpData.get().getVpnToDpnList();
if (vpnToDpnList == null || vpnToDpnList.isEmpty()) {
LOG.warn("Empty VpnToDpnlist found in Operational for VPN with RD={}. No label will be {}", vpnRd, addOrRemove == NwConstants.ADD_FLOW ? "programmed" : "cleaned");
return;
}
for (VpnToDpnList dpnInVpn : vpnToDpnList) {
BigInteger dpnId = dpnInVpn.getDpnId();
VpnServiceChainUtils.programLFibEntriesForSCF(mdsalMgr, dpnId, Collections.singletonList(vrfEntry), (int) vpnPseudoLPortTag.longValue(), addOrRemove);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project netvirt by opendaylight.
the class ArpResponderUtil method getEgressActionsForInterface.
/**
* Get List of Egress Action for the VPN interface.
*
* @param ifaceMgrRpcService
* Interface Manager RPC reference that invokes API to retrieve
* Egress Action
* @param ifName
* VPN Interface for which Egress Action to be retrieved
* @param actionCounter
* 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action in project netvirt by opendaylight.
the class ArpResponderUtil method getExtInterfaceInstructions.
/**
* Get instruction list for ARP responder flows originated from ext-net e.g.
* router-gw/fip.<br>
* The split-horizon bit should be reset in order to allow traffic from
* provider network to be routed back to flat/VLAN network and override the
* egress table drop flow.<br>
* In order to allow write-metadata in the ARP responder table the resubmit
* action needs to be replaced with goto instruction.
*/
public static List<Instruction> getExtInterfaceInstructions(IInterfaceManager ifaceMgrRpcService, String extInterfaceName, String ipAddress, String macAddress) {
AtomicInteger tableId = new AtomicInteger(-1);
List<Instruction> instructions = new ArrayList<>();
List<Action> actions = getActions(ifaceMgrRpcService, extInterfaceName, ipAddress, macAddress);
actions.removeIf(v -> {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionClass = v.getAction();
if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
tableId.set(((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable());
return true;
} else {
return false;
}
});
instructions.add(MDSALUtil.buildApplyActionsInstruction(actions, 0));
if (tableId.get() != -1) {
// write-metadata
if ((short) tableId.get() > NwConstants.ARP_RESPONDER_TABLE) {
instructions.add(new InstructionGotoTable((short) tableId.get()).buildInstruction(2));
} else {
LOG.warn("Failed to insall responder flow for interface {}. Resubmit to {} can't be replaced with goto", extInterfaceName, tableId);
}
}
return instructions;
}
Aggregations