blob: 17d440917875e2f5485ebe9f6941bbacbfef62d2 [file] [log] [blame]
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.pcepio;
17
18import java.util.LinkedList;
19
20import org.junit.Test;
21import org.onosproject.pcepio.types.IPv4TERouterIdOfLocalNodeTlv;
22import org.onosproject.pcepio.types.NodeFlagBitsTlv;
23import org.onosproject.pcepio.types.PcepValueType;
24import org.onosproject.pcepio.types.TENodeAttributesTlv;
25
26import com.google.common.testing.EqualsTester;
27
28/**
29 * Test case for TE Node Attribute tlv.
30 */
31public class TENodeAttributesTlvTest {
32
33 private final NodeFlagBitsTlv nodeFlagBitsTlv1 = new NodeFlagBitsTlv((byte) 10);
34 private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv1 = new
35 IPv4TERouterIdOfLocalNodeTlv(0x01010101);
36
37 private final NodeFlagBitsTlv nodeFlagBitsTlv2 = new NodeFlagBitsTlv((byte) 20);
38 private final IPv4TERouterIdOfLocalNodeTlv iPv4TERouterIdOfLocalNodeTlv2 = new
39 IPv4TERouterIdOfLocalNodeTlv(0x02020202);
40
41 private final LinkedList<PcepValueType> llNodeAttributesSubTLV1 = new LinkedList<>();
42 private final boolean a = llNodeAttributesSubTLV1.add(nodeFlagBitsTlv1);
43 private final boolean b = llNodeAttributesSubTLV1.add(iPv4TERouterIdOfLocalNodeTlv1);
44
45 private final LinkedList<PcepValueType> llNodeAttributesSubTLV2 = new LinkedList<>();
46
47 private final boolean c = llNodeAttributesSubTLV2.add(nodeFlagBitsTlv2);
48 private final boolean d = llNodeAttributesSubTLV2.add(iPv4TERouterIdOfLocalNodeTlv2);
49
50 private final TENodeAttributesTlv tlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1);
51 private final TENodeAttributesTlv sameAsTlv1 = TENodeAttributesTlv.of(llNodeAttributesSubTLV1);
52 private final TENodeAttributesTlv tlv2 = TENodeAttributesTlv.of(llNodeAttributesSubTLV2);
53
54 @Test
55 public void basics() {
56 new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
57 }
58
59}