2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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
8 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
10 import static org.junit.Assert.*;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
15 public class IpConverterTest {
18 public void testIpv4AddressToLong() {
19 Ipv4Address ipAddress = new Ipv4Address("192.168.1.2");
20 long address = 0xc0a80102L;
21 assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
25 public void testIpv4AddressToLong2() {
26 Ipv4Address ipAddress = new Ipv4Address("10.168.1.2");
27 long address = 0x0aa80102L;
28 assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));