* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowplugin.impl.statistics.services.direct.multilayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
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.junit.Test;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractDirectStatisticsServiceTest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetQueueStatisticsInput;
public void testBuildRequestBody() throws Exception {
final GetQueueStatisticsInput input = mock(GetQueueStatisticsInput.class);
- when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
+ lenient().when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
when(input.getNodeConnectorId()).thenReturn(new NodeConnectorId(NODE_ID + ":" + PORT_NO));
assertEquals(map.getNodeConnectorId(), nodeConnectorId);
}
+ @Test
+ public void testStoreStatisticsBarePortNo() throws Exception {
+ final QueueIdAndStatisticsMap map = mock(QueueIdAndStatisticsMap.class);
+ when(map.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
+ when(map.getNodeConnectorId()).thenReturn(new NodeConnectorId("1"));
+
+ final List<QueueIdAndStatisticsMap> maps = Collections.singletonList(map);
+ final GetQueueStatisticsOutput output = mock(GetQueueStatisticsOutput.class);
+ when(output.getQueueIdAndStatisticsMap()).thenReturn(maps);
+
+ multipartWriterProvider.lookup(MultipartType.OFPMPQUEUE).get().write(output, true);
+ verify(deviceContext).writeToTransactionWithParentsSlow(eq(LogicalDatastoreType.OPERATIONAL), any(), any());
+ }
+
@Override
public void testStoreStatistics() throws Exception {
final QueueIdAndStatisticsMap map = mock(QueueIdAndStatisticsMap.class);
when(map.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
+ when(map.getNodeConnectorId()).thenReturn(new NodeConnectorId("openflow:1:1"));
final List<QueueIdAndStatisticsMap> maps = Collections.singletonList(map);
final GetQueueStatisticsOutput output = mock(GetQueueStatisticsOutput.class);