ae94991f16776ce867644dbe19b0d9ddc938327a
[onosfw.git] /
1 package org.onosproject.incubator.net.tunnel;
2
3 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
4
5 import org.junit.Test;
6 import org.onlab.packet.IpAddress;
7 import org.onosproject.core.DefaultGroupId;
8 import org.onosproject.net.provider.ProviderId;
9
10 import com.google.common.testing.EqualsTester;
11
12 /**
13  * Test of the default tunnel model entity.
14  */
15 public class DefaultTunnelTest {
16     /**
17      * Checks that the Order class is immutable.
18      */
19     @Test
20     public void testImmutability() {
21         assertThatClassIsImmutable(DefaultTunnel.class);
22     }
23
24     @Test
25     public void testEquality() {
26         TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
27                 .valueOf(23423));
28         TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
29                 .valueOf(32421));
30         DefaultGroupId groupId = new DefaultGroupId(92034);
31         TunnelName tunnelName = TunnelName.tunnelName("TunnelName");
32         TunnelId tunnelId = TunnelId.valueOf(41654654);
33         ProviderId producerName1 = new ProviderId("producer1", "13");
34         ProviderId producerName2 = new ProviderId("producer2", "13");
35         Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
36                                       Tunnel.State.ACTIVE, groupId, tunnelId,
37                                       tunnelName, null);
38         Tunnel p2 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
39                                       Tunnel.State.ACTIVE, groupId, tunnelId,
40                                       tunnelName, null);
41         Tunnel p3 = new DefaultTunnel(producerName2, src, dst, Tunnel.Type.OCH,
42                                       Tunnel.State.ACTIVE, groupId, tunnelId,
43                                       tunnelName, null);
44         new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3)
45                 .testEquals();
46     }
47 }