blob: 37ecdf46cd187ec4f0350a4edbcd3682b35b6885 [file] [log] [blame]
Jian Li4eb0cf42020-12-19 04:01:49 +09001/*
2 * Copyright 2020-present Open Networking Foundation
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 */
16package org.onosproject.kubevirtnode.api;
17
18import com.google.common.testing.EqualsTester;
19import org.junit.Test;
20
21import static org.hamcrest.MatcherAssert.assertThat;
22import static org.hamcrest.Matchers.is;
23
24/**
25 * Unit tests for DefaultOpenstackPhyInterface.
26 */
27public class DefaultKubevirtPhyInterfaceTest {
28
29 private static final String NETWORK_1 = "mgmtnetwork";
30 private static final String NETWORK_2 = "oamnetwork";
31 private static final String INTERFACE_1 = "eth3";
32 private static final String INTERFACE_2 = "eth4";
33
34 private static final KubevirtPhyInterface KV_PHY_INTF_1 =
35 new DefaultKubevirtPhyInterface(NETWORK_1, INTERFACE_1);
36 private static final KubevirtPhyInterface KV_PHY_INTF_2 =
37 new DefaultKubevirtPhyInterface(NETWORK_1, INTERFACE_1);
38 private static final KubevirtPhyInterface KV_PHY_INTF_3 =
39 new DefaultKubevirtPhyInterface(NETWORK_2, INTERFACE_2);
40
41 @Test
42 public void testEquality() {
43 new EqualsTester().addEqualityGroup(KV_PHY_INTF_1, KV_PHY_INTF_2)
44 .addEqualityGroup(KV_PHY_INTF_3)
45 .testEquals();
46 }
47
48 @Test
49 public void testConstruction() {
50 DefaultKubevirtPhyInterface phyIntf = (DefaultKubevirtPhyInterface)
51 KV_PHY_INTF_1;
52
53 assertThat(phyIntf.network(), is(NETWORK_1));
54 assertThat(phyIntf.intf(), is(INTERFACE_1));
55 }
56}