bc30c10079f2177ed8a8525783b17da39a52616c
[vpnservice.git] / interfacemgr / interfacemgr-impl / src / test / java / org / opendaylight / vpnservice / interfacemgr / test / IfmUtilTest.java
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.vpnservice.interfacemgr.test;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.mockito.Mockito.when;
13
14 import java.math.BigInteger;
15
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.mockito.Mock;
19 import org.mockito.MockitoAnnotations;
20 import org.opendaylight.vpnservice.interfacemgr.IfmUtil;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
22
23 public class IfmUtilTest {
24
25     @Mock NodeConnectorId ncId;
26     MockDataChangedEvent event;
27
28     @Before
29     public void setUp() throws Exception {
30         MockitoAnnotations.initMocks(this);
31     }
32
33     @Test
34     public void testDpnConversions() {
35         String NodeId = IfmUtil.buildDpnNodeId(BigInteger.valueOf(101)).getValue();
36         assertEquals("openflow:101", NodeId);
37         when(ncId.getValue()).thenReturn("openflow:101:11");
38         assertEquals("101",IfmUtil.getDpnFromNodeConnectorId(ncId));
39     }
40
41 }