use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipath in project openflowplugin by opendaylight.
the class MultipathConvertorTest method setUp.
@Before
public void setUp() throws Exception {
final NxMultipath nxMultipath = Mockito.mock(NxMultipath.class);
when(bucketActionsCase.getNxMultipath()).thenReturn(nxMultipath);
final Dst dst = Mockito.mock(Dst.class);
when(dst.getStart()).thenReturn(1);
when(dst.getEnd()).thenReturn(2);
final DstNxNspCase dstNxNspCase = Mockito.mock(DstNxNspCase.class);
when(dst.getDstChoice()).thenReturn(dstNxNspCase);
when(nxMultipath.getFields()).thenReturn(OfjNxHashFields.NXHASHFIELDSETHSRC);
when(nxMultipath.getBasis()).thenReturn(2);
when(nxMultipath.getAlgorithm()).thenReturn(OfjNxMpAlgorithm.NXMPALGHASHTHRESHOLD);
when(nxMultipath.getMaxLink()).thenReturn(2);
when(nxMultipath.getArg()).thenReturn(2L);
when(nxMultipath.getDst()).thenReturn(dst);
final ActionMultipath actionMultipath = Mockito.mock(ActionMultipath.class);
final NxActionMultipath nxActionMultipath = Mockito.mock(NxActionMultipath.class);
when(nxActionMultipath.getDst()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
when(nxActionMultipath.getBasis()).thenReturn(1);
when(nxActionMultipath.getAlgorithm()).thenReturn(OfjNxMpAlgorithm.NXMPALGHRW);
when(nxActionMultipath.getMaxLink()).thenReturn(2);
when(nxActionMultipath.getArg()).thenReturn(2L);
when(actionMultipath.getNxActionMultipath()).thenReturn(nxActionMultipath);
when(action.getActionChoice()).thenReturn(actionMultipath);
multipathConvertor = new MultipathConvertor();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipath in project openflowplugin by opendaylight.
the class MultipathConvertor method convert.
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
NxActionMultipath action = ((ActionMultipath) input.getActionChoice()).getNxActionMultipath();
DstBuilder dstBuilder = new DstBuilder();
dstBuilder.setDstChoice(RegMoveConvertor.resolveDstValue(action.getDst()));
dstBuilder.setStart(resolveStart(action.getOfsNbits()));
dstBuilder.setEnd(resolveEnd(action.getOfsNbits()));
NxMultipathBuilder builder = new NxMultipathBuilder();
builder.setBasis(action.getBasis());
builder.setAlgorithm(action.getAlgorithm());
builder.setMaxLink(action.getMaxLink());
builder.setArg(action.getArg());
builder.setDst(dstBuilder.build());
return resolveAction(builder.build(), path);
}
Aggregations