Search in sources :

Example 1 with NxActionRegLoad

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad in project openflowplugin by opendaylight.

the class RegLoadConvertorTest method setUp.

@Before
public void setUp() throws Exception {
    final NxRegLoad nxRegLoad = Mockito.mock(NxRegLoad.class);
    final Dst dst = Mockito.mock(Dst.class);
    when(dst.getStart()).thenReturn(1);
    when(dst.getEnd()).thenReturn(2);
    when(nxRegLoad.getDst()).thenReturn(dst);
    when(nxRegLoad.getValue()).thenReturn(BigInteger.valueOf(3L));
    when(nxRegLoad.getDst().getDstChoice()).thenReturn(Mockito.mock(DstNxTunIdCase.class));
    when(actionsCase.getNxRegLoad()).thenReturn(nxRegLoad);
    final ActionRegLoad actionRegLoad = Mockito.mock(ActionRegLoad.class);
    final NxActionRegLoad nxActionRegLoad = Mockito.mock(NxActionRegLoad.class);
    when(nxActionRegLoad.getDst()).thenReturn(NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong());
    when(nxActionRegLoad.getOfsNbits()).thenReturn(4);
    when(nxActionRegLoad.getValue()).thenReturn(BigInteger.ONE);
    when(actionRegLoad.getNxActionRegLoad()).thenReturn(nxActionRegLoad);
    when(action.getActionChoice()).thenReturn(actionRegLoad);
    regLoadConvertor = new RegLoadConvertor();
}
Also used : Dst(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.Dst) NxActionRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad) DstNxTunIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase) ActionRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad) NxActionRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad) NxRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoad) Before(org.junit.Before)

Example 2 with NxActionRegLoad

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad in project openflowplugin by opendaylight.

the class RegLoadConvertor method convert.

@Override
public org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action convert(final Action input, final ActionPath path) {
    NxActionRegLoad actionRegLoad = ((ActionRegLoad) input.getActionChoice()).getNxActionRegLoad();
    DstBuilder dstBuilder = new DstBuilder();
    dstBuilder.setDstChoice(RegMoveConvertor.resolveDstValue(actionRegLoad.getDst()));
    dstBuilder.setStart(resolveStart(actionRegLoad.getOfsNbits()));
    dstBuilder.setEnd(resolveEnd(actionRegLoad.getOfsNbits()));
    NxRegLoadBuilder nxRegLoadBuilder = new NxRegLoadBuilder();
    nxRegLoadBuilder.setDst(dstBuilder.build());
    nxRegLoadBuilder.setValue(actionRegLoad.getValue());
    return resolveAction(nxRegLoadBuilder.build(), path);
}
Also used : DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder) NxActionRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad) NxRegLoadBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder) ActionRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad) NxActionRegLoad(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad)

Aggregations

ActionRegLoad (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad)2 NxActionRegLoad (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoad)2 Before (org.junit.Before)1 DstNxTunIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstNxTunIdCase)1 NxRegLoad (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoad)1 NxRegLoadBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.NxRegLoadBuilder)1 Dst (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.Dst)1 DstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.nx.action.reg.load.grouping.nx.reg.load.DstBuilder)1