Committed by
Gerrit Code Review
[onos-2613] - Unit testing of BgpPrefixAttrOspfFwdAddrTest
Change-Id: I907ae5fffbd270e2ac6c1da6ce005a3ec3633c89
Showing
1 changed file
with
52 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 org.junit.Test; | ||
| 19 | +import org.onlab.packet.Ip4Address; | ||
| 20 | +import org.onlab.packet.Ip6Address; | ||
| 21 | +import org.onosproject.bgpio.types.attr.BgpPrefixAttrOspfFwdAddr; | ||
| 22 | + | ||
| 23 | +import com.google.common.testing.EqualsTester; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * Test for BGP prefix metric attribute. | ||
| 27 | + */ | ||
| 28 | +public class BgpPrefixAttrOspfFwdAddrTest { | ||
| 29 | + | ||
| 30 | + private final short lsAttrLength = 4; | ||
| 31 | + private final Ip4Address ip4RouterId = Ip4Address.valueOf("192.168.1.1"); | ||
| 32 | + private final Ip6Address ip6RouterId = Ip6Address | ||
| 33 | + .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001"); | ||
| 34 | + | ||
| 35 | + private final short lsAttrLength1 = 16; | ||
| 36 | + private final Ip4Address ip4RouterId1 = Ip4Address.valueOf("192.168.1.2"); | ||
| 37 | + private final Ip6Address ip6RouterId1 = Ip6Address | ||
| 38 | + .valueOf("1002:0db8:0a0b:12f0:0000:0000:0000:0002"); | ||
| 39 | + | ||
| 40 | + private final BgpPrefixAttrOspfFwdAddr data = BgpPrefixAttrOspfFwdAddr | ||
| 41 | + .of(lsAttrLength, ip4RouterId, ip6RouterId); | ||
| 42 | + private final BgpPrefixAttrOspfFwdAddr sameAsData = BgpPrefixAttrOspfFwdAddr | ||
| 43 | + .of(lsAttrLength, ip4RouterId, ip6RouterId); | ||
| 44 | + private final BgpPrefixAttrOspfFwdAddr diffData = BgpPrefixAttrOspfFwdAddr | ||
| 45 | + .of(lsAttrLength1, ip4RouterId1, ip6RouterId1); | ||
| 46 | + | ||
| 47 | + @Test | ||
| 48 | + public void basics() { | ||
| 49 | + new EqualsTester().addEqualityGroup(data, sameAsData) | ||
| 50 | + .addEqualityGroup(diffData).testEquals(); | ||
| 51 | + } | ||
| 52 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment