2 * Copyright 2014 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.net.device;
18 import org.junit.Test;
19 import org.onlab.packet.ChassisId;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertTrue;
25 import static org.onosproject.net.Device.Type.SWITCH;
28 * Test of the default device description.
30 public class DefaultDeviceDescriptionTest {
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";
37 private static final ChassisId CID = new ChassisId();
41 public void basics() {
42 DeviceDescription device =
43 new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID);
44 assertEquals("incorrect uri", DURI, device.deviceURI());
45 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"));
51 assertTrue("Incorrect chassis", device.chassisId().value() == 0);