blob: 24059989f4145dacf1f9cc6e802d6b1e252c8166 [file] [log] [blame]
DongRyeol Chae0c98db2018-07-12 16:17:21 +09001/*
2 * Copyright 2018-present Open Networking Foundation
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.onlab.packet;
18
19import org.junit.Test;
20
21import static org.junit.Assert.assertEquals;
22
23/**
24 * Unit tests for the ONOSLLDP class.
25 */
26public class ONOSLLDPTest {
27
28 private static final String DEVICE_ID = "of:c0a80a6e00000001";
29 private static final ChassisId CHASSIS_ID = new ChassisId(67890);
30 private static final Integer PORT_NUMBER = 2;
31 private static final Integer PORT_NUMBER_2 = 98761234;
32 private static final String PORT_DESC = "Ethernet1";
DongRyeol Chace65cc02018-07-23 15:02:28 +090033 private static final String PORT_NAME = "Ethernet2";
Samuel Jero31e16f52018-09-21 10:34:28 -040034 private static final String TEST_SECRET = "test";
DongRyeol Chae0c98db2018-07-12 16:17:21 +090035
Samuel Jero31e16f52018-09-21 10:34:28 -040036 private ONOSLLDP onoslldp = ONOSLLDP.onosSecureLLDP(DEVICE_ID, CHASSIS_ID, PORT_NUMBER, PORT_DESC, TEST_SECRET);
DongRyeol Chae0c98db2018-07-12 16:17:21 +090037
38 /**
39 * Tests port number and getters.
40 */
41 @Test
42 public void testPortNumber() throws Exception {
DongRyeol Chace65cc02018-07-23 15:02:28 +090043 assertEquals("the value from constructor with getPort value is mismatched",
DongRyeol Chae0c98db2018-07-12 16:17:21 +090044 PORT_NUMBER, onoslldp.getPort());
45
46 onoslldp.setPortId(PORT_NUMBER_2);
DongRyeol Chace65cc02018-07-23 15:02:28 +090047 assertEquals("the value from setPortId with getPort value is mismatched",
DongRyeol Chae0c98db2018-07-12 16:17:21 +090048 PORT_NUMBER_2, onoslldp.getPort());
49 }
DongRyeol Chace65cc02018-07-23 15:02:28 +090050
51 /**
52 * Tests port name and getters.
53 */
54 @Test
55 public void testPortName() throws Exception {
56 onoslldp.setPortName(PORT_NAME);
57 assertEquals("the value from setPortName with getPortNameString value is mismatched",
58 PORT_NAME, onoslldp.getPortNameString());
59 }
DongRyeol Chae0c98db2018-07-12 16:17:21 +090060}