Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net; |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 17 | |
| 18 | import com.google.common.testing.EqualsTester; |
Ayaka Koshibe | 50ee924 | 2014-09-12 16:37:46 -0700 | [diff] [blame] | 19 | |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 20 | import org.junit.Test; |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 21 | import org.onlab.packet.MacAddress; |
| 22 | import org.onlab.packet.VlanId; |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 23 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 24 | import static org.onosproject.net.HostId.hostId; |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
Ayaka Koshibe | 50ee924 | 2014-09-12 16:37:46 -0700 | [diff] [blame] | 27 | * Test for the host identifier. |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 28 | */ |
tom | 545708e | 2014-10-09 17:10:02 -0700 | [diff] [blame] | 29 | public class HostIdTest { |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 30 | |
Ayaka Koshibe | a9c199f | 2014-09-16 16:21:40 -0700 | [diff] [blame] | 31 | private static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01"); |
| 32 | private static final MacAddress MAC2 = MacAddress.valueOf("00:22:00:00:00:02"); |
| 33 | private static final VlanId VLAN1 = VlanId.vlanId((short) 11); |
| 34 | private static final VlanId VLAN2 = VlanId.vlanId((short) 22); |
Ayaka Koshibe | 50ee924 | 2014-09-12 16:37:46 -0700 | [diff] [blame] | 35 | |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 36 | @Test |
| 37 | public void basics() { |
| 38 | new EqualsTester() |
tom | 545708e | 2014-10-09 17:10:02 -0700 | [diff] [blame] | 39 | .addEqualityGroup(hostId(MAC1, VLAN1), hostId(MAC1, VLAN1)) |
| 40 | .addEqualityGroup(hostId(MAC2, VLAN2), hostId(MAC2, VLAN2)) |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 41 | .testEquals(); |
| 42 | } |
| 43 | |
| 44 | } |