Priyanka B
Committed by Ray Milkey

[ONOS-2613] Unit test the BGP Update message

Change-Id: I54ece9cdfee2e7c6069b6a5a74b491e63aa861b9
1 +/*
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 + */
16 +package org.onosproject.bgp;
17 +
18 +import java.util.ArrayList;
19 +import java.util.List;
20 +
21 +import org.junit.Test;
22 +import org.onosproject.bgpio.types.As4Path;
23 +
24 +import com.google.common.testing.EqualsTester;
25 +
26 +/**
27 + * Test for As4Path BGP Path Attribute.
28 + */
29 +public class As4PathTest {
30 + //Two scenarios as4path set and sequence
31 + private final List<Integer> as4pathSet1 = new ArrayList<>();
32 + private final List<Integer> as4pathSeq1 = new ArrayList<>();
33 + private final List<Integer> as4pathSet2 = new ArrayList<>();
34 + private final List<Integer> as4pathSeq2 = new ArrayList<>();
35 + private final As4Path attr1 = new As4Path(as4pathSet1, null);
36 + private final As4Path sameAsAttr1 = new As4Path(as4pathSet1, null);
37 + private final As4Path attr2 = new As4Path(as4pathSet2, null);
38 + private final As4Path attr3 = new As4Path(null, as4pathSeq1);
39 + private final As4Path sameAsAttr3 = new As4Path(null, as4pathSeq1);
40 + private final As4Path attr4 = new As4Path(null, as4pathSeq2);
41 +
42 + @Test
43 + public void basics() {
44 + as4pathSet1.add(197358);
45 + as4pathSet1.add(12883);
46 + as4pathSet2.add(2008989);
47 + as4pathSeq1.add(3009009);
48 + as4pathSeq2.add(409900);
49 + new EqualsTester()
50 + .addEqualityGroup(attr1, sameAsAttr1)
51 + .addEqualityGroup(attr2)
52 + .addEqualityGroup(attr3, sameAsAttr3)
53 + .addEqualityGroup(attr4)
54 + .testEquals();
55 + }
56 +}
...\ No newline at end of file ...\ No newline at end of file