use of org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionResponseConvertorData in project openflowplugin by opendaylight.
the class ActionConvertorV10Test method testToMDSalActions.
/**
* Test {@link ActionResponseConvertor#convert(List, ActionResponseConvertorData)}}.
*/
@Test
public void testToMDSalActions() {
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder outputBuilder = new OutputActionBuilder();
outputBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber(14L));
outputBuilder.setMaxLength(555);
caseBuilder.setOutputAction(outputBuilder.build());
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder();
actionBuilder.setActionChoice(caseBuilder.build());
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action> actions = new ArrayList<>();
actions.add(actionBuilder.build());
ActionResponseConvertorData data = new ActionResponseConvertorData(OFConstants.OFP_VERSION_1_0);
data.setActionPath(ActionPath.FLOWS_STATISTICS_UPDATE_APPLY_ACTIONS);
Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> mdSalActionsOptional = convertorManager.convert(actions, data);
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action> mdSalActions = mdSalActionsOptional.orElse(Collections.emptyList());
Assert.assertEquals("Wrong number of output actions", 1, mdSalActions.size());
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = mdSalActions.get(0);
Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight.action.types" + ".rev131112.action.action.OutputActionCase", action.getImplementedInterface().getName());
OutputActionCase outputAction = (OutputActionCase) action;
Assert.assertEquals("Wrong output port", "14", outputAction.getOutputAction().getOutputNodeConnector().getValue());
Assert.assertEquals("Wrong max length", 555, outputAction.getOutputAction().getMaxLength().intValue());
}
Aggregations