use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove in project openflowplugin by opendaylight.
the class RegMoveCodecTest method deserializeTest.
@Test
public void deserializeTest() {
createBuffer(buffer);
action = regMoveCodec.deserialize(buffer);
ActionRegMove result = (ActionRegMove) action.getActionChoice();
assertEquals(1, result.getNxActionRegMove().getNBits().shortValue());
assertEquals(2, result.getNxActionRegMove().getSrcOfs().shortValue());
assertEquals(3, result.getNxActionRegMove().getDstOfs().shortValue());
assertEquals(4, result.getNxActionRegMove().getSrc().intValue());
assertEquals(5, result.getNxActionRegMove().getDst().intValue());
assertEquals(0, buffer.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove in project netvirt by opendaylight.
the class NexthopManager method buildBucketForDcGwLbGroup.
private Bucket buildBucketForDcGwLbGroup(String ipAddress, BigInteger dpnId, int index) {
List<Action> listAction = new ArrayList<>();
// ActionKey 0 goes to mpls label.
int actionKey = 1;
listAction.add(new ActionPushMpls().buildAction());
listAction.add(new ActionRegMove(actionKey++, FibConstants.NXM_REG_MAPPING.get(index), 0, 19).buildAction());
String tunnelInterfaceName = getTunnelInterfaceName(dpnId, new IpAddress(ipAddress.toCharArray()));
List<Action> egressActions = getEgressActions(tunnelInterfaceName, actionKey++);
if (!egressActions.isEmpty()) {
listAction.addAll(getEgressActions(tunnelInterfaceName, actionKey++));
} else {
// clear off actions if there is no egress actions.
listAction = Collections.emptyList();
}
return MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, index, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove in project openflowplugin by opendaylight.
the class RegMoveConvertor method convert.
@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(Action input, ActionPath path) {
NxActionRegMove actionRegMove = ((ActionRegMove) input.getActionChoice()).getNxActionRegMove();
DstBuilder dstBuilder = new DstBuilder();
dstBuilder.setDstChoice(resolveDstValue(actionRegMove.getDst()));
dstBuilder.setStart(actionRegMove.getDstOfs());
dstBuilder.setEnd(actionRegMove.getDstOfs() + actionRegMove.getNBits() - 1);
SrcBuilder srcBuilder = new SrcBuilder();
srcBuilder.setSrcChoice(resolveSrcValue(actionRegMove.getSrc()));
srcBuilder.setStart(actionRegMove.getSrcOfs());
srcBuilder.setEnd(actionRegMove.getSrcOfs() + actionRegMove.getNBits() - 1);
NxRegMoveBuilder nxRegMoveBuilder = new NxRegMoveBuilder();
nxRegMoveBuilder.setDst(dstBuilder.build());
nxRegMoveBuilder.setSrc(srcBuilder.build());
return resolveAction(nxRegMoveBuilder.build(), path);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove in project openflowplugin by opendaylight.
the class RegMoveCodec method serialize.
@Override
public void serialize(final Action input, final ByteBuf outBuffer) {
ActionRegMove actionRegMove = (ActionRegMove) input.getActionChoice();
serializeHeader(LENGTH, SUBTYPE, outBuffer);
outBuffer.writeShort(actionRegMove.getNxActionRegMove().getNBits());
outBuffer.writeShort(actionRegMove.getNxActionRegMove().getSrcOfs());
outBuffer.writeShort(actionRegMove.getNxActionRegMove().getDstOfs());
outBuffer.writeInt(actionRegMove.getNxActionRegMove().getSrc().intValue());
outBuffer.writeInt(actionRegMove.getNxActionRegMove().getDst().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove in project openflowplugin by opendaylight.
the class RegMoveConvertorTest method setUp.
@Before
public void setUp() throws Exception {
final Src src = Mockito.mock(Src.class);
final Dst dst = Mockito.mock(Dst.class);
when(actionsCase.getNxRegMove()).thenReturn(nxRegMove);
when(nxRegMove.getSrc()).thenReturn(src);
when(nxRegMove.getDst()).thenReturn(dst);
when(nxRegMove.getSrc().getStart()).thenReturn(1);
when(nxRegMove.getSrc().getEnd()).thenReturn(2);
when(nxRegMove.getDst().getStart()).thenReturn(3);
when(nxRegMove.getDst().getEnd()).thenReturn(4);
when(nxRegMove.getDst().getDstChoice()).thenReturn(Mockito.mock(DstNxTunIdCase.class));
when(nxRegMove.getSrc().getSrcChoice()).thenReturn(Mockito.mock(SrcNxTunIdCase.class));
final ActionRegMove actionRegMove = Mockito.mock(ActionRegMove.class);
final NxActionRegMove nxActionRegMove = Mockito.mock(NxActionRegMove.class);
when(nxActionRegMove.getSrc()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
when(nxActionRegMove.getDst()).thenReturn(NiciraMatchCodecs.TUN_ID_CODEC.getHeaderWithoutHasMask().toLong());
when(nxActionRegMove.getNBits()).thenReturn(7);
when(actionRegMove.getNxActionRegMove()).thenReturn(nxActionRegMove);
when(action.getActionChoice()).thenReturn(actionRegMove);
regMoveConvertor = new RegMoveConvertor();
}
Aggregations