tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.device; |
| 2 | |
| 3 | import org.junit.Test; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame^] | 4 | import org.onlab.packet.ChassisId; |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 5 | |
| 6 | import java.net.URI; |
| 7 | |
| 8 | import static org.junit.Assert.assertEquals; |
| 9 | import static org.junit.Assert.assertTrue; |
| 10 | import static org.onlab.onos.net.Device.Type.SWITCH; |
| 11 | |
| 12 | /** |
| 13 | * Test of the default device description. |
| 14 | */ |
| 15 | public class DefaultDeviceDescriptionTest { |
| 16 | |
| 17 | private static final URI DURI = URI.create("of:foo"); |
| 18 | private static final String MFR = "whitebox"; |
| 19 | private static final String HW = "1.1.x"; |
| 20 | private static final String SW = "3.9.1"; |
| 21 | private static final String SN = "43311-12345"; |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame^] | 22 | private static final ChassisId CID = new ChassisId(); |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 23 | |
| 24 | |
| 25 | @Test |
| 26 | public void basics() { |
| 27 | DeviceDescription device = |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame^] | 28 | new DefaultDeviceDescription(DURI, SWITCH, MFR, HW, SW, SN, CID); |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 29 | assertEquals("incorrect uri", DURI, device.deviceURI()); |
| 30 | assertEquals("incorrect type", SWITCH, device.type()); |
| 31 | assertEquals("incorrect manufacturer", MFR, device.manufacturer()); |
| 32 | assertEquals("incorrect hw", HW, device.hwVersion()); |
| 33 | assertEquals("incorrect sw", SW, device.swVersion()); |
| 34 | assertEquals("incorrect serial", SN, device.serialNumber()); |
| 35 | assertTrue("incorrect toString", device.toString().contains("uri=of:foo")); |
alshabib | 7911a05 | 2014-10-16 17:49:37 -0700 | [diff] [blame^] | 36 | assertTrue("Incorrect chassis", device.chassisId().value() == 0); |
tom | 3065d12 | 2014-09-03 21:56:43 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | } |