Search in sources :

Example 11 with ActionNxConntrack

use of org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack in project netvirt by opendaylight.

the class VxlanGreConntrackBasedSnatService method installTerminatingServiceTblEntryForVxlanGre.

protected void installTerminatingServiceTblEntryForVxlanGre(BigInteger dpnId, String routerName, Long routerId, int elanId, int addOrRemove) {
    LOG.info("installTerminatingServiceTblEntryForVxlanGre : creating entry for" + "Terminating Service Table for switch {}, routerId {}", dpnId, routerId);
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV4);
    BigInteger tunnelId = BigInteger.valueOf(routerId);
    if (elanManager.isOpenStackVniSemanticsEnforced()) {
        tunnelId = NatOverVxlanUtil.getRouterVni(idManager, routerName, routerId);
    }
    matches.add(new MatchTunnelId(tunnelId));
    List<ActionInfo> actionsInfos = new ArrayList<>();
    List<NxCtAction> ctActionsList = new ArrayList<>();
    NxCtAction nxCtAction = new ActionNxConntrack.NxNat(0, 0, 0, null, null, 0, 0);
    ctActionsList.add(nxCtAction);
    ActionNxConntrack actionNxConntrack = new ActionNxConntrack(0, 0, elanId, NwConstants.OUTBOUND_NAPT_TABLE, ctActionsList);
    ActionSetFieldMeta actionSetFieldMeta = new ActionSetFieldMeta(MetaDataUtil.getVpnIdMetadata(routerId.longValue()));
    actionsInfos.add(actionSetFieldMeta);
    actionsInfos.add(actionNxConntrack);
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(actionsInfos));
    String flowRef = getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, routerId.longValue());
    syncFlow(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef, NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions, addOrRemove);
}
Also used : ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionNxConntrack(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack) ActionSetFieldMeta(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldMeta) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) BigInteger(java.math.BigInteger) NxCtAction(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 12 with ActionNxConntrack

use of org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack in project netvirt by opendaylight.

the class AbstractAclServiceImpl method programConntrackRecircRule.

protected void programConntrackRecircRule(BigInteger dpId, int lportTag, String portId, MatchEthernetType matchEtherType, int addOrRemove) {
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(matchEtherType);
    matches.add(AclServiceUtils.buildLPortTagMatch(lportTag, serviceMode));
    List<InstructionInfo> instructions = new ArrayList<>();
    if (addOrRemove == NwConstants.ADD_FLOW) {
        Long elanTag = getElanIdFromAclInterface(portId);
        if (elanTag == null) {
            LOG.error("ElanId not found for portId={}; Context: dpId={}, lportTag={}, addOrRemove={},", portId, dpId, lportTag, addOrRemove);
            return;
        }
        List<ActionInfo> actionsInfos = new ArrayList<>();
        actionsInfos.add(new ActionNxConntrack(2, 0, 0, elanTag.intValue(), getAclForExistingTrafficTable()));
        instructions.add(new InstructionApplyActions(actionsInfos));
    }
    String flowName = this.directionString + "_Fixed_Conntrk_" + dpId + "_" + lportTag + "_" + matchEtherType + "_Recirc";
    syncFlow(dpId, getAclConntrackSenderTable(), flowName, AclConstants.ACL_DEFAULT_PRIORITY, "ACL", 0, 0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
}
Also used : InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionNxConntrack(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Aggregations

ArrayList (java.util.ArrayList)12 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)12 ActionNxConntrack (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack)12 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)11 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)11 NxCtAction (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction)9 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)7 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)5 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)3 ActionSetFieldMeta (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldMeta)3 NxMatchCtState (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState)3 ActionNxLoadMetadata (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata)2 MatchIpv4Destination (org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination)2 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)2 IpPrefixOrAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress)2 BigInteger (java.math.BigInteger)1 Test (org.junit.Test)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 FlowEntityBuilder (org.opendaylight.genius.mdsalutil.FlowEntityBuilder)1 ActionSetFieldEthernetSource (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource)1