blob: b07939286e298e244fb801bcde984d86c8041b14 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
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 */
Ayaka Koshibe50ee9242014-09-12 16:37:46 -070016package org.onlab.onos.net;
17
18import static org.junit.Assert.assertEquals;
19
20import org.junit.Test;
21
22import com.google.common.testing.EqualsTester;
23
24public class DefaultHostTest extends TestDeviceParams {
25
26 @Test
27 public void testEquality() {
28 Host h1 = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, IPSET1);
29 Host h2 = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, IPSET1);
30 Host h3 = new DefaultHost(PID, HID2, MAC2, VLAN2, LOC2, IPSET2);
31 Host h4 = new DefaultHost(PID, HID2, MAC2, VLAN2, LOC2, IPSET2);
32 Host h5 = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC2, IPSET1);
33
34 new EqualsTester().addEqualityGroup(h1, h2)
35 .addEqualityGroup(h3, h4)
36 .addEqualityGroup(h5)
37 .testEquals();
38 }
39
40 @Test
41 public void basics() {
42 Host host = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, IPSET1);
43 assertEquals("incorrect provider", PID, host.providerId());
44 assertEquals("incorrect id", HID1, host.id());
45 assertEquals("incorrect type", MAC1, host.mac());
46 assertEquals("incorrect VLAN", VLAN1, host.vlan());
47 assertEquals("incorrect location", LOC1, host.location());
48 assertEquals("incorrect IP's", IPSET1, host.ipAddresses());
49 }
50
51}