a58e10b561cd2a90db3fa95d1a99b59f3f49c8b7
[onosfw.git] /
1 package org.onosproject.incubator.net.tunnel;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5 import static org.hamcrest.Matchers.notNullValue;
6 import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
7
8 import org.junit.Test;
9 import org.onlab.packet.IpAddress;
10 import org.onosproject.core.DefaultGroupId;
11 import org.onosproject.net.provider.ProviderId;
12
13 /**
14  * Test of a tunnel event.
15  */
16 public 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,
40                                       tunnelName, null);
41         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 }