blob: d27159571ce8032d600d5a64fdde24b28963f768 [file] [log] [blame]
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301/*
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.types;
17
18import com.google.common.testing.EqualsTester;
19import org.junit.Test;
20
21import java.util.LinkedList;
22import java.util.List;
23
24/**
25 * Test case for TE link descriptors Tlv.
26 */
27public class LinkDescriptorsTlvTest {
28 private final LinkLocalRemoteIdentifiersSubTlv linkLocalRemoteIdentifiersTlv1 = new
29 LinkLocalRemoteIdentifiersSubTlv(10, 10);
30 private final IPv4InterfaceAddressSubTlv iPv4InterfaceAddressTlv1 = new IPv4InterfaceAddressSubTlv(0x01010101);
31
32 private final LinkLocalRemoteIdentifiersSubTlv linkLocalRemoteIdentifiersTlv2 = new
33 LinkLocalRemoteIdentifiersSubTlv(20, 20);
34 private final IPv4InterfaceAddressSubTlv iPv4InterfaceAddressTlv2 = new IPv4InterfaceAddressSubTlv(0x02020202);
35
36 private final List<PcepValueType> llLinkDescriptorsSubTLVs1 = new LinkedList<>();
37 private final boolean a = llLinkDescriptorsSubTLVs1.add(linkLocalRemoteIdentifiersTlv1);
38 private final boolean b = llLinkDescriptorsSubTLVs1.add(iPv4InterfaceAddressTlv1);
39
40 private final List<PcepValueType> llLinkDescriptorsSubTLVs2 = new LinkedList<>();
41 private final boolean c = llLinkDescriptorsSubTLVs2.add(linkLocalRemoteIdentifiersTlv2);
42 private final boolean d = llLinkDescriptorsSubTLVs2.add(iPv4InterfaceAddressTlv2);
43
44 private final LinkDescriptorsTlv tlv1 = LinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs1);
45 private final LinkDescriptorsTlv sameAstlv1 = LinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs1);
46 private final LinkDescriptorsTlv tlv2 = LinkDescriptorsTlv.of(llLinkDescriptorsSubTLVs2);
47
48 @Test
49 public void basics() {
50 new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals();
51 }
52
53}