blob: 4b7a8dae5adbd2db98108e0f983fa221ab4d5192 [file] [log] [blame]
Andrea Campanella58454b92016-04-01 15:19:00 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Andrea Campanella58454b92016-04-01 15:19:00 -07003 *
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.snmp.ctl;
18
19import org.junit.Test;
20import org.onosproject.net.DeviceId;
21
22import static org.junit.Assert.*;
23
24/**
25 * Test class for DefaultSnmpDevice.
26 */
27public class DefaultSnmpDeviceTest {
28
29 private final String snmpHost = "1.1.1.1";
30 private int snmpPort = 1;
31 private final String username = "test";
32 private final String community = "test";
33 private final DeviceId deviceId = DeviceId.deviceId("snmp:1.1.1.1:1");
34 private final String deviceInfo = "host: 1.1.1.1. port: 1";
35
36 DefaultSnmpDevice device = new DefaultSnmpDevice("1.1.1.1", 1, "test", "test");
37
38 @Test
39 public void basics() throws Exception {
40 assertTrue("Device should be reachable", device.isReachable());
41 assertEquals("Incorrect host", snmpHost, device.getSnmpHost());
42 assertEquals("Incorrect port", snmpPort, device.getSnmpPort());
43 assertEquals("Incorrect username", username, device.getUsername());
44 assertEquals("Incorrect community", community, device.getCommunity());
45 assertEquals("Incorrect deviceID", deviceId, device.deviceId());
46 assertEquals("Incorrect deviceInfo", deviceInfo, device.deviceInfo());
47 device.disconnect();
48 assertFalse("Device should not be reachable", device.isReachable());
49
50 }
51}