DongRyeol Cha | e0c98db | 2018-07-12 16:17:21 +0900 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package org.onlab.packet; |
| 18 | |
| 19 | import org.junit.Test; |
| 20 | |
| 21 | import static org.junit.Assert.assertEquals; |
| 22 | |
| 23 | /** |
| 24 | * Unit tests for the ONOSLLDP class. |
| 25 | */ |
| 26 | public 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 Cha | ce65cc0 | 2018-07-23 15:02:28 +0900 | [diff] [blame] | 33 | private static final String PORT_NAME = "Ethernet2"; |
Samuel Jero | 31e16f5 | 2018-09-21 10:34:28 -0400 | [diff] [blame] | 34 | private static final String TEST_SECRET = "test"; |
DongRyeol Cha | e0c98db | 2018-07-12 16:17:21 +0900 | [diff] [blame] | 35 | |
Samuel Jero | 31e16f5 | 2018-09-21 10:34:28 -0400 | [diff] [blame] | 36 | private ONOSLLDP onoslldp = ONOSLLDP.onosSecureLLDP(DEVICE_ID, CHASSIS_ID, PORT_NUMBER, PORT_DESC, TEST_SECRET); |
DongRyeol Cha | e0c98db | 2018-07-12 16:17:21 +0900 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Tests port number and getters. |
| 40 | */ |
| 41 | @Test |
| 42 | public void testPortNumber() throws Exception { |
DongRyeol Cha | ce65cc0 | 2018-07-23 15:02:28 +0900 | [diff] [blame] | 43 | assertEquals("the value from constructor with getPort value is mismatched", |
DongRyeol Cha | e0c98db | 2018-07-12 16:17:21 +0900 | [diff] [blame] | 44 | PORT_NUMBER, onoslldp.getPort()); |
| 45 | |
| 46 | onoslldp.setPortId(PORT_NUMBER_2); |
DongRyeol Cha | ce65cc0 | 2018-07-23 15:02:28 +0900 | [diff] [blame] | 47 | assertEquals("the value from setPortId with getPort value is mismatched", |
DongRyeol Cha | e0c98db | 2018-07-12 16:17:21 +0900 | [diff] [blame] | 48 | PORT_NUMBER_2, onoslldp.getPort()); |
| 49 | } |
DongRyeol Cha | ce65cc0 | 2018-07-23 15:02:28 +0900 | [diff] [blame] | 50 | |
| 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 Cha | e0c98db | 2018-07-12 16:17:21 +0900 | [diff] [blame] | 60 | } |