blob: c00a6de0b5a8cc0998c28698a66b2715e153c07b [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.device;
tom3065d122014-09-03 21:56:43 -070017
18import org.junit.Test;
alshabib7911a052014-10-16 17:49:37 -070019import org.onlab.packet.ChassisId;
tom3065d122014-09-03 21:56:43 -070020
21import java.net.URI;
22
23import static org.junit.Assert.assertEquals;
24import static org.junit.Assert.assertTrue;
Brian O'Connorabafb502014-12-02 22:26:20 -080025import static org.onosproject.net.Device.Type.SWITCH;
tom3065d122014-09-03 21:56:43 -070026
27/**
28 * Test of the default device description.
29 */
30public class DefaultDeviceDescriptionTest {
31
32 private static final URI DURI = URI.create("of:foo");
33 private static final String MFR = "whitebox";
34 private static final String HW = "1.1.x";
35 private static final String SW = "3.9.1";
36 private static final String SN = "43311-12345";
alshabib7911a052014-10-16 17:49:37 -070037 private static final ChassisId CID = new ChassisId();
tom3065d122014-09-03 21:56:43 -070038
39
40 @Test
41 public void basics() {
42 DeviceDescription device =
alshabib7911a052014-10-16 17:49:37 -070043 new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID);
Jonathan Hartd9df7bd2015-11-10 17:10:25 -080044 assertEquals("incorrect uri", DURI, device.deviceUri());
tom3065d122014-09-03 21:56:43 -070045 assertEquals("incorrect type", SWITCH, device.type());
46 assertEquals("incorrect manufacturer", MFR, device.manufacturer());
47 assertEquals("incorrect hw", HW, device.hwVersion());
48 assertEquals("incorrect sw", SW, device.swVersion());
49 assertEquals("incorrect serial", SN, device.serialNumber());
50 assertTrue("incorrect toString", device.toString().contains("uri=of:foo"));
alshabib7911a052014-10-16 17:49:37 -070051 assertTrue("Incorrect chassis", device.chassisId().value() == 0);
tom3065d122014-09-03 21:56:43 -070052 }
53
54}