blob: a58e10b561cd2a90db3fa95d1a99b59f3f49c8b7 [file] [log] [blame]
Thomas Vachuskabf916ea2015-05-20 18:24:34 -07001package org.onosproject.incubator.net.tunnel;
jcc4a20a5f2015-04-30 15:43:39 +08002
3import static org.hamcrest.MatcherAssert.assertThat;
4import static org.hamcrest.Matchers.is;
5import static org.hamcrest.Matchers.notNullValue;
6import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
7
8import org.junit.Test;
9import org.onlab.packet.IpAddress;
10import org.onosproject.core.DefaultGroupId;
11import org.onosproject.net.provider.ProviderId;
12
13/**
14 * Test of a tunnel event.
15 */
16public class TunnelEventTest {
17 /**
18 * Checks that the Order class is immutable.
19 */
20 @Test
21 public void testImmutability() {
22 assertThatClassIsImmutable(TunnelEvent.class);
23 }
24
25 /**
26 * Checks the operation of equals(), hashCode() and toString() methods.
27 */
28 @Test
29 public void testConstructor() {
30 TunnelEndPoint src = IpTunnelEndPoint.ipTunnelPoint(IpAddress
31 .valueOf(23423));
32 TunnelEndPoint dst = IpTunnelEndPoint.ipTunnelPoint(IpAddress
33 .valueOf(32421));
34 DefaultGroupId groupId = new DefaultGroupId(92034);
35 TunnelName tunnelName = TunnelName.tunnelName("TunnelName");
36 TunnelId tunnelId = TunnelId.valueOf(41654654);
37 ProviderId producerName1 = new ProviderId("producer1", "13");
38 Tunnel p1 = new DefaultTunnel(producerName1, src, dst, Tunnel.Type.VXLAN,
39 Tunnel.State.ACTIVE, groupId, tunnelId,
samuel7a5691a2015-05-23 00:36:32 +080040 tunnelName, null);
jcc4a20a5f2015-04-30 15:43:39 +080041 TunnelEvent e1 = new TunnelEvent(TunnelEvent.Type.TUNNEL_ADDED, p1);
42 assertThat(e1, is(notNullValue()));
43 assertThat(e1.type(), is(TunnelEvent.Type.TUNNEL_ADDED));
44 assertThat(e1.subject(), is(p1));
45 }
46}