@Override
    public PolicerId allocatePolicerId() {
        // Init step
        DriverHandler handler = handler();
        // First step is to get MeterService
        MeterService meterService = handler.get(MeterService.class);
        // There was a problem, return none
        if (meterService == null) {
            log.warn("MeterService is null");
            return PolicerId.NONE;
        }
        // Let's get the device id
        DeviceId deviceId = handler.data().deviceId();
        // Double check correspondence between schemas
        if (!deviceId.uri().getScheme().equals(OF_SCHEME)) {
            log.warn("The device {} does not seem to be managed by OpenFlow", deviceId);
            return PolicerId.NONE;
        }
        // Get a new meter id
        MeterId meterId = meterService.allocateMeterId(deviceId);
        // There was a problem
        if (meterId == null) {
            log.warn("MeterService does not provide valid ids");
            return PolicerId.NONE;
        }
        // Create a policer id from the meter id
        return getPolicerIdFromMeterId(meterId);
    }
@Test
    public void testAllocateId() {
        // Get device handler
        DriverHandler driverHandler = driverService.createHandler(ofDid);
        // Get policer config behavior
        PolicerConfigurable policerConfigurable = driverHandler.behaviour(PolicerConfigurable.class);
        // Get policer id
        PolicerId policerId = policerConfigurable.allocatePolicerId();
        // Assert that scheme is equal to OF
        assertThat(policerId.uri().getScheme(), is(OF_SCHEME));
        // Convert in hex the id
        String hexId = Long.toHexString((mid1.id()));
        // Assert that specific part contains hex of meter id
        assertThat(policerId.uri().getSchemeSpecificPart(), is(hexId));
    }