Merge "BUG-113: Move Linkstate NLRI parser to linkstate component"
[bgpcep.git] / concepts / src / test / java / org / opendaylight / protocol / concepts / IPAddressesAndPrefixesTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. 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 package org.opendaylight.protocol.concepts;
9
10 import static org.junit.Assert.assertTrue;
11
12 import java.net.UnknownHostException;
13
14 import org.junit.Test;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
18 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
20
21 public class IPAddressesAndPrefixesTest {
22
23         @Test
24         public void test3() {
25                 assertTrue("123.123.123.123".equals(new Ipv4Address("123.123.123.123").getValue()));
26                 assertTrue("2001::1".equals(new Ipv6Address("2001::1").getValue()));
27         }
28
29         @Test
30         public void test4() throws UnknownHostException {
31                 assertTrue(new IpPrefix(new Ipv4Prefix("123.123.123.123")).getIpv4Prefix() != null);
32                 assertTrue(new IpPrefix(new Ipv6Prefix("2001::1")).getIpv6Prefix() != null);
33         }
34
35         @Test
36         public void test5() {
37                 assertTrue("123.123.123.123/24".equals(new Ipv4Prefix("123.123.123.123/24").getValue()));
38                 assertTrue("2001::1/120".equals(new Ipv6Prefix("2001::1/120").getValue()));
39         }
40 }