blob: 3ea56b64cac94abb156a2466dcd736fecd2e7f8b [file] [log] [blame]
Priyanka B4d5f8662015-10-31 20:41:24 +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 */
Ray Milkey753ad632015-11-06 08:46:33 -080016package org.onosproject.bgpio.types;
Priyanka B4d5f8662015-10-31 20:41:24 +053017
18import java.util.ArrayList;
19import java.util.List;
20
21import org.junit.Test;
Priyanka B4d5f8662015-10-31 20:41:24 +053022
23import com.google.common.testing.EqualsTester;
24
25/**
26 * Test for As4Path BGP Path Attribute.
27 */
28public class As4PathTest {
29 //Two scenarios as4path set and sequence
30 private final List<Integer> as4pathSet1 = new ArrayList<>();
31 private final List<Integer> as4pathSeq1 = new ArrayList<>();
32 private final List<Integer> as4pathSet2 = new ArrayList<>();
33 private final List<Integer> as4pathSeq2 = new ArrayList<>();
34 private final As4Path attr1 = new As4Path(as4pathSet1, null);
35 private final As4Path sameAsAttr1 = new As4Path(as4pathSet1, null);
36 private final As4Path attr2 = new As4Path(as4pathSet2, null);
37 private final As4Path attr3 = new As4Path(null, as4pathSeq1);
38 private final As4Path sameAsAttr3 = new As4Path(null, as4pathSeq1);
39 private final As4Path attr4 = new As4Path(null, as4pathSeq2);
40
41 @Test
42 public void basics() {
43 as4pathSet1.add(197358);
44 as4pathSet1.add(12883);
45 as4pathSet2.add(2008989);
46 as4pathSeq1.add(3009009);
47 as4pathSeq2.add(409900);
48 new EqualsTester()
49 .addEqualityGroup(attr1, sameAsAttr1)
50 .addEqualityGroup(attr2)
51 .addEqualityGroup(attr3, sameAsAttr3)
52 .addEqualityGroup(attr4)
53 .testEquals();
54 }
Ray Milkey753ad632015-11-06 08:46:33 -080055}