Search in sources :

Example 21 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class OutputRegCodecTest method createAction.

private Action createAction() {
    ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setExperimenterId(experimenterId);
    final ActionOutputRegBuilder actionOutputRegBuilder = new ActionOutputRegBuilder();
    NxActionOutputRegBuilder nxActionOutputBuilder = new NxActionOutputRegBuilder();
    nxActionOutputBuilder.setNBits(1);
    nxActionOutputBuilder.setSrc((long) 2);
    nxActionOutputBuilder.setMaxLen(3);
    actionOutputRegBuilder.setNxActionOutputReg(nxActionOutputBuilder.build());
    actionBuilder.setActionChoice(actionOutputRegBuilder.build());
    return actionBuilder.build();
}
Also used : ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) NxActionOutputRegBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputRegBuilder) ActionOutputRegBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputRegBuilder) NxActionOutputRegBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputRegBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)

Example 22 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ConntrackCodecTest method createAction.

private Action createAction() {
    NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder();
    nxActionConntrackBuilder.setFlags(1);
    nxActionConntrackBuilder.setZoneSrc((long) 2);
    nxActionConntrackBuilder.setConntrackZone(3);
    nxActionConntrackBuilder.setRecircTable((short) 4);
    NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder();
    nxActionNatBuilder.setFlags(5);
    nxActionNatBuilder.setRangePresent(0x3F);
    nxActionNatBuilder.setIpAddressMin(new IpAddress("192.168.0.0".toCharArray()));
    nxActionNatBuilder.setIpAddressMax(new IpAddress("192.168.10.0".toCharArray()));
    nxActionNatBuilder.setPortMin(3000);
    nxActionNatBuilder.setPortMax(4000);
    NxActionNatCaseBuilder nxActionNatCaseBuilder = new NxActionNatCaseBuilder();
    nxActionNatCaseBuilder.setNxActionNat(nxActionNatBuilder.build());
    CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
    ctActionsBuilder.setOfpactActions(nxActionNatCaseBuilder.build());
    List<CtActions> ctActionsList = new ArrayList<>();
    ctActionsList.add(ctActionsBuilder.build());
    nxActionNatBuilder = new NxActionNatBuilder();
    nxActionNatBuilder.setFlags(5);
    nxActionNatBuilder.setRangePresent(0x21);
    nxActionNatBuilder.setIpAddressMin(new IpAddress("192.168.0.0".toCharArray()));
    nxActionNatBuilder.setPortMax(4000);
    nxActionNatCaseBuilder = new NxActionNatCaseBuilder();
    nxActionNatCaseBuilder.setNxActionNat(nxActionNatBuilder.build());
    ctActionsBuilder = new CtActionsBuilder();
    ctActionsBuilder.setOfpactActions(nxActionNatCaseBuilder.build());
    ctActionsList.add(ctActionsBuilder.build());
    nxActionConntrackBuilder.setCtActions(ctActionsList);
    NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
    nxActionCtMarkBuilder.setCtMark((long) 36);
    NxActionCtMarkCaseBuilder nxActionCtMarkCaseBuilder = new NxActionCtMarkCaseBuilder();
    nxActionCtMarkCaseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
    ctActionsBuilder = new CtActionsBuilder();
    ctActionsBuilder.setOfpactActions(nxActionCtMarkCaseBuilder.build());
    ctActionsList.add(ctActionsBuilder.build());
    nxActionConntrackBuilder.setCtActions(ctActionsList);
    ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setExperimenterId(experimenterId);
    ActionConntrackBuilder actionConntrackBuilder = new ActionConntrackBuilder();
    actionConntrackBuilder.setNxActionConntrack(nxActionConntrackBuilder.build());
    actionBuilder.setActionChoice(actionConntrackBuilder.build());
    return actionBuilder.build();
}
Also used : NxActionCtMarkCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionCtMarkCaseBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) NxActionConntrackBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrackBuilder) ActionConntrackBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionConntrackBuilder) CtActions(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.nx.action.conntrack.CtActions) NxActionCtMarkBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder) NxActionNatBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder) ArrayList(java.util.ArrayList) CtActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.nx.action.conntrack.CtActionsBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) NxActionConntrackBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.conntrack.grouping.NxActionConntrackBuilder) NxActionNatCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.NxActionNatCaseBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 23 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ResubmitCodecTest method createAction.

