3dcdc22d312b06d9b0e26226197a4a92bbdb83c2
[onosfw.git] /
1 /*
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  */
16 package org.onosproject.net.device;
17
18 import org.junit.Test;
19 import org.onlab.packet.ChassisId;
20
21 import java.net.URI;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertTrue;
25 import static org.onosproject.net.Device.Type.SWITCH;
26
27 /**
28  * Test of the default device description.
29  */
30 public 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";
37     private static final ChassisId CID = new ChassisId();
38
39
40     @Test
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);
52     }
53
54 }