2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.applications.bulk.o.matic;
11 import org.junit.Assert;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * Test for {@link BulkOMaticUtils}.
21 public class BulkOMaticUtilsTest {
23 private static final Logger LOG = LoggerFactory.getLogger(BulkOMaticUtilsTest.class);
24 private static final String FLOW_ID = "1";
27 public void testIpIntToStr() {
28 Assert.assertEquals("255.255.255.255/32", BulkOMaticUtils.ipIntToStr(0xffffffff));
29 Assert.assertEquals("255.255.255.255/32", BulkOMaticUtils.ipIntToStr(-1));
30 Assert.assertEquals("0.0.0.0/32", BulkOMaticUtils.ipIntToStr(0));
31 Assert.assertEquals("1.2.3.4/32", BulkOMaticUtils.ipIntToStr(0x01020304));
35 public void testGetMatch() {
36 final Match match = BulkOMaticUtils.getMatch(0xffffffff);
37 Assert.assertNotNull(match);
41 public void testBuildFlow() {
42 final Match match = BulkOMaticUtils.getMatch(0xffffffff);
43 final Flow flow = BulkOMaticUtils.buildFlow((short)1, FLOW_ID, match);
44 Assert.assertEquals(FLOW_ID,flow.getId().getValue());
45 Assert.assertEquals((short) 1 ,flow.getTableId().shortValue());
49 public void testGetFlowInstanceIdentifier() {
50 Assert.assertNotNull(BulkOMaticUtils.getFlowInstanceIdentifier((short)1, "1", "1"));
54 public void testGetFlowCapableNodeId() {
55 Assert.assertNotNull(BulkOMaticUtils.getFlowCapableNodeId("1"));
59 public void testGetTableId() {
60 Assert.assertNotNull(BulkOMaticUtils.getTableId((short)1, "1"));
64 public void testGetFlowId() {
65 Assert.assertNotNull(BulkOMaticUtils.getFlowId(BulkOMaticUtils.getTableId((short)1, "1"), "1"));