BUG-204 : Cleanup models to follow convention
[bgpcep.git] / bgp / parser-impl / src / test / java / org / opendaylight / protocol / bgp / parser / impl / RouteTargetCommunityTest.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.bgp.parser.impl;
9
10 import static org.junit.Assert.assertArrayEquals;
11 import static org.junit.Assert.assertEquals;
12
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.route.target.extended.community._case.RouteTargetExtendedCommunity;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.route.target.extended.community._case.RouteTargetExtendedCommunityBuilder;
18
19 public class RouteTargetCommunityTest {
20
21         private RouteTargetExtendedCommunity community;
22
23         @Before
24         public void init() {
25                 final AsNumber globalAdmin = new AsNumber(429496729800L);
26                 final byte[] localAdmin = new byte[] { 10, 0, 0, 1 };
27                 this.community = new RouteTargetExtendedCommunityBuilder().setGlobalAdministrator(globalAdmin).setLocalAdministrator(localAdmin).build();
28         }
29
30         @Test
31         public void testGetGlobalAdmin() {
32                 final AsNumber testAsn = new AsNumber(429496729800L);
33                 assertEquals(this.community.getGlobalAdministrator(), testAsn);
34         }
35
36         @Test
37         public void testGetLocalAdmin() {
38                 assertArrayEquals(new byte[] { 10, 0, 0, 1 }, this.community.getLocalAdministrator());
39         }
40 }