private Action createAction(Short inPort, Byte table) {
    ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
    ActionBuilder actionBuilder = new ActionBuilder();
    actionBuilder.setExperimenterId(experimenterId);
    ActionResubmitBuilder actionResubmitBuilder = new ActionResubmitBuilder();
    NxActionResubmitBuilder nxActionResubmitBuilder = new NxActionResubmitBuilder();
    if (inPort != null) {
        nxActionResubmitBuilder.setInPort(inPort.intValue());
    }
    if (table != null) {
        nxActionResubmitBuilder.setTable(table.shortValue());
    }
    actionResubmitBuilder.setNxActionResubmit(nxActionResubmitBuilder.build());
    actionBuilder.setActionChoice(actionResubmitBuilder.build());
    return actionBuilder.build();
}
Also used : ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) NxActionResubmitBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.resubmit.grouping.NxActionResubmitBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) ActionResubmitBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionResubmitBuilder) NxActionResubmitBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.resubmit.grouping.NxActionResubmitBuilder)

Example 24 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class ActionExtensionHelperTest method testProcessAlienAction.

@Test
public void testProcessAlienAction() {
    ActionBuilder actionBuilder = new ActionBuilder();
    ExperimenterIdCaseBuilder experimenterIdCaseBuilder = new ExperimenterIdCaseBuilder();
    ExperimenterBuilder experimenterBuilder = new ExperimenterBuilder();
    experimenterBuilder.setExperimenter(new ExperimenterId(42L));
    experimenterIdCaseBuilder.setExperimenter(experimenterBuilder.build());
    actionBuilder.setActionChoice(experimenterIdCaseBuilder.build());
    Action action = ActionExtensionHelper.processAlienAction(actionBuilder.build(), OpenflowVersion.OF13, ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
    assertNotNull(action);
    assertEquals(MockAction.class, action.getImplementedInterface());
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) ExperimenterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.experimenter.id._case.ExperimenterBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) ExperimenterIdCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCaseBuilder) Test(org.junit.Test)

Example 25 with ExperimenterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId in project openflowplugin by opendaylight.

the class OnfExperimenterErrorFactory method deserialize.

@Override
public ErrorMessage deserialize(ByteBuf message) {
    ErrorMessageBuilder builder = new ErrorMessageBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(message.readUnsignedInt());
    int type = message.readUnsignedShort();
    ErrorType errorType = ErrorType.forValue(type);
    if (errorType != null && errorType.equals(ErrorType.EXPERIMENTER)) {
        builder.setType(errorType.getIntValue());
        builder.setTypeString(errorType.getName());
    } else {
        LOG.warn("Deserializing other than {} error message with {}", ErrorType.EXPERIMENTER.getName(), this.getClass().getCanonicalName());
        builder.setType(type);
        builder.setTypeString(UNKNOWN_TYPE);
    }
    int code = message.readUnsignedShort();
    OnfExperimenterErrorCode errorCode = OnfExperimenterErrorCode.forValue(code);
    if (errorCode != null) {
        builder.setCode(errorCode.getIntValue());
        builder.setCodeString(errorCode.getName());
    } else {
        builder.setCode(code);
        builder.setCodeString(UNKNOWN_CODE);
    }
    builder.addAugmentation(ExperimenterIdError.class, new ExperimenterIdErrorBuilder().setExperimenter(new ExperimenterId(message.readUnsignedInt())).build());
    if (message.readableBytes() > 0) {
        byte[] data = new byte[message.readableBytes()];
        message.readBytes(data);
        builder.setData(data);
    }
    return builder.build();
}
Also used : ErrorMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder) ErrorType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ErrorType) OnfExperimenterErrorCode(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.OnfExperimenterErrorCode) ExperimenterIdErrorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdErrorBuilder) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)

Aggregations

ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)37 Test (org.junit.Test)14 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)13 ExperimenterDataOfChoice (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice)9 ByteBuf (io.netty.buffer.ByteBuf)6 ExperimenterIdCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder)5 ExperimenterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder)5 ExperimenterInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInput)5 ExperimenterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterInputBuilder)5 ArrayList (java.util.ArrayList)4 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)4 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)3 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)3 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)3 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)2 MultipartRequestInputFactory (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)2 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)2 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)2 BigInteger (java.math.BigInteger)1