Search in sources :

Example 1 with NxActionConntrack

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrack in project openflowplugin by opendaylight.

the class ConntrackConvertor method getCtAction.

private List<CtActions> getCtAction(final NxActionConntrack action) {
    if (action.getCtActions() == null) {
        return null;
    }
    List<CtActions> ctActions = new ArrayList<>();
    for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.nx.action.conntrack.CtActions ctAction : action.getCtActions()) {
        org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.OfpactActions ofpactAction = ctAction.getOfpactActions();
        if (ofpactAction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionNatCase) {
            org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNat nxActionNat = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionNatCase) ofpactAction).getNxActionNat();
            NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder();
            nxActionNatBuilder.setFlags(nxActionNat.getFlags());
            nxActionNatBuilder.setRangePresent(nxActionNat.getRangePresent());
            nxActionNatBuilder.setIpAddressMin(nxActionNat.getIpAddressMin());
            nxActionNatBuilder.setIpAddressMax(nxActionNat.getIpAddressMax());
            nxActionNatBuilder.setPortMin(nxActionNat.getPortMin());
            nxActionNatBuilder.setPortMax(nxActionNat.getPortMax());
            NxActionNatCaseBuilder caseBuilder = new NxActionNatCaseBuilder();
            caseBuilder.setNxActionNat(nxActionNatBuilder.build());
            CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
            ctActionsBuilder.setOfpactActions(caseBuilder.build());
            ctActions.add(ctActionsBuilder.build());
        } else if (ofpactAction instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionCtMarkCase) {
            org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMark nxActionCtMark = ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionCtMarkCase) ofpactAction).getNxActionCtMark();
            NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
            nxActionCtMarkBuilder.setCtMark(nxActionCtMark.getCtMark());
            // TODO: ct_mark mask is not supported yet
            NxActionCtMarkCaseBuilder caseBuilder = new NxActionCtMarkCaseBuilder();
            caseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
            CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
            ctActionsBuilder.setOfpactActions(caseBuilder.build());
            ctActions.add(ctActionsBuilder.build());
        }
    }
    return ctActions;
}
Also used : NxActionCtMarkCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionCtMarkCaseBuilder) CtActions(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActions) ArrayList(java.util.ArrayList) NxActionNatBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder) CtActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActionsBuilder) NxActionCtMarkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder) NxActionCtMark(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMark) NxActionNatCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCase) NxActionNatCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCaseBuilder)

Example 2 with NxActionConntrack

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrack in project openflowplugin by opendaylight.

the class ConntrackConvertor method convert.

@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
    NxActionConntrack action = ((ActionConntrack) input.getActionChoice()).getNxActionConntrack();
    NxConntrackBuilder builder = new NxConntrackBuilder();
    builder.setFlags(action.getFlags());
    builder.setZoneSrc(action.getZoneSrc());
    builder.setRecircTable(action.getRecircTable());
    builder.setConntrackZone(action.getConntrackZone());
    builder.setCtActions(getCtAction(action));
    return resolveAction(builder.build(), path);
}
Also used : NxActionConntrack(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrack) NxActionConntrack(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrack) ActionConntrack(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionConntrack) NxConntrackBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.NxConntrackBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 ActionConntrack (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionConntrack)1 NxActionConntrack (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrack)1 NxConntrackBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.NxConntrackBuilder)1 CtActions (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActions)1 CtActionsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.conntrack.grouping.nx.conntrack.CtActionsBuilder)1 NxActionCtMarkCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionCtMarkCaseBuilder)1 NxActionNatCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCase)1 NxActionNatCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.NxActionNatCaseBuilder)1 NxActionCtMark (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMark)1 NxActionCtMarkBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder)1 NxActionNatBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder)1