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();
}
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();
}
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();
}
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());
}
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();
}
Aggregations