blob: bab9ff050849adc7d0371d430b600050fc164ed5 [file] [log] [blame]
Thomas Vachuskabf916ea2015-05-20 18:24:34 -07001/*
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
17package org.onosproject.incubator.net.tunnel;
jcc4a20a5f2015-04-30 15:43:39 +080018
19import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
20
21import org.junit.Test;
22import org.onlab.packet.IpAddress;
23import org.onosproject.core.DefaultGroupId;
24import org.onosproject.net.provider.ProviderId;
25
26import com.google.common.testing.EqualsTester;
27
28/**
29 * Test of the default tunnel model entity.
30 */
31public class DefaultTunnelTest {
32 /**
33 * Checks that the Order class is immutable.
34 */
35 @Test
36 public void testImmutability() {
37 assertThatClassIsImmutable(DefaultTunnel.class);
38 }
39
40 @Test
41 public void testEquality() {
42 TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
43 .valueOf(23423));
44 TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
45 .valueOf(32421));
46 DefaultGroupId groupId = new DefaultGroupId(92034);
47 TunnelName tunnelName = TunnelName.tunnelName("TunnelName");
48 TunnelId tunnelId = TunnelId.valueOf(41654654);
49 ProviderId producerName1 = new ProviderId("producer1", "13");
50 ProviderId producerName2 = new ProviderId("producer2", "13");
51 Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
52 Tunnel.State.ACTIVE, groupId, tunnelId,
53 tunnelName);
54 Tunnel p2 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
55 Tunnel.State.ACTIVE, groupId, tunnelId,
56 tunnelName);
57 Tunnel p3 = new DefaultTunnel(producerName2, src, dst, Tunnel.Type.OCH,
58 Tunnel.State.ACTIVE, groupId, tunnelId,
59 tunnelName);
60 new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
61 .testEquals();
62 }
63}