blob: 97dadcb109bf5c506cf6d4117571444e2b9c68d4 [file] [log] [blame]
Carolina Fernandezad893432016-07-18 11:11:34 +02001/*
2 * Copyright 2016-present 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.sdxl2;
18
19
20import org.junit.Test;
21
22import static org.junit.Assert.assertEquals;
23import static org.junit.Assert.assertNotEquals;
24
25/**
26 * Tests VirtualCircuit functionalities.
27 */
28public class VirtualCircuitTest {
29
30
31 public static final String CP1 = "of:00000000000001/1";
32 public static final String CP2 = "of:00000000000002/1";
33 public static final String VLANS1 = "1,2,3,4";
34 public static final String VLANS3 = "1,2,3";
35 public static final String CEMAC1 = "52:40:00:12:44:01";
36 public static final String CEMAC6 = "52:40:00:12:44:02";
37
38 /*
39 * Tests VC with different VLANs.
40 */
41 @Test
42 public void testVC1() {
43 SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI1", CP1, VLANS1, CEMAC1);
44 SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("GE4", CP2, VLANS3, CEMAC6);
45 VirtualCircuit vc1 = new VirtualCircuit(scp1, scp2);
46 }
47
48 /*
49 Tests creating VC with the same VLANs.
50 */
51 @Test
52 public void testVCEquality() {
53 SdxL2ConnectionPoint scp1 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI1", CP1, VLANS1, CEMAC1);
54 SdxL2ConnectionPoint scp2 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("GE4", CP2, VLANS3, CEMAC6);
55 VirtualCircuit vc1 = new VirtualCircuit(scp1, scp2);
56 VirtualCircuit vc2 = new VirtualCircuit(scp2, scp1);
57 assertEquals(vc1, vc2);
58 SdxL2ConnectionPoint scp3 = SdxL2ConnectionPoint.sdxl2ConnectionPoint("FI2", CP1, VLANS1, CEMAC1);
59 VirtualCircuit vc3 = new VirtualCircuit(scp1, scp3);
60 assertNotEquals(vc1, vc3);
61 }
62
63}