+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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;
import static org.junit.Assert.assertEquals;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
private static final BigInteger DUMMY_DATAPATH_ID = new BigInteger("21");
private static final Long DUMMY_XID = 1L;
- private static final SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator();
+ private SinglePurposeMultipartReplyTranslator singlePurposeMultipartReplyTranslator;
private static final BigInteger DUMMY_BYTE_COUNT = new BigInteger("31");
private static final BigInteger DUMMY_PACKET_COUNT = new BigInteger("41");
private static final Long DUMMY_FLOW_COUNT = 51L;
private static final Long DUMMY_REF_COUNT = 1234L;
private static final GroupTypes DUMMY_GROUPS_TYPE = GroupTypes.GroupAll;
private static final GroupType DUMMY_GROUP_TYPE = GroupType.OFPGTALL;
- private static final Long GROUP_ACTION_BITMAP = 0b00000000000000000000000000000000000001111111111111001100000000001L;
+
+ @Before
+ public void setUp() {
+ final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ singlePurposeMultipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorManager);
+ }
@Test
public void testTranslateFlow() {
assertEquals(DUMMY_GROUPS_TYPE,groupDescStat.getGroupType() );
}
- @Test
- public void getGroupActionsSupportBitmap() {
- ActionType actionSupported = new ActionType(true,true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);
- final List<Long> groupActionsSupportBitmap = SinglePurposeMultipartReplyTranslator.getGroupActionsSupportBitmap(Lists.newArrayList(actionSupported));
- assertEquals(1, groupActionsSupportBitmap.size());
- final Long bitmap = groupActionsSupportBitmap.get(0);
- assertEquals(GROUP_ACTION_BITMAP, bitmap);
- }
-
private MultipartReplyBody prepareMultipartReplyGroupDesc() {
MultipartReplyGroupDescCaseBuilder multipartReplyGroupDescCaseBuilder = new MultipartReplyGroupDescCaseBuilder();
MultipartReplyGroupDescBuilder multipartReplyGroupDescBuilder = new MultipartReplyGroupDescBuilder();