blob: cb711b59452c447036cd58fa95ba7c0018c51eeb [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 */
tom568581d2014-09-08 20:13:36 -070016package org.onlab.onos.net;
17
18import com.google.common.testing.EqualsTester;
Ayaka Koshibe50ee9242014-09-12 16:37:46 -070019
tom568581d2014-09-08 20:13:36 -070020import org.junit.Test;
Ayaka Koshibea9c199f2014-09-16 16:21:40 -070021import org.onlab.packet.MacAddress;
22import org.onlab.packet.VlanId;
tom568581d2014-09-08 20:13:36 -070023
24import static org.onlab.onos.net.HostId.hostId;
25
26/**
Ayaka Koshibe50ee9242014-09-12 16:37:46 -070027 * Test for the host identifier.
tom568581d2014-09-08 20:13:36 -070028 */
tom545708e2014-10-09 17:10:02 -070029public class HostIdTest {
tom568581d2014-09-08 20:13:36 -070030
Ayaka Koshibea9c199f2014-09-16 16:21:40 -070031 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 Koshibe50ee9242014-09-12 16:37:46 -070035
tom568581d2014-09-08 20:13:36 -070036 @Test
37 public void basics() {
38 new EqualsTester()
tom545708e2014-10-09 17:10:02 -070039 .addEqualityGroup(hostId(MAC1, VLAN1), hostId(MAC1, VLAN1))
40 .addEqualityGroup(hostId(MAC2, VLAN2), hostId(MAC2, VLAN2))
tom568581d2014-09-08 20:13:36 -070041 .testEquals();
42 }
43
44}