Shashikanth VH | 60e7398 | 2016-02-10 11:25:34 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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.bgpio.types; |
| 17 | |
| 18 | import org.junit.Test; |
| 19 | import org.onlab.packet.IpAddress; |
| 20 | import org.onlab.packet.IpPrefix; |
| 21 | import com.google.common.testing.EqualsTester; |
| 22 | |
| 23 | /** |
| 24 | * Test for source prefix flow specification component. |
| 25 | */ |
| 26 | public class BgpFsSourcePrefixTest { |
| 27 | private final byte length = 4; |
| 28 | |
| 29 | private final IpPrefix prefix = IpPrefix.valueOf(IpAddress.valueOf("10.0.1.1"), 32); |
| 30 | |
| 31 | private final byte length2 = 4; |
| 32 | private final IpPrefix prefix2 = IpPrefix.valueOf(IpAddress.valueOf("10.0.1.2"), 32); |
| 33 | |
| 34 | private final BgpFsSourcePrefix tlv1 = new BgpFsSourcePrefix(length, prefix); |
| 35 | private final BgpFsSourcePrefix sameAsTlv1 = new BgpFsSourcePrefix(length, prefix); |
| 36 | private final BgpFsSourcePrefix tlv2 = new BgpFsSourcePrefix(length2, prefix2); |
| 37 | |
| 38 | @Test |
| 39 | public void testEquality() { |
| 40 | new EqualsTester() |
| 41 | .addEqualityGroup(tlv1, sameAsTlv1) |
| 42 | .addEqualityGroup(tlv2) |
| 43 | .testEquals(); |
| 44 | } |
| 45 | } |