import static org.mockito.Mockito.when;
import java.math.BigInteger;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
+import org.opendaylight.openflowplugin.impl.registry.flow.FlowDescriptorFactory;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
@Override
public void setUp() throws Exception {
- service = new FlowDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new FlowDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
- when(registry.storeIfNecessary(any())).thenReturn(new FlowId("1"));
+ when(registry.retrieveDescriptor(any())).thenReturn(FlowDescriptorFactory.create(TABLE_NO, new FlowId("1")));
when(deviceContext.getDeviceFlowRegistry()).thenReturn(registry);
}
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getTableId()).thenReturn(TABLE_NO);
- final MultipartRequestFlowCase body = (MultipartRequestFlowCase) service.buildRequestBody(input);
+ final MultipartRequestFlowCase body = (MultipartRequestFlowCase) ((MultipartRequestInput) service
+ .buildRequest(new Xid(42L), input))
+ .getMultipartRequestBody();
+
final MultipartRequestFlow flow = body.getMultipartRequestFlow();
assertEquals(TABLE_NO, flow.getTableId());
.setByteCount(BigInteger.ONE)
.setPacketCount(BigInteger.ONE)
.setFlags(mock(FlowModFlags.class))
- .setMatch(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder()
+ .setMatch(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder()
.setMatchEntry(Collections.emptyList())
.build())
.build();
when(stat.getTableId()).thenReturn(TABLE_NO);
when(stat.getMatch()).thenReturn(new MatchBuilder().build());
- final List<FlowAndStatisticsMapList> stats = Arrays.asList(stat);
+ final List<FlowAndStatisticsMapList> stats = Collections.singletonList(stat);
final GetFlowStatisticsOutput output = mock(GetFlowStatisticsOutput.class);
when(output.getFlowAndStatisticsMapList()).thenReturn(stats);