Shashikanth VH | fe2fb20 | 2016-02-05 18:45:07 +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.protocol.flowspec; |
| 17 | |
| 18 | import org.junit.Test; |
| 19 | |
| 20 | import org.onlab.packet.IpPrefix; |
| 21 | |
| 22 | import com.google.common.testing.EqualsTester; |
| 23 | |
| 24 | /** |
| 25 | * Test for BgpFsDestinationPrefix flow specification component. |
| 26 | */ |
| 27 | public class BgpFlowSpecPrefixTest { |
| 28 | private IpPrefix destinationPrefix1 = IpPrefix.valueOf("21.21.21.21/16"); |
| 29 | private IpPrefix sourcePrefix1 = IpPrefix.valueOf("11.11.11.11/16"); |
| 30 | private IpPrefix destinationPrefix2 = IpPrefix.valueOf("42.42.42.42/16"); |
| 31 | private IpPrefix sourcePrefix2 = IpPrefix.valueOf("32.32.32.32/16"); |
| 32 | |
| 33 | private final BgpFlowSpecPrefix tlv1 = new BgpFlowSpecPrefix(destinationPrefix1, sourcePrefix1); |
| 34 | private final BgpFlowSpecPrefix sameAsTlv1 = new BgpFlowSpecPrefix(destinationPrefix1, sourcePrefix1); |
| 35 | private final BgpFlowSpecPrefix tlv2 = new BgpFlowSpecPrefix(destinationPrefix2, sourcePrefix2); |
| 36 | |
| 37 | @Test |
| 38 | public void testEquality() { |
| 39 | new EqualsTester() |
| 40 | .addEqualityGroup(tlv1, sameAsTlv1) |
| 41 | .addEqualityGroup(tlv2) |
| 42 | .testEquals(); |
| 43 | } |
| 44 | } |