Priyanka B | e586c26 | 2015-10-31 20:31:14 +0530 | [diff] [blame] | 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 | */ |
Ray Milkey | 753ad63 | 2015-11-06 08:46:33 -0800 | [diff] [blame] | 16 | package org.onosproject.bgpio.types; |
Priyanka B | e586c26 | 2015-10-31 20:31:14 +0530 | [diff] [blame] | 17 | |
| 18 | import java.util.ArrayList; |
| 19 | import java.util.List; |
| 20 | |
| 21 | import org.junit.Test; |
Priyanka B | e586c26 | 2015-10-31 20:31:14 +0530 | [diff] [blame] | 22 | |
| 23 | import com.google.common.testing.EqualsTester; |
| 24 | |
| 25 | /** |
| 26 | * Test for AsPath BGP Path Attribute. |
| 27 | */ |
| 28 | public class AsPathTest { |
| 29 | //Two scenarios aspath set and sequence |
| 30 | private final List<Short> aspathSet1 = new ArrayList<>(); |
| 31 | private final List<Short> aspathSet2 = new ArrayList<>(); |
| 32 | private final List<Short> aspathSeq1 = new ArrayList<>(); |
| 33 | private final List<Short> aspathSeq2 = new ArrayList<>(); |
| 34 | private final AsPath attr1 = new AsPath(aspathSet1, null); |
| 35 | private final AsPath sameAsAttr1 = new AsPath(aspathSet1, null); |
| 36 | private final AsPath attr2 = new AsPath(aspathSet2, null); |
| 37 | private final AsPath attr3 = new AsPath(null, aspathSeq1); |
| 38 | private final AsPath sameAsAttr3 = new AsPath(null, aspathSeq1); |
| 39 | private final AsPath attr4 = new AsPath(null, aspathSeq2); |
| 40 | |
| 41 | @Test |
| 42 | public void basics() { |
| 43 | aspathSet1.add((short) 100); |
| 44 | aspathSet1.add((short) 300); |
| 45 | aspathSet2.add((short) 200); |
| 46 | aspathSeq2.add((short) 400); |
| 47 | aspathSeq1.add((short) 300); |
| 48 | new EqualsTester() |
| 49 | .addEqualityGroup(attr1, sameAsAttr1) |
| 50 | .addEqualityGroup(attr2) |
| 51 | .addEqualityGroup(attr3, sameAsAttr3) |
| 52 | .addEqualityGroup(attr4) |
| 53 | .testEquals(); |
| 54 | } |
Ray Milkey | 753ad63 | 2015-11-06 08:46:33 -0800 | [diff] [blame] | 55 | } |