use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.statement.Actions in project netvirt by opendaylight.
the class VpnServiceChainUtils method buildLPortDispFromScfToL3VpnFlow.
/**
* Build the flow that must be inserted when there is a ScHop whose
* egressPort is a VPN Pseudo Port. In that case, packets must be moved
* from the SCF to VPN Pipeline.
* <p>
* Flow matches: VpnPseudo port lPortTag + SI=L3VPN
* Actions: Write vrfTag in Metadata + goto FIB Table
* </p>
* @param vpnId Dataplane identifier of the VPN, the Vrf Tag.
* @param dpId The DPN where the flow must be installed/removed
* @param lportTag Dataplane identifier for the VpnPseudoPort
* @param addOrRemove States if it must build a Flow to be created or
* removed
*
* @return the Flow object
*/
public static Flow buildLPortDispFromScfToL3VpnFlow(Long vpnId, BigInteger dpId, Integer lportTag, int addOrRemove) {
LOG.info("buildLPortDispFlowForScf vpnId={} dpId={} lportTag={} addOrRemove={} ", vpnId, dpId, lportTag, addOrRemove);
List<MatchInfo> matches = buildMatchOnLportTagAndSI(lportTag, ServiceIndex.getIndex(NwConstants.L3VPN_SERVICE_NAME, NwConstants.L3VPN_SERVICE_INDEX));
List<Instruction> instructions = buildSetVrfTagAndGotoFibInstructions(vpnId.intValue());
String flowRef = getScfToL3VpnLportDispatcherFlowRef(lportTag);
Flow result;
if (addOrRemove == NwConstants.ADD_FLOW) {
result = MDSALUtil.buildFlowNew(NwConstants.LPORT_DISPATCHER_TABLE, flowRef, CloudServiceChainConstants.DEFAULT_SCF_FLOW_PRIORITY, flowRef, 0, 0, VpnServiceChainUtils.getCookieL3(vpnId.intValue()), matches, instructions);
} else {
result = new FlowBuilder().setTableId(NwConstants.LPORT_DISPATCHER_TABLE).setId(new FlowId(flowRef)).build();
}
return result;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.statement.Actions in project netvirt by opendaylight.
the class ExternalNetworkGroupInstaller method buildExtNetGroupEntity.
private GroupEntity buildExtNetGroupEntity(String macAddress, String subnetName, Uint32 groupId, String extInterface, Uint64 dpnId) {
List<ActionInfo> actionList = new ArrayList<>();
final int setFieldEthDestActionPos = 0;
List<ActionInfo> egressActionList = new ArrayList<>();
if (extInterface != null) {
egressActionList = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmRpcService, interfaceManager, extInterface, null, setFieldEthDestActionPos + 1, false);
}
if (Strings.isNullOrEmpty(macAddress) || egressActionList.isEmpty()) {
if (Strings.isNullOrEmpty(macAddress)) {
LOG.trace("buildExtNetGroupEntity : Building ext-net group {} entry with drop action since " + "GW mac has not been resolved for subnet {} extInterface {}", groupId, subnetName, extInterface);
} else {
LOG.warn("buildExtNetGroupEntity : Building ext-net group {} entry with drop action since " + "no egress actions were found for subnet {} extInterface {}", groupId, subnetName, extInterface);
}
actionList.add(new ActionDrop());
} else {
LOG.trace("Building ext-net group {} entry for subnet {} extInterface {} macAddress {}", groupId, subnetName, extInterface, macAddress);
actionList.add(new ActionSetFieldEthernetDestination(setFieldEthDestActionPos, new MacAddress(macAddress)));
actionList.addAll(egressActionList);
}
List<BucketInfo> listBucketInfo = new ArrayList<>();
listBucketInfo.add(new BucketInfo(actionList));
return MDSALUtil.buildGroupEntity(dpnId, groupId.longValue(), subnetName, GroupTypes.GroupAll, listBucketInfo);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.statement.Actions in project netvirt by opendaylight.
the class ExternalRoutersListener method makeTunnelTableEntry.
private void makeTunnelTableEntry(Uint64 dpnId, Uint32 serviceId, Uint32 l3Vni, List<Instruction> customInstructions, TypedWriteTransaction<Configuration> confTx, ProviderTypes extNwProvType) {
List<MatchInfo> mkMatches = new ArrayList<>();
LOG.debug("makeTunnelTableEntry : DpnId = {} and serviceId = {} and actions = {}", dpnId, serviceId, customInstructions);
if (NatUtil.isOpenStackVniSemanticsEnforcedForGreAndVxlan(elanManager, extNwProvType)) {
mkMatches.add(new MatchTunnelId(Uint64.valueOf(l3Vni)));
} else {
mkMatches.add(new MatchTunnelId(Uint64.valueOf(serviceId)));
}
Map<InstructionKey, Instruction> customInstructionsMap = new HashMap<InstructionKey, Instruction>();
int instructionKey = 0;
for (Instruction instructionObj : customInstructions) {
customInstructionsMap.put(new InstructionKey(++instructionKey), instructionObj);
}
Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY, String.format("%s:%s", "TST Flow Entry ", serviceId), 0, 0, Uint64.valueOf(COOKIE_TUNNEL.toJava().add(BigInteger.valueOf(serviceId.longValue()))), mkMatches, customInstructionsMap);
mdsalManager.addFlow(confTx, dpnId, terminatingServiceTableFlowEntity);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.statement.Actions in project netvirt by opendaylight.
the class ArpResponderUtil method getActions.
/**
* Get List of actions for ARP Responder Flows.
*
* <p>
* Actions consists of all the ARP actions and Resubmit Action to table
* {@link NwConstants#ELAN_BASE_TABLE} such that packets can flow ELAN Rule
*
* @param ipAddress
* IP Address for which ARP Response packet is to be generated
* @param macAddress
* MacAddress for which ARP Response packet is to be generated
* @return List of ARP Responder Actions actions
*/
private 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, itmRpcService, ifName, actionCounter.get(), isTunnelInterface));
LOG.trace("Total Number of actions is {}", actionCounter);
return actions;
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.statement.Actions in project netvirt by opendaylight.
the class DhcpPktHandler method getEgressAction.
private List<Action> getEgressAction(String interfaceName, Uint64 tunnelId) {
try {
if (interfaceManager.isItmDirectTunnelsEnabled() && tunnelId != null) {
GetEgressActionsForTunnelInputBuilder egressAction = new GetEgressActionsForTunnelInputBuilder().setIntfName(interfaceName);
egressAction.setTunnelKey(tunnelId.longValue());
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 new ArrayList<>(rpcResult.getResult().nonnullAction().values());
}
} else {
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 new ArrayList<>(rpcResult.getResult().nonnullAction().values());
}
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when egress actions for interface {}", interfaceName, e);
}
return Collections.emptyList();
}
Aggregations