blob: 78011c8c91afcd253828c6b78803ac3d652f8dc4 [file] [log] [blame]
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05303 *
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 Attribute Tlv.
26 */
27public class LinkAttributesTlvTest {
28
29 private final AdministrativeGroupSubTlv administrativeGroupTlv1 = new AdministrativeGroupSubTlv(10);
30 private final MaximumReservableLinkBandwidthSubTlv maximumReservableLinkBandwidthTlv1 =
31 new MaximumReservableLinkBandwidthSubTlv(20);
32
33 private final AdministrativeGroupSubTlv administrativeGroupTlv2 = new AdministrativeGroupSubTlv(20);
34 private final MaximumReservableLinkBandwidthSubTlv maximumReservableLinkBandwidthTlv2 =
35 new MaximumReservableLinkBandwidthSubTlv(30);
36
37 private final List<PcepValueType> llLinkAttributesSubTLV1 = new LinkedList<>();
38 private final boolean a = llLinkAttributesSubTLV1.add(administrativeGroupTlv1);
39 private final boolean b = llLinkAttributesSubTLV1.add(maximumReservableLinkBandwidthTlv1);
40
41 private final List<PcepValueType> llLinkAttributesSubTLV2 = new LinkedList<>();
42
43 private final boolean c = llLinkAttributesSubTLV2.add(administrativeGroupTlv2);
44 private final boolean d = llLinkAttributesSubTLV2.add(maximumReservableLinkBandwidthTlv2);
45
46 private final LinkAttributesTlv tlv1 = LinkAttributesTlv.of(llLinkAttributesSubTLV1);
47 private final LinkAttributesTlv sameAsTlv1 = LinkAttributesTlv.of(llLinkAttributesSubTLV1);
48 private final LinkAttributesTlv tlv2 = LinkAttributesTlv.of(llLinkAttributesSubTLV2);
49
50 @Test
51 public void basics() {
52 new EqualsTester().addEqualityGroup(tlv1, sameAsTlv1).addEqualityGroup(tlv2).testEquals();
53 }
54
55}