Committed by
Gerrit Code Review
[ONOS-2613] Unit test the BGP Update message
Change-Id: I3002ef0104155150d9026aabbdcfac62fee04051
Showing
1 changed file
with
56 additions
and
0 deletions
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.AsPath; | ||
23 | + | ||
24 | +import com.google.common.testing.EqualsTester; | ||
25 | + | ||
26 | +/** | ||
27 | + * Test for AsPath BGP Path Attribute. | ||
28 | + */ | ||
29 | +public class AsPathTest { | ||
30 | + //Two scenarios aspath set and sequence | ||
31 | + private final List<Short> aspathSet1 = new ArrayList<>(); | ||
32 | + private final List<Short> aspathSet2 = new ArrayList<>(); | ||
33 | + private final List<Short> aspathSeq1 = new ArrayList<>(); | ||
34 | + private final List<Short> aspathSeq2 = new ArrayList<>(); | ||
35 | + private final AsPath attr1 = new AsPath(aspathSet1, null); | ||
36 | + private final AsPath sameAsAttr1 = new AsPath(aspathSet1, null); | ||
37 | + private final AsPath attr2 = new AsPath(aspathSet2, null); | ||
38 | + private final AsPath attr3 = new AsPath(null, aspathSeq1); | ||
39 | + private final AsPath sameAsAttr3 = new AsPath(null, aspathSeq1); | ||
40 | + private final AsPath attr4 = new AsPath(null, aspathSeq2); | ||
41 | + | ||
42 | + @Test | ||
43 | + public void basics() { | ||
44 | + aspathSet1.add((short) 100); | ||
45 | + aspathSet1.add((short) 300); | ||
46 | + aspathSet2.add((short) 200); | ||
47 | + aspathSeq2.add((short) 400); | ||
48 | + aspathSeq1.add((short) 300); | ||
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 |
-
Please register or login to post a comment