public static DeviceDescription combine(BasicDeviceConfig cfg, DeviceDescription descr) {
        if (cfg == null || descr == null) {
            return descr;
        }

        Device.Type type = descr.type();
        if (cfg.type() != null && cfg.type() != type) {
            type = cfg.type();
        }
        String manufacturer = descr.manufacturer();
        if (cfg.manufacturer() != null && !cfg.manufacturer().equals(manufacturer)) {
            manufacturer = cfg.manufacturer();
        }
        String hwVersion = descr.hwVersion();
        if (cfg.hwVersion() != null && !cfg.hwVersion().equals(hwVersion)) {
            hwVersion = cfg.hwVersion();
        }
        String swVersion = descr.swVersion();
        if (cfg.swVersion() != null && !cfg.swVersion().equals(swVersion)) {
            swVersion = cfg.swVersion();
        }
        String serial = descr.serialNumber();
        if (cfg.serial() != null && !cfg.serial().equals(serial)) {
            serial = cfg.serial();
        }

        SparseAnnotations sa = combine(cfg, descr.annotations());
        return new DefaultDeviceDescription(descr.deviceUri(), type, manufacturer,
                hwVersion, swVersion,
                serial, descr.chassisId(),
                descr.isDefaultAvailable(), sa);
    }
@Test
    public void testDescOps() {
        DeviceDescription desc = BasicDeviceOperator.combine(null, DEV1);
        assertEquals(desc, DEV1);

        // override driver name
        desc = BasicDeviceOperator.combine(SW_BDC, DEV1);
        assertEquals(NAME1, desc.annotations().value(AnnotationKeys.DRIVER));

        // override Device Information
        desc = BasicDeviceOperator.combine(RD_BDC, DEV1);
        assertEquals("Wrong type", ROADM, desc.type());
        assertEquals("Wrong manufacturer", MANUFACTURER, desc.manufacturer());
        assertEquals("Wrong HwVersion", HW_VERSION, desc.hwVersion());
        assertEquals("Wrong swVersion", SW_VERSION, desc.swVersion());
        assertEquals("Wrong serial", SERIAL, desc.serialNumber());
        assertEquals("Wrong management Address", MANAGEMENT_ADDRESS,
                     desc.annotations().value(AnnotationKeys.MANAGEMENT_ADDRESS));

        // override Device type
        desc = BasicDeviceOperator.combine(OT_BDC, DEV1);
        assertEquals(OTN, desc.type());
    }