use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action in project netvirt by opendaylight.
the class DhcpNeutronPortListener method processArpResponderForElanDpns.
/**
* Handle(Add/Remove) ARP Responder for DHCP IP on all the DPNs when DHCP is
* enabled/disabled on subnet add or update or delete.
*
* @param port
* DHCP port for which ARP Responder flow to be added when dhcp
* flag is enabled on the subnet or DHCP port for which ARP
* Responder flow to be removed when dhcp flag is disabled on the
* Subnet
* @param arpResponderAction
* ARP Responder Action to be performed i.e., add or remove flow
*/
private void processArpResponderForElanDpns(Port port, Consumer<ArpResponderInput> arpResponderAction) {
java.util.Optional<String> ip4Address = DhcpServiceUtils.getIpV4Address(port);
if (!ip4Address.isPresent()) {
LOG.warn("There is no IPv4Address for port {}, not performing ARP responder add/remove flow operation", port.getName());
return;
}
ElanHelper.getDpnInterfacesInElanInstance(broker, port.getNetworkId().getValue()).stream().map(ifName -> DhcpServiceUtils.getInterfaceInfo(interfaceManager, ifName)).forEach(interfaceInfo -> {
ArpResponderInput arpResponderInput = new ArpResponderInput.ArpReponderInputBuilder().setDpId(interfaceInfo.getDpId()).setInterfaceName(interfaceInfo.getInterfaceName()).setLportTag(interfaceInfo.getInterfaceTag()).setSha(port.getMacAddress().getValue()).setSpa(ip4Address.get()).build();
arpResponderAction.accept(arpResponderInput);
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.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.list.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.list.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.list.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());
}
Aggregations