mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-04-27 06:20:28 +00:00
Fix clippy feedback (cargo clippy --fix).
This commit is contained in:
parent
7158c0c610
commit
5794f41324
24
api/rust/src/gw.rs
vendored
24
api/rust/src/gw.rs
vendored
@ -95,7 +95,7 @@ impl UplinkFrame {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
uplink_tx_info_legacy::ModulationInfo::FskModulationInfo(info) => {
|
uplink_tx_info_legacy::ModulationInfo::FskModulationInfo(info) => {
|
||||||
modulation::Parameters::Fsk(info.clone())
|
modulation::Parameters::Fsk(*info)
|
||||||
}
|
}
|
||||||
uplink_tx_info_legacy::ModulationInfo::LrFhssModulationInfo(info) => {
|
uplink_tx_info_legacy::ModulationInfo::LrFhssModulationInfo(info) => {
|
||||||
modulation::Parameters::LrFhss(LrFhssModulationInfo {
|
modulation::Parameters::LrFhss(LrFhssModulationInfo {
|
||||||
@ -120,9 +120,9 @@ impl UplinkFrame {
|
|||||||
self.rx_info = Some(UplinkRxInfo {
|
self.rx_info = Some(UplinkRxInfo {
|
||||||
gateway_id: hex::encode(&rx_info.gateway_id),
|
gateway_id: hex::encode(&rx_info.gateway_id),
|
||||||
uplink_id: rng.gen::<u32>(),
|
uplink_id: rng.gen::<u32>(),
|
||||||
gw_time: rx_info.time.clone(),
|
gw_time: rx_info.time,
|
||||||
ns_time: None,
|
ns_time: None,
|
||||||
time_since_gps_epoch: rx_info.time_since_gps_epoch.clone(),
|
time_since_gps_epoch: rx_info.time_since_gps_epoch,
|
||||||
fine_time_since_gps_epoch: None,
|
fine_time_since_gps_epoch: None,
|
||||||
rssi: rx_info.rssi,
|
rssi: rx_info.rssi,
|
||||||
snr: rx_info.lora_snr as f32,
|
snr: rx_info.lora_snr as f32,
|
||||||
@ -130,7 +130,7 @@ impl UplinkFrame {
|
|||||||
rf_chain: rx_info.rf_chain,
|
rf_chain: rx_info.rf_chain,
|
||||||
board: rx_info.board,
|
board: rx_info.board,
|
||||||
antenna: rx_info.antenna,
|
antenna: rx_info.antenna,
|
||||||
location: rx_info.location.clone(),
|
location: rx_info.location,
|
||||||
context: rx_info.context.clone(),
|
context: rx_info.context.clone(),
|
||||||
metadata: rx_info.metadata.clone(),
|
metadata: rx_info.metadata.clone(),
|
||||||
crc_status: rx_info.crc_status,
|
crc_status: rx_info.crc_status,
|
||||||
@ -195,23 +195,19 @@ impl DownlinkFrame {
|
|||||||
Some(timing::Parameters::Immediately(v)) => {
|
Some(timing::Parameters::Immediately(v)) => {
|
||||||
tx_info_legacy.timing = DownlinkTiming::Immediately.into();
|
tx_info_legacy.timing = DownlinkTiming::Immediately.into();
|
||||||
tx_info_legacy.timing_info = Some(
|
tx_info_legacy.timing_info = Some(
|
||||||
downlink_tx_info_legacy::TimingInfo::ImmediatelyTimingInfo(
|
downlink_tx_info_legacy::TimingInfo::ImmediatelyTimingInfo(*v),
|
||||||
v.clone(),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Some(timing::Parameters::Delay(v)) => {
|
Some(timing::Parameters::Delay(v)) => {
|
||||||
tx_info_legacy.timing = DownlinkTiming::Delay.into();
|
tx_info_legacy.timing = DownlinkTiming::Delay.into();
|
||||||
tx_info_legacy.timing_info = Some(
|
tx_info_legacy.timing_info =
|
||||||
downlink_tx_info_legacy::TimingInfo::DelayTimingInfo(v.clone()),
|
Some(downlink_tx_info_legacy::TimingInfo::DelayTimingInfo(*v));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Some(timing::Parameters::GpsEpoch(v)) => {
|
Some(timing::Parameters::GpsEpoch(v)) => {
|
||||||
tx_info_legacy.timing = DownlinkTiming::GpsEpoch.into();
|
tx_info_legacy.timing = DownlinkTiming::GpsEpoch.into();
|
||||||
tx_info_legacy.timing_info =
|
tx_info_legacy.timing_info = Some(
|
||||||
Some(downlink_tx_info_legacy::TimingInfo::GpsEpochTimingInfo(
|
downlink_tx_info_legacy::TimingInfo::GpsEpochTimingInfo(*v),
|
||||||
v.clone(),
|
);
|
||||||
));
|
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
@ -1945,9 +1945,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut create_req = Request::new(create_req);
|
let mut create_req = Request::new(create_req);
|
||||||
create_req
|
create_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
.extensions_mut()
|
|
||||||
.insert(AuthID::User(u.id.clone()));
|
|
||||||
let create_resp = service.create(create_req).await.unwrap();
|
let create_resp = service.create(create_req).await.unwrap();
|
||||||
let create_resp = create_resp.get_ref();
|
let create_resp = create_resp.get_ref();
|
||||||
|
|
||||||
@ -1956,7 +1954,7 @@ pub mod test {
|
|||||||
id: create_resp.id.clone(),
|
id: create_resp.id.clone(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::Application {
|
Some(api::Application {
|
||||||
@ -1978,7 +1976,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut up_req = Request::new(up_req);
|
let mut up_req = Request::new(up_req);
|
||||||
up_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
up_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.update(up_req).await.unwrap();
|
let _ = service.update(up_req).await.unwrap();
|
||||||
|
|
||||||
//get
|
//get
|
||||||
@ -1986,7 +1984,7 @@ pub mod test {
|
|||||||
id: create_resp.id.clone(),
|
id: create_resp.id.clone(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::Application {
|
Some(api::Application {
|
||||||
@ -2006,7 +2004,7 @@ pub mod test {
|
|||||||
offset: 0,
|
offset: 0,
|
||||||
};
|
};
|
||||||
let mut list_req = Request::new(list_req);
|
let mut list_req = Request::new(list_req);
|
||||||
list_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
list_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let list_resp = service.list(list_req).await.unwrap();
|
let list_resp = service.list(list_req).await.unwrap();
|
||||||
assert_eq!(1, list_resp.get_ref().total_count);
|
assert_eq!(1, list_resp.get_ref().total_count);
|
||||||
assert_eq!(1, list_resp.get_ref().result.len());
|
assert_eq!(1, list_resp.get_ref().result.len());
|
||||||
@ -2016,14 +2014,14 @@ pub mod test {
|
|||||||
id: create_resp.id.clone(),
|
id: create_resp.id.clone(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.delete(del_req).await.unwrap();
|
let _ = service.delete(del_req).await.unwrap();
|
||||||
|
|
||||||
let del_req = api::DeleteApplicationRequest {
|
let del_req = api::DeleteApplicationRequest {
|
||||||
id: create_resp.id.clone(),
|
id: create_resp.id.clone(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let del_resp = service.delete(del_req).await;
|
let del_resp = service.delete(del_req).await;
|
||||||
assert!(del_resp.is_err());
|
assert!(del_resp.is_err());
|
||||||
}
|
}
|
||||||
@ -2038,7 +2036,7 @@ pub mod test {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
application::create(application::Application {
|
application::create(application::Application {
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
name: "test-app".into(),
|
name: "test-app".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -2059,7 +2057,7 @@ pub mod test {
|
|||||||
|
|
||||||
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
||||||
let mut req = Request::new(req);
|
let mut req = Request::new(req);
|
||||||
req.extensions_mut().insert(AuthID::User(user_id.clone()));
|
req.extensions_mut().insert(AuthID::User(*user_id));
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,14 +95,11 @@ pub mod test {
|
|||||||
assert_eq!(claim, decoded);
|
assert_eq!(claim, decoded);
|
||||||
|
|
||||||
// different key
|
// different key
|
||||||
assert_eq!(
|
assert!(AuthClaim::decode(&token, other_secret.as_ref()).is_err());
|
||||||
true,
|
|
||||||
AuthClaim::decode(&token, other_secret.as_ref()).is_err()
|
|
||||||
);
|
|
||||||
|
|
||||||
// expired
|
// expired
|
||||||
claim.exp = Some(exp.timestamp() as usize);
|
claim.exp = Some(exp.timestamp() as usize);
|
||||||
let token = claim.encode(secrect.as_ref()).unwrap();
|
let token = claim.encode(secrect.as_ref()).unwrap();
|
||||||
assert_eq!(true, AuthClaim::decode(&token, secrect.as_ref()).is_err());
|
assert!(AuthClaim::decode(&token, secrect.as_ref()).is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2138,7 +2138,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user,
|
&user,
|
||||||
&tenant_user,
|
&tenant_user,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
@ -2382,7 +2382,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user,
|
&user,
|
||||||
&user_admin,
|
&user_admin,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
@ -2654,7 +2654,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user_active,
|
&user_active,
|
||||||
&user_admin,
|
&user_admin,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
@ -2919,7 +2919,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![&user_active, &user_admin] {
|
for u in [&user_active, &user_admin] {
|
||||||
user::create(u.clone()).await.unwrap();
|
user::create(u.clone()).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3075,7 +3075,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user_active,
|
&user_active,
|
||||||
&user_admin,
|
&user_admin,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
@ -3093,14 +3093,14 @@ pub mod test {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
tenant_id: tenant_a.id.clone(),
|
tenant_id: tenant_a.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let dp_api_key_tenant = device_profile::create(device_profile::DeviceProfile {
|
let dp_api_key_tenant = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "test-dp-tenant".into(),
|
name: "test-dp-tenant".into(),
|
||||||
tenant_id: api_key_tenant.tenant_id.unwrap().clone(),
|
tenant_id: api_key_tenant.tenant_id.unwrap(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -3378,7 +3378,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user_active,
|
&user_active,
|
||||||
&user_admin,
|
&user_admin,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
@ -3636,7 +3636,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![&user_active, &user_admin, &tenant_user] {
|
for u in [&user_active, &user_admin, &tenant_user] {
|
||||||
user::create(u.clone()).await.unwrap();
|
user::create(u.clone()).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3765,7 +3765,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user_active,
|
&user_active,
|
||||||
&user_admin,
|
&user_admin,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
@ -4038,7 +4038,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
for u in vec![
|
for u in [
|
||||||
&user_active,
|
&user_active,
|
||||||
&user_admin,
|
&user_admin,
|
||||||
&tenant_admin,
|
&tenant_admin,
|
||||||
|
@ -695,20 +695,18 @@ impl DeviceService for Device {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let start = SystemTime::try_from(
|
let start = SystemTime::try_from(
|
||||||
req.start
|
*req.start
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("start is None"))
|
.ok_or_else(|| anyhow!("start is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
let end = SystemTime::try_from(
|
let end = SystemTime::try_from(
|
||||||
req.end
|
*req.end
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("end is None"))
|
.ok_or_else(|| anyhow!("end is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
@ -819,20 +817,18 @@ impl DeviceService for Device {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let start = SystemTime::try_from(
|
let start = SystemTime::try_from(
|
||||||
req.start
|
*req.start
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("start is None"))
|
.ok_or_else(|| anyhow!("start is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
let end = SystemTime::try_from(
|
let end = SystemTime::try_from(
|
||||||
req.end
|
*req.end
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("end is None"))
|
.ok_or_else(|| anyhow!("end is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
@ -1256,7 +1252,7 @@ pub mod test {
|
|||||||
// create application
|
// create application
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "test-app".into(),
|
name: "test-app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -1265,7 +1261,7 @@ pub mod test {
|
|||||||
// create device-profile
|
// create device-profile
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -1421,12 +1417,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// flush dev nonces
|
// flush dev nonces
|
||||||
let _ = device_keys::set_dev_nonces(
|
let _ =
|
||||||
&EUI64::from_str("0102030405060708").unwrap(),
|
device_keys::set_dev_nonces(&EUI64::from_str("0102030405060708").unwrap(), &[1, 2, 3])
|
||||||
&vec![1, 2, 3],
|
.await
|
||||||
)
|
.unwrap();
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
let flush_dev_nonces_req = get_request(
|
let flush_dev_nonces_req = get_request(
|
||||||
&u.id,
|
&u.id,
|
||||||
api::FlushDevNoncesRequest {
|
api::FlushDevNoncesRequest {
|
||||||
@ -1618,7 +1612,7 @@ pub mod test {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let dev_addr = DevAddr::from_str(&get_random_dev_addr_resp.get_ref().dev_addr).unwrap();
|
let dev_addr = DevAddr::from_str(&get_random_dev_addr_resp.get_ref().dev_addr).unwrap();
|
||||||
let mut dev_addr_copy = dev_addr.clone();
|
let mut dev_addr_copy = dev_addr;
|
||||||
dev_addr_copy.set_dev_addr_prefix(NetID::from_str("000000").unwrap().dev_addr_prefix());
|
dev_addr_copy.set_dev_addr_prefix(NetID::from_str("000000").unwrap().dev_addr_prefix());
|
||||||
assert_eq!(dev_addr, dev_addr_copy);
|
assert_eq!(dev_addr, dev_addr_copy);
|
||||||
|
|
||||||
@ -1666,10 +1660,10 @@ pub mod test {
|
|||||||
assert_eq!(2, get_queue_resp.total_count);
|
assert_eq!(2, get_queue_resp.total_count);
|
||||||
assert_eq!(2, get_queue_resp.result.len());
|
assert_eq!(2, get_queue_resp.result.len());
|
||||||
assert_eq!(vec![3, 2, 1], get_queue_resp.result[0].data);
|
assert_eq!(vec![3, 2, 1], get_queue_resp.result[0].data);
|
||||||
assert_eq!(false, get_queue_resp.result[0].is_encrypted);
|
assert!(!get_queue_resp.result[0].is_encrypted);
|
||||||
assert_eq!(0, get_queue_resp.result[0].f_cnt_down);
|
assert_eq!(0, get_queue_resp.result[0].f_cnt_down);
|
||||||
assert_eq!(vec![1, 2, 3], get_queue_resp.result[1].data);
|
assert_eq!(vec![1, 2, 3], get_queue_resp.result[1].data);
|
||||||
assert_eq!(true, get_queue_resp.result[1].is_encrypted);
|
assert!(get_queue_resp.result[1].is_encrypted);
|
||||||
assert_eq!(10, get_queue_resp.result[1].f_cnt_down);
|
assert_eq!(10, get_queue_resp.result[1].f_cnt_down);
|
||||||
|
|
||||||
// get next FCntDown (from queue)
|
// get next FCntDown (from queue)
|
||||||
@ -1726,7 +1720,7 @@ pub mod test {
|
|||||||
|
|
||||||
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
||||||
let mut req = Request::new(req);
|
let mut req = Request::new(req);
|
||||||
req.extensions_mut().insert(AuthID::User(user_id.clone()));
|
req.extensions_mut().insert(AuthID::User(*user_id));
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ pub mod test {
|
|||||||
|
|
||||||
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
||||||
let mut req = Request::new(req);
|
let mut req = Request::new(req);
|
||||||
req.extensions_mut().insert(AuthID::User(user_id.clone()));
|
req.extensions_mut().insert(AuthID::User(*user_id));
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -444,7 +444,7 @@ pub mod test {
|
|||||||
|
|
||||||
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
||||||
let mut req = Request::new(req);
|
let mut req = Request::new(req);
|
||||||
req.extensions_mut().insert(AuthID::User(user_id.clone()));
|
req.extensions_mut().insert(AuthID::User(*user_id));
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -345,20 +345,18 @@ impl GatewayService for Gateway {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let start = SystemTime::try_from(
|
let start = SystemTime::try_from(
|
||||||
req.start
|
*req.start
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("start is None"))
|
.ok_or_else(|| anyhow!("start is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
let end = SystemTime::try_from(
|
let end = SystemTime::try_from(
|
||||||
req.end
|
*req.end
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("end is None"))
|
.ok_or_else(|| anyhow!("end is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
@ -634,20 +632,18 @@ impl GatewayService for Gateway {
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let start = SystemTime::try_from(
|
let start = SystemTime::try_from(
|
||||||
req.start
|
*req.start
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("start is None"))
|
.ok_or_else(|| anyhow!("start is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
let end = SystemTime::try_from(
|
let end = SystemTime::try_from(
|
||||||
req.end
|
*req.end
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("end is None"))
|
.ok_or_else(|| anyhow!("end is None"))
|
||||||
.map_err(|e| e.status())?
|
.map_err(|e| e.status())?,
|
||||||
.clone(),
|
|
||||||
)
|
)
|
||||||
.map_err(|e| e.status())?;
|
.map_err(|e| e.status())?;
|
||||||
|
|
||||||
@ -1032,9 +1028,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut create_req = Request::new(create_req);
|
let mut create_req = Request::new(create_req);
|
||||||
create_req
|
create_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
.extensions_mut()
|
|
||||||
.insert(AuthID::User(u.id.clone()));
|
|
||||||
let _ = service.create(create_req).await.unwrap();
|
let _ = service.create(create_req).await.unwrap();
|
||||||
|
|
||||||
// get
|
// get
|
||||||
@ -1042,7 +1036,7 @@ pub mod test {
|
|||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::Gateway {
|
Some(api::Gateway {
|
||||||
@ -1076,7 +1070,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut up_req = Request::new(up_req);
|
let mut up_req = Request::new(up_req);
|
||||||
up_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
up_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.update(up_req).await.unwrap();
|
let _ = service.update(up_req).await.unwrap();
|
||||||
|
|
||||||
// get
|
// get
|
||||||
@ -1084,7 +1078,7 @@ pub mod test {
|
|||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::Gateway {
|
Some(api::Gateway {
|
||||||
@ -1111,7 +1105,7 @@ pub mod test {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let mut list_req = Request::new(list_req);
|
let mut list_req = Request::new(list_req);
|
||||||
list_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
list_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let list_resp = service.list(list_req).await.unwrap();
|
let list_resp = service.list(list_req).await.unwrap();
|
||||||
assert_eq!(1, list_resp.get_ref().total_count);
|
assert_eq!(1, list_resp.get_ref().total_count);
|
||||||
assert_eq!(1, list_resp.get_ref().result.len());
|
assert_eq!(1, list_resp.get_ref().result.len());
|
||||||
@ -1121,14 +1115,14 @@ pub mod test {
|
|||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.delete(del_req).await.unwrap();
|
let _ = service.delete(del_req).await.unwrap();
|
||||||
|
|
||||||
let del_req = api::DeleteGatewayRequest {
|
let del_req = api::DeleteGatewayRequest {
|
||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let del_resp = service.delete(del_req).await;
|
let del_resp = service.delete(del_req).await;
|
||||||
assert!(del_resp.is_err());
|
assert!(del_resp.is_err());
|
||||||
}
|
}
|
||||||
@ -1160,7 +1154,7 @@ pub mod test {
|
|||||||
// create gateway
|
// create gateway
|
||||||
let _ = gateway::create(gateway::Gateway {
|
let _ = gateway::create(gateway::Gateway {
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
name: "test-gw".into(),
|
name: "test-gw".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -1172,7 +1166,7 @@ pub mod test {
|
|||||||
// insert stats
|
// insert stats
|
||||||
let mut m = metrics::Record {
|
let mut m = metrics::Record {
|
||||||
kind: metrics::Kind::ABSOLUTE,
|
kind: metrics::Kind::ABSOLUTE,
|
||||||
time: now.into(),
|
time: now,
|
||||||
metrics: HashMap::new(),
|
metrics: HashMap::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1204,9 +1198,7 @@ pub mod test {
|
|||||||
aggregation: common::Aggregation::Day.into(),
|
aggregation: common::Aggregation::Day.into(),
|
||||||
};
|
};
|
||||||
let mut stats_req = Request::new(stats_req);
|
let mut stats_req = Request::new(stats_req);
|
||||||
stats_req
|
stats_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
.extensions_mut()
|
|
||||||
.insert(AuthID::User(u.id.clone()));
|
|
||||||
let stats_resp = service.get_metrics(stats_req).await.unwrap();
|
let stats_resp = service.get_metrics(stats_req).await.unwrap();
|
||||||
let stats_resp = stats_resp.get_ref();
|
let stats_resp = stats_resp.get_ref();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@ -1257,7 +1249,7 @@ pub mod test {
|
|||||||
// create gateway
|
// create gateway
|
||||||
let _ = gateway::create(gateway::Gateway {
|
let _ = gateway::create(gateway::Gateway {
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
name: "test-gw".into(),
|
name: "test-gw".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -1269,7 +1261,7 @@ pub mod test {
|
|||||||
// insert stats
|
// insert stats
|
||||||
let mut m = metrics::Record {
|
let mut m = metrics::Record {
|
||||||
kind: metrics::Kind::COUNTER,
|
kind: metrics::Kind::COUNTER,
|
||||||
time: now.into(),
|
time: now,
|
||||||
metrics: HashMap::new(),
|
metrics: HashMap::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1297,9 +1289,7 @@ pub mod test {
|
|||||||
end: Some(now_st.into()),
|
end: Some(now_st.into()),
|
||||||
};
|
};
|
||||||
let mut stats_req = Request::new(stats_req);
|
let mut stats_req = Request::new(stats_req);
|
||||||
stats_req
|
stats_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
.extensions_mut()
|
|
||||||
.insert(AuthID::User(u.id.clone()));
|
|
||||||
let stats_resp = service.get_duty_cycle_metrics(stats_req).await.unwrap();
|
let stats_resp = service.get_duty_cycle_metrics(stats_req).await.unwrap();
|
||||||
let stats_resp = stats_resp.get_ref();
|
let stats_resp = stats_resp.get_ref();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -550,7 +550,7 @@ pub mod test {
|
|||||||
// create application
|
// create application
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "test-app".into(),
|
name: "test-app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -559,7 +559,7 @@ pub mod test {
|
|||||||
// create device-profile
|
// create device-profile
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -871,7 +871,7 @@ pub mod test {
|
|||||||
|
|
||||||
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
||||||
let mut req = Request::new(req);
|
let mut req = Request::new(req);
|
||||||
req.extensions_mut().insert(AuthID::User(user_id.clone()));
|
req.extensions_mut().insert(AuthID::User(*user_id));
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +315,7 @@ pub mod test {
|
|||||||
|
|
||||||
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
fn get_request<T>(user_id: &Uuid, req: T) -> Request<T> {
|
||||||
let mut req = Request::new(req);
|
let mut req = Request::new(req);
|
||||||
req.extensions_mut().insert(AuthID::User(user_id.clone()));
|
req.extensions_mut().insert(AuthID::User(*user_id));
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,9 +482,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut create_req = Request::new(create_req);
|
let mut create_req = Request::new(create_req);
|
||||||
create_req
|
create_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
.extensions_mut()
|
|
||||||
.insert(AuthID::User(u.id.clone()));
|
|
||||||
let create_resp = service.create(create_req).await.unwrap();
|
let create_resp = service.create(create_req).await.unwrap();
|
||||||
|
|
||||||
// get
|
// get
|
||||||
@ -492,7 +490,7 @@ pub mod test {
|
|||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::Tenant {
|
Some(api::Tenant {
|
||||||
@ -520,7 +518,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut up_req = Request::new(up_req);
|
let mut up_req = Request::new(up_req);
|
||||||
up_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
up_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.update(up_req).await.unwrap();
|
let _ = service.update(up_req).await.unwrap();
|
||||||
|
|
||||||
// get
|
// get
|
||||||
@ -528,7 +526,7 @@ pub mod test {
|
|||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::Tenant {
|
Some(api::Tenant {
|
||||||
@ -551,7 +549,7 @@ pub mod test {
|
|||||||
user_id: "".into(),
|
user_id: "".into(),
|
||||||
};
|
};
|
||||||
let mut list_req = Request::new(list_req);
|
let mut list_req = Request::new(list_req);
|
||||||
list_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
list_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let list_resp = service.list(list_req).await.unwrap();
|
let list_resp = service.list(list_req).await.unwrap();
|
||||||
assert_eq!(1, list_resp.get_ref().total_count);
|
assert_eq!(1, list_resp.get_ref().total_count);
|
||||||
assert_eq!(1, list_resp.get_ref().result.len());
|
assert_eq!(1, list_resp.get_ref().result.len());
|
||||||
@ -561,14 +559,14 @@ pub mod test {
|
|||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.delete(del_req).await.unwrap();
|
let _ = service.delete(del_req).await.unwrap();
|
||||||
|
|
||||||
let del_req = api::DeleteTenantRequest {
|
let del_req = api::DeleteTenantRequest {
|
||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let del_resp = service.delete(del_req).await;
|
let del_resp = service.delete(del_req).await;
|
||||||
assert!(del_resp.is_err());
|
assert!(del_resp.is_err());
|
||||||
}
|
}
|
||||||
|
@ -292,9 +292,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut create_req = Request::new(create_req);
|
let mut create_req = Request::new(create_req);
|
||||||
create_req
|
create_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
.extensions_mut()
|
|
||||||
.insert(AuthID::User(u.id.clone()));
|
|
||||||
let create_resp = service.create(create_req).await.unwrap();
|
let create_resp = service.create(create_req).await.unwrap();
|
||||||
|
|
||||||
// get
|
// get
|
||||||
@ -302,7 +300,7 @@ pub mod test {
|
|||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::User {
|
Some(api::User {
|
||||||
@ -328,7 +326,7 @@ pub mod test {
|
|||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
let mut up_req = Request::new(up_req);
|
let mut up_req = Request::new(up_req);
|
||||||
up_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
up_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.update(up_req).await.unwrap();
|
let _ = service.update(up_req).await.unwrap();
|
||||||
|
|
||||||
// get
|
// get
|
||||||
@ -336,7 +334,7 @@ pub mod test {
|
|||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut get_req = Request::new(get_req);
|
let mut get_req = Request::new(get_req);
|
||||||
get_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
get_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let get_resp = service.get(get_req).await.unwrap();
|
let get_resp = service.get(get_req).await.unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(api::User {
|
Some(api::User {
|
||||||
@ -356,7 +354,7 @@ pub mod test {
|
|||||||
password: "newpassword".into(),
|
password: "newpassword".into(),
|
||||||
};
|
};
|
||||||
let mut up_req = Request::new(up_req);
|
let mut up_req = Request::new(up_req);
|
||||||
up_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
up_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.update_password(up_req).await.unwrap();
|
let _ = service.update_password(up_req).await.unwrap();
|
||||||
|
|
||||||
// list
|
// list
|
||||||
@ -365,7 +363,7 @@ pub mod test {
|
|||||||
limit: 10,
|
limit: 10,
|
||||||
};
|
};
|
||||||
let mut list_req = Request::new(list_req);
|
let mut list_req = Request::new(list_req);
|
||||||
list_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
list_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let list_resp = service.list(list_req).await.unwrap();
|
let list_resp = service.list(list_req).await.unwrap();
|
||||||
// * Admin from migrations
|
// * Admin from migrations
|
||||||
// * User that we created for auth
|
// * User that we created for auth
|
||||||
@ -378,14 +376,14 @@ pub mod test {
|
|||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let _ = service.delete(del_req).await.unwrap();
|
let _ = service.delete(del_req).await.unwrap();
|
||||||
|
|
||||||
let del_req = api::DeleteUserRequest {
|
let del_req = api::DeleteUserRequest {
|
||||||
id: create_resp.get_ref().id.clone(),
|
id: create_resp.get_ref().id.clone(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let del_resp = service.delete(del_req).await;
|
let del_resp = service.delete(del_req).await;
|
||||||
assert!(del_resp.is_err());
|
assert!(del_resp.is_err());
|
||||||
|
|
||||||
@ -393,7 +391,7 @@ pub mod test {
|
|||||||
id: u.id.to_string(),
|
id: u.id.to_string(),
|
||||||
};
|
};
|
||||||
let mut del_req = Request::new(del_req);
|
let mut del_req = Request::new(del_req);
|
||||||
del_req.extensions_mut().insert(AuthID::User(u.id.clone()));
|
del_req.extensions_mut().insert(AuthID::User(u.id));
|
||||||
let del_resp = service.delete(del_req).await;
|
let del_resp = service.delete(del_req).await;
|
||||||
assert!(del_resp.is_err());
|
assert!(del_resp.is_err());
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,8 @@ pub mod test {
|
|||||||
|
|
||||||
for _ in 0..100000 {
|
for _ in 0..100000 {
|
||||||
let offset = get_ping_offset(beacon_ts, &dev_addr, ping_nb).unwrap();
|
let offset = get_ping_offset(beacon_ts, &dev_addr, ping_nb).unwrap();
|
||||||
assert!(offset <= ping_period - 1);
|
assert!(offset < ping_period);
|
||||||
beacon_ts = beacon_ts + *BEACON_PERIOD;
|
beacon_ts += *BEACON_PERIOD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1349,7 +1349,7 @@ impl Data {
|
|||||||
ds.last_device_status_request = Some(Utc::now().into());
|
ds.last_device_status_request = Some(Utc::now().into());
|
||||||
}
|
}
|
||||||
Some(ts) => {
|
Some(ts) => {
|
||||||
let ts: DateTime<Utc> = ts.clone().try_into().map_err(anyhow::Error::msg)?;
|
let ts: DateTime<Utc> = (*ts).try_into().map_err(anyhow::Error::msg)?;
|
||||||
let req_interval = Duration::from_secs(60 * 60 * 24)
|
let req_interval = Duration::from_secs(60 * 60 * 24)
|
||||||
/ self.device_profile.device_status_req_interval as u32;
|
/ self.device_profile.device_status_req_interval as u32;
|
||||||
|
|
||||||
@ -1711,8 +1711,7 @@ impl Data {
|
|||||||
|
|
||||||
match &rd.w_f_cnt_last_request {
|
match &rd.w_f_cnt_last_request {
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
let last_req: DateTime<Utc> =
|
let last_req: DateTime<Utc> = (*v).try_into().map_err(anyhow::Error::msg)?;
|
||||||
v.clone().try_into().map_err(anyhow::Error::msg)?;
|
|
||||||
if last_req
|
if last_req
|
||||||
< Utc::now()
|
< Utc::now()
|
||||||
.checked_sub_signed(chrono::Duration::try_hours(24).unwrap())
|
.checked_sub_signed(chrono::Duration::try_hours(24).unwrap())
|
||||||
|
@ -319,7 +319,7 @@ mod tests {
|
|||||||
for _ in 0..100 {
|
for _ in 0..100 {
|
||||||
let out = select_downlink_gateway(
|
let out = select_downlink_gateway(
|
||||||
test.tenant_id,
|
test.tenant_id,
|
||||||
&"eu868",
|
"eu868",
|
||||||
test.min_snr_margin,
|
test.min_snr_margin,
|
||||||
&mut rx_info,
|
&mut rx_info,
|
||||||
)
|
)
|
||||||
@ -328,8 +328,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(test.expected_gws.len(), gw_map.len());
|
assert_eq!(test.expected_gws.len(), gw_map.len());
|
||||||
assert_eq!(
|
assert!(
|
||||||
true,
|
|
||||||
expected_gws.keys().all(|k| gw_map.contains_key(k)),
|
expected_gws.keys().all(|k| gw_map.contains_key(k)),
|
||||||
"Expected: {:?}, got: {:?}",
|
"Expected: {:?}, got: {:?}",
|
||||||
expected_gws,
|
expected_gws,
|
||||||
|
@ -649,7 +649,7 @@ impl TxAck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let dfl = stream_pb::DownlinkFrameLog {
|
let dfl = stream_pb::DownlinkFrameLog {
|
||||||
time: dfl.time.clone(),
|
time: dfl.time,
|
||||||
phy_payload: phy.to_vec()?,
|
phy_payload: phy.to_vec()?,
|
||||||
tx_info: dfl.tx_info.clone(),
|
tx_info: dfl.tx_info.clone(),
|
||||||
downlink_id: dfl.downlink_id,
|
downlink_id: dfl.downlink_id,
|
||||||
|
@ -43,7 +43,7 @@ pub async fn get_geoloc_buffer(
|
|||||||
None => {
|
None => {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Some(v) => match v.clone().try_into() {
|
Some(v) => match (*v).try_into() {
|
||||||
Ok(v) => v,
|
Ok(v) => v,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,11 +44,7 @@ impl Integration {
|
|||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
|
|
||||||
info!(dev_eui = %di.dev_eui, "Forwarding join notification");
|
info!(dev_eui = %di.dev_eui, "Forwarding join notification");
|
||||||
let ts: DateTime<Utc> = pl
|
let ts: DateTime<Utc> = (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?;
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
@ -74,11 +70,7 @@ impl Integration {
|
|||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
|
|
||||||
info!(dev_eui = %di.dev_eui, "Forwarding updf message");
|
info!(dev_eui = %di.dev_eui, "Forwarding updf message");
|
||||||
let ts: DateTime<Utc> = pl
|
let ts: DateTime<Utc> = (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?;
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
@ -150,11 +142,7 @@ impl Integration {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
info!(dev_eui = %di.dev_eui, "Forwarding uplink meta-data");
|
info!(dev_eui = %di.dev_eui, "Forwarding uplink meta-data");
|
||||||
let ts: DateTime<Utc> = pl
|
let ts: DateTime<Utc> = (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?;
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
@ -242,11 +230,7 @@ impl Integration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let di = pl.device_info.as_ref().unwrap();
|
let di = pl.device_info.as_ref().unwrap();
|
||||||
let ts: DateTime<Utc> = pl
|
let ts: DateTime<Utc> = (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?;
|
.map_err(anyhow::Error::msg)?;
|
||||||
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
let dev_eui = EUI64::from_str(&di.dev_eui)?;
|
||||||
|
@ -268,11 +268,7 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventUp {
|
let e = EventUp {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -314,11 +310,7 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventJoin {
|
let e = EventJoin {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -352,11 +344,7 @@ impl IntegrationTrait for Integration {
|
|||||||
let e = EventAck {
|
let e = EventAck {
|
||||||
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -391,11 +379,7 @@ impl IntegrationTrait for Integration {
|
|||||||
let e = EventTxAck {
|
let e = EventTxAck {
|
||||||
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
queue_item_id: Uuid::from_str(&pl.queue_item_id)?,
|
||||||
downlink_id: pl.downlink_id as i64,
|
downlink_id: pl.downlink_id as i64,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -429,11 +413,7 @@ impl IntegrationTrait for Integration {
|
|||||||
info!(dev_eui = %di.dev_eui, event = "log", "Inserting event");
|
info!(dev_eui = %di.dev_eui, event = "log", "Inserting event");
|
||||||
|
|
||||||
let e = EventLog {
|
let e = EventLog {
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -469,11 +449,7 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventStatus {
|
let e = EventStatus {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -510,11 +486,7 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventLocation {
|
let e = EventLocation {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
@ -551,11 +523,7 @@ impl IntegrationTrait for Integration {
|
|||||||
|
|
||||||
let e = EventIntegration {
|
let e = EventIntegration {
|
||||||
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
deduplication_id: Uuid::from_str(&pl.deduplication_id)?,
|
||||||
time: pl
|
time: (*pl.time.as_ref().unwrap())
|
||||||
.time
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(anyhow::Error::msg)?,
|
.map_err(anyhow::Error::msg)?,
|
||||||
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
tenant_id: Uuid::from_str(&di.tenant_id)?,
|
||||||
|
@ -240,10 +240,10 @@ pub mod test {
|
|||||||
async fn assert_reply(last_id: &str, event: &str, b: &[u8]) -> String {
|
async fn assert_reply(last_id: &str, event: &str, b: &[u8]) -> String {
|
||||||
let srr: StreamReadReply = redis::cmd("XREAD")
|
let srr: StreamReadReply = redis::cmd("XREAD")
|
||||||
.arg("COUNT")
|
.arg("COUNT")
|
||||||
.arg(1 as usize)
|
.arg(1_usize)
|
||||||
.arg("STREAMS")
|
.arg("STREAMS")
|
||||||
.arg("device:stream:event")
|
.arg("device:stream:event")
|
||||||
.arg(&last_id)
|
.arg(last_id)
|
||||||
.query_async(&mut get_async_redis_conn().await.unwrap())
|
.query_async(&mut get_async_redis_conn().await.unwrap())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -128,10 +128,10 @@ mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -297,10 +297,10 @@ mod test {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
let d = device::get(&dev.dev_eui).await.unwrap();
|
let d = device::get(&dev.dev_eui).await.unwrap();
|
||||||
|
@ -137,22 +137,22 @@ pub mod test {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
tenant_id: tenant.id.clone(),
|
tenant_id: tenant.id,
|
||||||
name: "test-app".into(),
|
name: "test-app".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
tenant_id: tenant.id.clone(),
|
tenant_id: tenant.id,
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_str("0102030405060708").unwrap(),
|
dev_eui: EUI64::from_str("0102030405060708").unwrap(),
|
||||||
name: "test-device".into(),
|
name: "test-device".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -170,7 +170,7 @@ pub mod test {
|
|||||||
let resp = handle(&ufs, &tenant, &app, &dp, &dev, &block)
|
let resp = handle(&ufs, &tenant, &app, &dp, &dev, &block)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(true, resp.is_none());
|
assert!(resp.is_none());
|
||||||
|
|
||||||
// Integration events are handled async.
|
// Integration events are handled async.
|
||||||
sleep(Duration::from_millis(100)).await;
|
sleep(Duration::from_millis(100)).await;
|
||||||
@ -201,7 +201,7 @@ pub mod test {
|
|||||||
|
|
||||||
let d = device::get(&dev.dev_eui).await.unwrap();
|
let d = device::get(&dev.dev_eui).await.unwrap();
|
||||||
assert_eq!(Some(10), d.margin);
|
assert_eq!(Some(10), d.margin);
|
||||||
assert_eq!(false, d.external_power_source);
|
assert!(!d.external_power_source);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Some(BigDecimal::from_str("100.00").unwrap()),
|
Some(BigDecimal::from_str("100.00").unwrap()),
|
||||||
d.battery_level
|
d.battery_level
|
||||||
|
@ -50,22 +50,22 @@ pub mod test {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
tenant_id: tenant.id.clone(),
|
tenant_id: tenant.id,
|
||||||
name: "test-app".into(),
|
name: "test-app".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
tenant_id: tenant.id.clone(),
|
tenant_id: tenant.id,
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_str("0102030405060708").unwrap(),
|
dev_eui: EUI64::from_str("0102030405060708").unwrap(),
|
||||||
name: "test-device".into(),
|
name: "test-device".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -188,10 +188,10 @@ mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -222,10 +222,10 @@ mod test {
|
|||||||
let resp = handle(&mut dev, &tst.filter_list_ans, tst.filter_list_req.as_ref());
|
let resp = handle(&mut dev, &tst.filter_list_ans, tst.filter_list_req.as_ref());
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -171,7 +171,7 @@ pub mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test() {
|
fn test() {
|
||||||
region::set(
|
region::set(
|
||||||
&"eu868",
|
"eu868",
|
||||||
lrwn::region::get(lrwn::region::CommonName::EU868, false, false),
|
lrwn::region::get(lrwn::region::CommonName::EU868, false, false),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -367,19 +367,17 @@ pub mod test {
|
|||||||
let block = lrwn::MACCommandSet::new(vec![lrwn::MACCommand::LinkADRAns(
|
let block = lrwn::MACCommandSet::new(vec![lrwn::MACCommand::LinkADRAns(
|
||||||
tst.link_adr_ans.clone(),
|
tst.link_adr_ans.clone(),
|
||||||
)]);
|
)]);
|
||||||
let pending = match &tst.link_adr_req {
|
let pending = tst
|
||||||
Some(v) => Some(lrwn::MACCommandSet::new(vec![
|
.link_adr_req
|
||||||
lrwn::MACCommand::LinkADRReq(v.clone()),
|
.as_ref()
|
||||||
])),
|
.map(|v| lrwn::MACCommandSet::new(vec![lrwn::MACCommand::LinkADRReq(v.clone())]));
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
let res = handle(&ufs, &mut dev, &block, pending.as_ref());
|
let res = handle(&ufs, &mut dev, &block, pending.as_ref());
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, res.is_err(), "{}", tst.name);
|
assert!(res.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", res.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", res.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, res.unwrap().is_none(), "{}", tst.name);
|
assert!(res.unwrap().is_none(), "{}", tst.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -479,10 +479,10 @@ pub mod test {
|
|||||||
let res = handle(&mut dev, &tst.new_channel_ans, tst.new_channel_req.as_ref());
|
let res = handle(&mut dev, &tst.new_channel_ans, tst.new_channel_req.as_ref());
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, res.is_err(), "{}", tst.name);
|
assert!(res.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", res.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", res.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, res.unwrap().is_none(), "{}", tst.name);
|
assert!(res.unwrap().is_none(), "{}", tst.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -193,10 +193,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -171,10 +171,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -186,10 +186,10 @@ mod test {
|
|||||||
let resp = handle(&mut dev, &tst.relay_conf_ans, tst.relay_conf_req.as_ref());
|
let resp = handle(&mut dev, &tst.relay_conf_ans, tst.relay_conf_req.as_ref());
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -194,10 +194,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -113,10 +113,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -149,10 +149,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -137,10 +137,10 @@ pub mod test {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if let Some(e) = &tst.expected_error {
|
if let Some(e) = &tst.expected_error {
|
||||||
assert_eq!(true, resp.is_err(), "{}", tst.name);
|
assert!(resp.is_err(), "{}", tst.name);
|
||||||
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
assert_eq!(e, &format!("{}", resp.err().unwrap()), "{}", tst.name);
|
||||||
} else {
|
} else {
|
||||||
assert_eq!(true, resp.unwrap().is_none());
|
assert!(resp.unwrap().is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -127,7 +127,7 @@ pub mod test {
|
|||||||
pub async fn create_api_key(is_admin: bool, is_tenant: bool) -> ApiKey {
|
pub async fn create_api_key(is_admin: bool, is_tenant: bool) -> ApiKey {
|
||||||
let ak = ApiKey {
|
let ak = ApiKey {
|
||||||
name: "test api key".into(),
|
name: "test api key".into(),
|
||||||
is_admin: is_admin,
|
is_admin,
|
||||||
tenant_id: match is_tenant {
|
tenant_id: match is_tenant {
|
||||||
false => None,
|
false => None,
|
||||||
true => Some(tenant::test::create_tenant().await.id),
|
true => Some(tenant::test::create_tenant().await.id),
|
||||||
@ -191,6 +191,6 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&ak_admin.id).await.unwrap();
|
delete(&ak_admin.id).await.unwrap();
|
||||||
assert_eq!(true, delete(&ak_admin.id).await.is_err());
|
assert!(delete(&ak_admin.id).await.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ pub mod test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let a = Application {
|
let a = Application {
|
||||||
tenant_id: tenant_id,
|
tenant_id,
|
||||||
name: "test application".into(),
|
name: "test application".into(),
|
||||||
description: "test application description".into(),
|
description: "test application description".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -662,6 +662,6 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&app.id).await.unwrap();
|
delete(&app.id).await.unwrap();
|
||||||
assert_eq!(true, delete(&app.id).await.is_err());
|
assert!(delete(&app.id).await.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -795,9 +795,9 @@ pub mod test {
|
|||||||
|
|
||||||
let d = Device {
|
let d = Device {
|
||||||
name: "test-dev".into(),
|
name: "test-dev".into(),
|
||||||
dev_eui: dev_eui,
|
dev_eui,
|
||||||
application_id: application_id,
|
application_id,
|
||||||
device_profile_id: device_profile_id,
|
device_profile_id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -899,7 +899,7 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&d.dev_eui).await.unwrap();
|
delete(&d.dev_eui).await.unwrap();
|
||||||
assert_eq!(true, delete(&d.dev_eui).await.is_err());
|
assert!(delete(&d.dev_eui).await.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@ -1005,7 +1005,7 @@ pub mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_get_full_f_cnt_up() {
|
fn test_get_full_f_cnt_up() {
|
||||||
// server, device, expected
|
// server, device, expected
|
||||||
let tests = vec![
|
let tests = [
|
||||||
(1, 1, 1), // frame-counter is as expected
|
(1, 1, 1), // frame-counter is as expected
|
||||||
(1 << 16, 0, 1 << 16), // frame-counter is as expected
|
(1 << 16, 0, 1 << 16), // frame-counter is as expected
|
||||||
((1 << 16) + 1, 1, (1 << 16) + 1), // frame-counter is as expected
|
((1 << 16) + 1, 1, (1 << 16) + 1), // frame-counter is as expected
|
||||||
@ -1014,7 +1014,7 @@ pub mod test {
|
|||||||
(2, 1, 1), // re-transmission of previous frame
|
(2, 1, 1), // re-transmission of previous frame
|
||||||
((1 << 16) + 1, 0, (1 << 16)), // re-transmission of previous frame
|
((1 << 16) + 1, 0, (1 << 16)), // re-transmission of previous frame
|
||||||
((1 << 16), (1 << 16) - 1, (1 << 16) - 1), // re-transmission of previous frame
|
((1 << 16), (1 << 16) - 1, (1 << 16) - 1), // re-transmission of previous frame
|
||||||
(u32::MAX, 0, 0), // 32bit frame-counter rollover
|
(u32::MAX, 0, 0),
|
||||||
];
|
];
|
||||||
|
|
||||||
for (i, tst) in tests.iter().enumerate() {
|
for (i, tst) in tests.iter().enumerate() {
|
||||||
@ -1363,7 +1363,7 @@ pub mod test {
|
|||||||
|
|
||||||
let d = get_for_phypayload_and_incr_f_cnt_up(false, &mut phy, 0, 0).await;
|
let d = get_for_phypayload_and_incr_f_cnt_up(false, &mut phy, 0, 0).await;
|
||||||
if tst.expected_error.is_some() {
|
if tst.expected_error.is_some() {
|
||||||
assert_eq!(true, d.is_err());
|
assert!(d.is_err());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
tst.expected_error.as_ref().unwrap(),
|
tst.expected_error.as_ref().unwrap(),
|
||||||
&d.err().unwrap().to_string()
|
&d.err().unwrap().to_string()
|
||||||
@ -1380,15 +1380,15 @@ pub mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let ValidationStatus::Ok(full_f_cnt, d) = d {
|
if let ValidationStatus::Ok(full_f_cnt, d) = d {
|
||||||
assert_eq!(false, tst.expected_retransmission);
|
assert!(!tst.expected_retransmission);
|
||||||
assert_eq!(tst.expected_dev_eui, d.dev_eui,);
|
assert_eq!(tst.expected_dev_eui, d.dev_eui,);
|
||||||
assert_eq!(tst.expected_fcnt_up, full_f_cnt);
|
assert_eq!(tst.expected_fcnt_up, full_f_cnt);
|
||||||
} else if let ValidationStatus::Retransmission(full_f_cnt, d) = d {
|
} else if let ValidationStatus::Retransmission(full_f_cnt, d) = d {
|
||||||
assert_eq!(true, tst.expected_retransmission);
|
assert!(tst.expected_retransmission);
|
||||||
assert_eq!(tst.expected_dev_eui, d.dev_eui,);
|
assert_eq!(tst.expected_dev_eui, d.dev_eui,);
|
||||||
assert_eq!(tst.expected_fcnt_up, full_f_cnt);
|
assert_eq!(tst.expected_fcnt_up, full_f_cnt);
|
||||||
} else if let ValidationStatus::Reset(_, d) = d {
|
} else if let ValidationStatus::Reset(_, d) = d {
|
||||||
assert_eq!(true, tst.expected_reset);
|
assert!(tst.expected_reset);
|
||||||
assert_eq!(tst.expected_dev_eui, d.dev_eui,);
|
assert_eq!(tst.expected_dev_eui, d.dev_eui,);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ pub mod test {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let dk = DeviceKeys {
|
let dk = DeviceKeys {
|
||||||
dev_eui: dev_eui,
|
dev_eui,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -213,6 +213,6 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&dk.dev_eui).await.unwrap();
|
delete(&dk.dev_eui).await.unwrap();
|
||||||
assert_eq!(true, delete(&dk.dev_eui).await.is_err());
|
assert!(delete(&dk.dev_eui).await.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ pub mod test {
|
|||||||
kv.insert("foo".into(), "bar".into());
|
kv.insert("foo".into(), "bar".into());
|
||||||
|
|
||||||
let dp = DeviceProfile {
|
let dp = DeviceProfile {
|
||||||
tenant_id: tenant_id,
|
tenant_id,
|
||||||
name: "test device-profile".into(),
|
name: "test device-profile".into(),
|
||||||
region: CommonName::EU868,
|
region: CommonName::EU868,
|
||||||
mac_version: MacVersion::LORAWAN_1_0_2,
|
mac_version: MacVersion::LORAWAN_1_0_2,
|
||||||
@ -501,6 +501,6 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&dp.id).await.unwrap();
|
delete(&dp.id).await.unwrap();
|
||||||
assert_eq!(true, delete(&dp.id).await.is_err());
|
assert!(delete(&dp.id).await.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,6 +361,6 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&dp.id).await.unwrap();
|
delete(&dp.id).await.unwrap();
|
||||||
assert_eq!(true, delete(&dp.id).await.is_err());
|
assert!(delete(&dp.id).await.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ pub mod test {
|
|||||||
// next next queue item for dev eui
|
// next next queue item for dev eui
|
||||||
let resp = get_next_for_dev_eui(&d.dev_eui).await.unwrap();
|
let resp = get_next_for_dev_eui(&d.dev_eui).await.unwrap();
|
||||||
assert_eq!(qi, resp.0);
|
assert_eq!(qi, resp.0);
|
||||||
assert_eq!(false, resp.1);
|
assert!(!resp.1);
|
||||||
|
|
||||||
// update
|
// update
|
||||||
qi.is_pending = true;
|
qi.is_pending = true;
|
||||||
@ -244,7 +244,7 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete_item(&qi.id).await.unwrap();
|
delete_item(&qi.id).await.unwrap();
|
||||||
assert_eq!(true, delete_item(&qi.id).await.is_err());
|
assert!(delete_item(&qi.id).await.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@ -269,7 +269,7 @@ pub mod test {
|
|||||||
|
|
||||||
// flush
|
// flush
|
||||||
flush_for_dev_eui(&d.dev_eui).await.unwrap();
|
flush_for_dev_eui(&d.dev_eui).await.unwrap();
|
||||||
assert_eq!(true, delete_item(&qi.id).await.is_err());
|
assert!(delete_item(&qi.id).await.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -502,7 +502,7 @@ pub mod test {
|
|||||||
|
|
||||||
let gw = Gateway {
|
let gw = Gateway {
|
||||||
gateway_id: id,
|
gateway_id: id,
|
||||||
tenant_id: tenant_id,
|
tenant_id,
|
||||||
name: "gw".into(),
|
name: "gw".into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
@ -653,7 +653,7 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&gw.gateway_id).await.unwrap();
|
delete(&gw.gateway_id).await.unwrap();
|
||||||
assert_eq!(true, delete(&gw.gateway_id).await.is_err());
|
assert!(delete(&gw.gateway_id).await.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -87,6 +87,6 @@ pub mod test {
|
|||||||
let resp = get_pending(&dev_eui, lrwn::CID::DevStatusReq)
|
let resp = get_pending(&dev_eui, lrwn::CID::DevStatusReq)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(true, resp.is_none());
|
assert!(resp.is_none());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ pub async fn save(ds: &internal::PassiveRoamingDeviceSession) -> Result<()> {
|
|||||||
EUI64::from_slice(&ds.dev_eui)?
|
EUI64::from_slice(&ds.dev_eui)?
|
||||||
};
|
};
|
||||||
|
|
||||||
let lifetime: DateTime<Utc> = match ds.lifetime.clone() {
|
let lifetime: DateTime<Utc> = match ds.lifetime {
|
||||||
Some(v) => v.try_into().map_err(anyhow::Error::msg)?,
|
Some(v) => v.try_into().map_err(anyhow::Error::msg)?,
|
||||||
None => {
|
None => {
|
||||||
debug!("Not saving passive-roaming device-session, no passive-roaming lifetime set");
|
debug!("Not saving passive-roaming device-session, no passive-roaming lifetime set");
|
||||||
|
@ -254,7 +254,7 @@ pub mod test {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -262,7 +262,7 @@ pub mod test {
|
|||||||
|
|
||||||
let a = application::create(application::Application {
|
let a = application::create(application::Application {
|
||||||
name: "test-app".into(),
|
name: "test-app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -271,7 +271,7 @@ pub mod test {
|
|||||||
let _gw = gateway::create(gateway::Gateway {
|
let _gw = gateway::create(gateway::Gateway {
|
||||||
gateway_id: EUI64::from_str("0102030405060708").unwrap(),
|
gateway_id: EUI64::from_str("0102030405060708").unwrap(),
|
||||||
name: "test-gateway".into(),
|
name: "test-gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -280,8 +280,8 @@ pub mod test {
|
|||||||
let _d = device::create(device::Device {
|
let _d = device::create(device::Device {
|
||||||
dev_eui: EUI64::from_str("0203040506070809").unwrap(),
|
dev_eui: EUI64::from_str("0203040506070809").unwrap(),
|
||||||
name: "test-device".into(),
|
name: "test-device".into(),
|
||||||
application_id: a.id.clone(),
|
application_id: a.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -322,8 +322,8 @@ pub mod test {
|
|||||||
|
|
||||||
// User is tenant-user, this returns results.
|
// User is tenant-user, this returns results.
|
||||||
tenant::add_user(tenant::TenantUser {
|
tenant::add_user(tenant::TenantUser {
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
user_id: u.id.clone(),
|
user_id: u.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
@ -344,7 +344,7 @@ pub mod test {
|
|||||||
let _guard = test::prepare().await;
|
let _guard = test::prepare().await;
|
||||||
|
|
||||||
// delete default tenant
|
// delete default tenant
|
||||||
let _ = delete(&Uuid::from_str("52f14cd4-c6f1-4fbd-8f87-4025e1d49242").unwrap())
|
delete(&Uuid::from_str("52f14cd4-c6f1-4fbd-8f87-4025e1d49242").unwrap())
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ pub mod test {
|
|||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&t.id).await.unwrap();
|
delete(&t.id).await.unwrap();
|
||||||
assert_eq!(true, delete(&t.id).await.is_err());
|
assert!(delete(&t.id).await.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -232,20 +232,20 @@ pub mod test {
|
|||||||
email_verified: true,
|
email_verified: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
user.set_password_hash(&"password!", 1).unwrap();
|
user.set_password_hash("password!", 1).unwrap();
|
||||||
create(user).await.unwrap()
|
create(user).await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hash_password() {
|
fn test_hash_password() {
|
||||||
assert_eq!(true, hash_password(&"foobar", 1000).is_ok());
|
assert!(hash_password("foobar", 1000).is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_verify_password() {
|
fn test_verify_password() {
|
||||||
// this is the ChirpStack Application Server default admin hash, with == removed
|
// this is the ChirpStack Application Server default admin hash, with == removed
|
||||||
// to test the compatibility betweeh the two pbkdf2 implementations.
|
// to test the compatibility betweeh the two pbkdf2 implementations.
|
||||||
assert_eq!(true, verify_password(&"admin", &"$pbkdf2-sha512$i=1,l=64$l8zGKtxRESq3PA2kFhHRWA$H3lGMxOt55wjwoc+myeOoABofJY9oDpldJa7fhqdjbh700V6FLPML75UmBOt9J5VFNjAL1AvqCozA1HJM0QVGA"));
|
assert!(verify_password("admin", "$pbkdf2-sha512$i=1,l=64$l8zGKtxRESq3PA2kFhHRWA$H3lGMxOt55wjwoc+myeOoABofJY9oDpldJa7fhqdjbh700V6FLPML75UmBOt9J5VFNjAL1AvqCozA1HJM0QVGA"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@ -262,23 +262,20 @@ pub mod test {
|
|||||||
user = update(user).await.unwrap();
|
user = update(user).await.unwrap();
|
||||||
|
|
||||||
// get by external id
|
// get by external id
|
||||||
let user_get = get_by_external_id(&"external_id").await.unwrap();
|
let user_get = get_by_external_id("external_id").await.unwrap();
|
||||||
assert_eq!(user, user_get);
|
assert_eq!(user, user_get);
|
||||||
|
|
||||||
// get_by_email_and_pw
|
// get_by_email_and_pw
|
||||||
assert_eq!(
|
assert!(get_by_email_and_pw("test@example.com", "bar")
|
||||||
true,
|
.await
|
||||||
get_by_email_and_pw(&"test@example.com", &"bar")
|
.is_err());
|
||||||
.await
|
let user_get = get_by_email_and_pw("test@example.com", "password!")
|
||||||
.is_err()
|
|
||||||
);
|
|
||||||
let user_get = get_by_email_and_pw(&"test@example.com", &"password!")
|
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(user, user_get);
|
assert_eq!(user, user_get);
|
||||||
|
|
||||||
// delete
|
// delete
|
||||||
delete(&user.id).await.unwrap();
|
delete(&user.id).await.unwrap();
|
||||||
assert_eq!(true, delete(&user.id).await.is_err());
|
assert!(delete(&user.id).await.is_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ mod tests {
|
|||||||
let key = redis_key("api:stream:request".to_string());
|
let key = redis_key("api:stream:request".to_string());
|
||||||
let srr: StreamReadReply = redis::cmd("XREAD")
|
let srr: StreamReadReply = redis::cmd("XREAD")
|
||||||
.arg("COUNT")
|
.arg("COUNT")
|
||||||
.arg(1 as usize)
|
.arg(1_usize)
|
||||||
.arg("STREAMS")
|
.arg("STREAMS")
|
||||||
.arg(&key)
|
.arg(&key)
|
||||||
.arg("0")
|
.arg("0")
|
||||||
|
@ -30,7 +30,7 @@ pub async fn log_uplink_for_gateways(ufl: &stream::UplinkFrameLog) -> Result<()>
|
|||||||
m_type: ufl.m_type,
|
m_type: ufl.m_type,
|
||||||
dev_addr: ufl.dev_addr.clone(),
|
dev_addr: ufl.dev_addr.clone(),
|
||||||
dev_eui: ufl.dev_eui.clone(),
|
dev_eui: ufl.dev_eui.clone(),
|
||||||
time: ufl.time.clone(),
|
time: ufl.time,
|
||||||
plaintext_f_opts: ufl.plaintext_f_opts,
|
plaintext_f_opts: ufl.plaintext_f_opts,
|
||||||
plaintext_frm_payload: ufl.plaintext_frm_payload,
|
plaintext_frm_payload: ufl.plaintext_frm_payload,
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,7 @@ pub type Validator = Box<dyn Fn() -> Pin<Box<dyn Future<Output = ()>>>>;
|
|||||||
|
|
||||||
pub fn f_cnt_up(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
pub fn f_cnt_up(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -36,7 +36,7 @@ pub fn f_cnt_up(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
|||||||
|
|
||||||
pub fn n_f_cnt_down(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
pub fn n_f_cnt_down(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -47,7 +47,7 @@ pub fn n_f_cnt_down(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
|||||||
|
|
||||||
pub fn a_f_cnt_down(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
pub fn a_f_cnt_down(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -58,7 +58,7 @@ pub fn a_f_cnt_down(dev_eui: EUI64, f_cnt: u32) -> Validator {
|
|||||||
|
|
||||||
pub fn tx_power_index(dev_eui: EUI64, tx_power: u32) -> Validator {
|
pub fn tx_power_index(dev_eui: EUI64, tx_power: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -69,7 +69,7 @@ pub fn tx_power_index(dev_eui: EUI64, tx_power: u32) -> Validator {
|
|||||||
|
|
||||||
pub fn nb_trans(dev_eui: EUI64, nb_trans: u32) -> Validator {
|
pub fn nb_trans(dev_eui: EUI64, nb_trans: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -80,7 +80,7 @@ pub fn nb_trans(dev_eui: EUI64, nb_trans: u32) -> Validator {
|
|||||||
|
|
||||||
pub fn enabled_uplink_channel_indices(dev_eui: EUI64, channels: Vec<u32>) -> Validator {
|
pub fn enabled_uplink_channel_indices(dev_eui: EUI64, channels: Vec<u32>) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
let channels = channels.clone();
|
let channels = channels.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
@ -92,7 +92,7 @@ pub fn enabled_uplink_channel_indices(dev_eui: EUI64, channels: Vec<u32>) -> Val
|
|||||||
|
|
||||||
pub fn dr(dev_eui: EUI64, dr: u32) -> Validator {
|
pub fn dr(dev_eui: EUI64, dr: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -103,7 +103,7 @@ pub fn dr(dev_eui: EUI64, dr: u32) -> Validator {
|
|||||||
|
|
||||||
pub fn mac_command_error_count(dev_eui: EUI64, cid: lrwn::CID, count: u32) -> Validator {
|
pub fn mac_command_error_count(dev_eui: EUI64, cid: lrwn::CID, count: u32) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
let ds = d.get_device_session().unwrap();
|
let ds = d.get_device_session().unwrap();
|
||||||
@ -120,7 +120,7 @@ pub fn mac_command_error_count(dev_eui: EUI64, cid: lrwn::CID, count: u32) -> Va
|
|||||||
|
|
||||||
pub fn uplink_adr_history(dev_eui: EUI64, uh: Vec<internal::UplinkAdrHistory>) -> Validator {
|
pub fn uplink_adr_history(dev_eui: EUI64, uh: Vec<internal::UplinkAdrHistory>) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
let uh = uh.clone();
|
let uh = uh.clone();
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
@ -361,7 +361,7 @@ pub fn downlink_frame_saved(df: internal::DownlinkFrame) -> Validator {
|
|||||||
pub fn device_queue_items(dev_eui: EUI64, items: Vec<device_queue::DeviceQueueItem>) -> Validator {
|
pub fn device_queue_items(dev_eui: EUI64, items: Vec<device_queue::DeviceQueueItem>) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let items = items.clone();
|
let items = items.clone();
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let items_get = device_queue::get_for_dev_eui(&dev_eui).await.unwrap();
|
let items_get = device_queue::get_for_dev_eui(&dev_eui).await.unwrap();
|
||||||
|
|
||||||
@ -394,8 +394,8 @@ pub fn device_queue_items(dev_eui: EUI64, items: Vec<device_queue::DeviceQueueIt
|
|||||||
|
|
||||||
pub fn enabled_class(dev_eui: EUI64, c: DeviceClass) -> Validator {
|
pub fn enabled_class(dev_eui: EUI64, c: DeviceClass) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let c = c.clone();
|
let c = c;
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let dev = device::get(&dev_eui).await.unwrap();
|
let dev = device::get(&dev_eui).await.unwrap();
|
||||||
assert_eq!(c, dev.enabled_class);
|
assert_eq!(c, dev.enabled_class);
|
||||||
@ -410,7 +410,7 @@ pub fn uplink_meta_log(um: stream::UplinkMeta) -> Validator {
|
|||||||
let key = redis_key("stream:meta".to_string());
|
let key = redis_key("stream:meta".to_string());
|
||||||
let srr: StreamReadReply = redis::cmd("XREAD")
|
let srr: StreamReadReply = redis::cmd("XREAD")
|
||||||
.arg("COUNT")
|
.arg("COUNT")
|
||||||
.arg(1 as usize)
|
.arg(1_usize)
|
||||||
.arg("STREAMS")
|
.arg("STREAMS")
|
||||||
.arg(&key)
|
.arg(&key)
|
||||||
.arg("0")
|
.arg("0")
|
||||||
@ -446,7 +446,7 @@ pub fn device_uplink_frame_log(uf: stream::UplinkFrameLog) -> Validator {
|
|||||||
let key = redis_key(format!("device:{{{}}}:stream:frame", uf.dev_eui));
|
let key = redis_key(format!("device:{{{}}}:stream:frame", uf.dev_eui));
|
||||||
let srr: StreamReadReply = redis::cmd("XREAD")
|
let srr: StreamReadReply = redis::cmd("XREAD")
|
||||||
.arg("COUNT")
|
.arg("COUNT")
|
||||||
.arg(1 as usize)
|
.arg(1_usize)
|
||||||
.arg("STREAMS")
|
.arg("STREAMS")
|
||||||
.arg(&key)
|
.arg(&key)
|
||||||
.arg("0")
|
.arg("0")
|
||||||
@ -477,7 +477,7 @@ pub fn device_uplink_frame_log(uf: stream::UplinkFrameLog) -> Validator {
|
|||||||
|
|
||||||
pub fn scheduler_run_after_set(dev_eui: EUI64) -> Validator {
|
pub fn scheduler_run_after_set(dev_eui: EUI64) -> Validator {
|
||||||
Box::new(move || {
|
Box::new(move || {
|
||||||
let dev_eui = dev_eui.clone();
|
let dev_eui = dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let d = device::get(&dev_eui).await.unwrap();
|
let d = device::get(&dev_eui).await.unwrap();
|
||||||
assert!(d.scheduler_run_after.is_some());
|
assert!(d.scheduler_run_after.is_some());
|
||||||
|
@ -123,7 +123,7 @@ async fn test_fns_uplink() {
|
|||||||
ul_meta_data: backend::ULMetaData {
|
ul_meta_data: backend::ULMetaData {
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
@ -150,7 +150,7 @@ async fn test_fns_uplink() {
|
|||||||
.status(200);
|
.status(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
// Simulate uplink
|
// Simulate uplink
|
||||||
uplink::handle_uplink(
|
uplink::handle_uplink(
|
||||||
@ -201,7 +201,7 @@ async fn test_sns_uplink() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -209,7 +209,7 @@ async fn test_sns_uplink() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -225,8 +225,8 @@ async fn test_sns_uplink() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
dev_addr: Some(dev_addr),
|
dev_addr: Some(dev_addr),
|
||||||
@ -324,7 +324,7 @@ async fn test_sns_uplink() {
|
|||||||
ul_meta_data: backend::ULMetaData {
|
ul_meta_data: backend::ULMetaData {
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
@ -450,7 +450,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -458,7 +458,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -473,8 +473,8 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
dev_addr: Some(dev_addr),
|
dev_addr: Some(dev_addr),
|
||||||
@ -563,7 +563,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
ul_meta_data: backend::ULMetaData {
|
ul_meta_data: backend::ULMetaData {
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
@ -676,7 +676,7 @@ async fn test_sns_dev_not_found() {
|
|||||||
ul_meta_data: backend::ULMetaData {
|
ul_meta_data: backend::ULMetaData {
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
|
@ -52,7 +52,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let gw_a = gateway::create(gateway::Gateway {
|
let gw_a = gateway::create(gateway::Gateway {
|
||||||
name: "gateway-a".into(),
|
name: "gateway-a".into(),
|
||||||
tenant_id: t_a.id.clone(),
|
tenant_id: t_a.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -61,7 +61,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let gw_b = gateway::create(gateway::Gateway {
|
let gw_b = gateway::create(gateway::Gateway {
|
||||||
name: "gateway-b".into(),
|
name: "gateway-b".into(),
|
||||||
tenant_id: t_b.id.clone(),
|
tenant_id: t_b.id,
|
||||||
gateway_id: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -70,7 +70,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t_a.id.clone(),
|
tenant_id: t_a.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -78,7 +78,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t_a.id.clone(),
|
tenant_id: t_a.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -90,8 +90,8 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -144,7 +144,7 @@ async fn test_gateway_filtering() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let tests = vec![
|
let tests = vec![
|
||||||
Test {
|
Test {
|
||||||
@ -256,8 +256,8 @@ async fn test_region_config_id_filtering() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -294,7 +294,7 @@ async fn test_region_config_id_filtering() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -387,7 +387,7 @@ async fn test_lorawan_10_errors() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -396,7 +396,7 @@ async fn test_lorawan_10_errors() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -404,7 +404,7 @@ async fn test_lorawan_10_errors() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -416,8 +416,8 @@ async fn test_lorawan_10_errors() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -442,7 +442,7 @@ async fn test_lorawan_10_errors() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -584,7 +584,7 @@ async fn test_lorawan_11_errors() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -593,7 +593,7 @@ async fn test_lorawan_11_errors() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -601,7 +601,7 @@ async fn test_lorawan_11_errors() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -613,8 +613,8 @@ async fn test_lorawan_11_errors() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -639,13 +639,13 @@ async fn test_lorawan_11_errors() {
|
|||||||
frequency: 868300000,
|
frequency: 868300000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_freq, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_freq, 0).unwrap();
|
||||||
|
|
||||||
let mut tx_info_dr = gw::UplinkTxInfo {
|
let mut tx_info_dr = gw::UplinkTxInfo {
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_dr, 3).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_dr, 3).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -738,7 +738,7 @@ async fn test_lorawan_10_skip_f_cnt() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -747,7 +747,7 @@ async fn test_lorawan_10_skip_f_cnt() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -755,7 +755,7 @@ async fn test_lorawan_10_skip_f_cnt() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -767,8 +767,8 @@ async fn test_lorawan_10_skip_f_cnt() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
skip_fcnt_check: true,
|
skip_fcnt_check: true,
|
||||||
@ -794,7 +794,7 @@ async fn test_lorawan_10_skip_f_cnt() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -932,7 +932,7 @@ async fn test_lorawan_10_device_disabled() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -941,7 +941,7 @@ async fn test_lorawan_10_device_disabled() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -949,7 +949,7 @@ async fn test_lorawan_10_device_disabled() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -961,8 +961,8 @@ async fn test_lorawan_10_device_disabled() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
is_disabled: true,
|
is_disabled: true,
|
||||||
@ -988,7 +988,7 @@ async fn test_lorawan_10_device_disabled() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -1056,7 +1056,7 @@ async fn test_lorawan_10_uplink() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -1065,7 +1065,7 @@ async fn test_lorawan_10_uplink() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -1073,7 +1073,7 @@ async fn test_lorawan_10_uplink() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -1085,8 +1085,8 @@ async fn test_lorawan_10_uplink() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -1111,13 +1111,13 @@ async fn test_lorawan_10_uplink() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
||||||
frequency: 867300000,
|
frequency: 867300000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_lr_fhss, 10).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_lr_fhss, 10).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -1693,7 +1693,7 @@ async fn test_lorawan_10_end_to_end_enc() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -1702,7 +1702,7 @@ async fn test_lorawan_10_end_to_end_enc() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -1710,7 +1710,7 @@ async fn test_lorawan_10_end_to_end_enc() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -1722,8 +1722,8 @@ async fn test_lorawan_10_end_to_end_enc() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -1748,7 +1748,7 @@ async fn test_lorawan_10_end_to_end_enc() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds_sess_key_id = internal::DeviceSession {
|
let ds_sess_key_id = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -2021,7 +2021,7 @@ async fn test_lorawan_11_uplink() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -2030,7 +2030,7 @@ async fn test_lorawan_11_uplink() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -2038,7 +2038,7 @@ async fn test_lorawan_11_uplink() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -2050,8 +2050,8 @@ async fn test_lorawan_11_uplink() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -2076,13 +2076,13 @@ async fn test_lorawan_11_uplink() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan110.into(),
|
mac_version: common::MacVersion::Lorawan110.into(),
|
||||||
@ -2260,7 +2260,7 @@ async fn test_lorawan_10_rx_delay() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -2269,7 +2269,7 @@ async fn test_lorawan_10_rx_delay() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -2277,7 +2277,7 @@ async fn test_lorawan_10_rx_delay() {
|
|||||||
|
|
||||||
let mut dp = device_profile::create(device_profile::DeviceProfile {
|
let mut dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -2289,8 +2289,8 @@ async fn test_lorawan_10_rx_delay() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -2315,13 +2315,13 @@ async fn test_lorawan_10_rx_delay() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -2705,7 +2705,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -2714,7 +2714,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -2722,7 +2722,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -2734,8 +2734,8 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -2760,13 +2760,13 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -2793,7 +2793,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![],
|
device_queue_items: vec![],
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.device_status_req_interval = 1;
|
dp.device_status_req_interval = 1;
|
||||||
@ -2801,7 +2801,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.device_status_req_interval = 0;
|
dp.device_status_req_interval = 0;
|
||||||
@ -2892,7 +2892,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
}],
|
}],
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.device_status_req_interval = 1;
|
dp.device_status_req_interval = 1;
|
||||||
@ -2900,7 +2900,7 @@ async fn test_lorawan_10_mac_commands() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.device_status_req_interval = 0;
|
dp.device_status_req_interval = 0;
|
||||||
@ -3076,7 +3076,7 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -3085,7 +3085,7 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -3093,7 +3093,7 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -3105,8 +3105,8 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -3131,7 +3131,7 @@ async fn test_lorawan_11_mac_commands() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan110.into(),
|
mac_version: common::MacVersion::Lorawan110.into(),
|
||||||
@ -3270,7 +3270,7 @@ async fn test_lorawan_10_device_queue() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -3279,7 +3279,7 @@ async fn test_lorawan_10_device_queue() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -3287,7 +3287,7 @@ async fn test_lorawan_10_device_queue() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -3299,8 +3299,8 @@ async fn test_lorawan_10_device_queue() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -3325,7 +3325,7 @@ async fn test_lorawan_10_device_queue() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -3747,7 +3747,7 @@ async fn test_lorawan_11_device_queue() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -3756,7 +3756,7 @@ async fn test_lorawan_11_device_queue() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -3764,7 +3764,7 @@ async fn test_lorawan_11_device_queue() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -3776,8 +3776,8 @@ async fn test_lorawan_11_device_queue() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -3802,7 +3802,7 @@ async fn test_lorawan_11_device_queue() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan110.into(),
|
mac_version: common::MacVersion::Lorawan110.into(),
|
||||||
@ -4227,7 +4227,7 @@ async fn test_lorawan_10_adr() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -4236,7 +4236,7 @@ async fn test_lorawan_10_adr() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -4244,7 +4244,7 @@ async fn test_lorawan_10_adr() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -4257,8 +4257,8 @@ async fn test_lorawan_10_adr() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -4283,7 +4283,7 @@ async fn test_lorawan_10_adr() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -5070,7 +5070,7 @@ async fn test_lorawan_10_device_status_request() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -5079,7 +5079,7 @@ async fn test_lorawan_10_device_status_request() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -5087,7 +5087,7 @@ async fn test_lorawan_10_device_status_request() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -5100,8 +5100,8 @@ async fn test_lorawan_10_device_status_request() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -5126,7 +5126,7 @@ async fn test_lorawan_10_device_status_request() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -5336,7 +5336,7 @@ async fn test_lorawan_11_receive_window_selection() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -5345,7 +5345,7 @@ async fn test_lorawan_11_receive_window_selection() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -5353,7 +5353,7 @@ async fn test_lorawan_11_receive_window_selection() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -5365,8 +5365,8 @@ async fn test_lorawan_11_receive_window_selection() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -5391,13 +5391,13 @@ async fn test_lorawan_11_receive_window_selection() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
let mut tx_info_lr_fhss = gw::UplinkTxInfo {
|
||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info_lr_fhss, 8).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan110.into(),
|
mac_version: common::MacVersion::Lorawan110.into(),
|
||||||
@ -5660,7 +5660,7 @@ async fn test_lorawan_11_receive_window_selection() {
|
|||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 5).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 5).unwrap();
|
||||||
|
|
||||||
run_test(&Test {
|
run_test(&Test {
|
||||||
name: "unconfirmed uplink with payload (rx1, payload exceeds rx2 limit)".into(),
|
name: "unconfirmed uplink with payload (rx1, payload exceeds rx2 limit)".into(),
|
||||||
@ -5774,7 +5774,7 @@ async fn run_test(t: &Test) {
|
|||||||
reset_redis().await.unwrap();
|
reset_redis().await.unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
|
@ -48,7 +48,7 @@ async fn test_uplink() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -57,7 +57,7 @@ async fn test_uplink() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -65,7 +65,7 @@ async fn test_uplink() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -78,8 +78,8 @@ async fn test_uplink() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -103,7 +103,7 @@ async fn test_uplink() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let ds = internal::DeviceSession {
|
let ds = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -157,8 +157,8 @@ async fn test_uplink() {
|
|||||||
mic: Some([241, 100, 207, 79]),
|
mic: Some([241, 100, 207, 79]),
|
||||||
},
|
},
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::f_cnt_up(dev.dev_eui.clone(), 9),
|
assert::f_cnt_up(dev.dev_eui, 9),
|
||||||
assert::enabled_class(dev.dev_eui.clone(), DeviceClass::B),
|
assert::enabled_class(dev.dev_eui, DeviceClass::B),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
@ -192,8 +192,8 @@ async fn test_uplink() {
|
|||||||
mic: Some([137, 180, 12, 148]),
|
mic: Some([137, 180, 12, 148]),
|
||||||
},
|
},
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::f_cnt_up(dev.dev_eui.clone(), 9),
|
assert::f_cnt_up(dev.dev_eui, 9),
|
||||||
assert::enabled_class(dev.dev_eui.clone(), DeviceClass::A),
|
assert::enabled_class(dev.dev_eui, DeviceClass::A),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
@ -213,7 +213,7 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -222,7 +222,7 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -230,7 +230,7 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -243,8 +243,8 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -296,7 +296,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -304,8 +304,8 @@ async fn test_downlink_scheduler() {
|
|||||||
device_session: Some(ds.clone()),
|
device_session: Some(ds.clone()),
|
||||||
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::f_cnt_up(dev.dev_eui.clone(), 8),
|
assert::f_cnt_up(dev.dev_eui, 8),
|
||||||
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
|
assert::n_f_cnt_down(dev.dev_eui, 5),
|
||||||
assert::downlink_frame(gw::DownlinkFrame {
|
assert::downlink_frame(gw::DownlinkFrame {
|
||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
items: vec![gw::DownlinkFrameItem {
|
items: vec![gw::DownlinkFrameItem {
|
||||||
@ -348,7 +348,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -376,14 +376,14 @@ async fn test_downlink_scheduler() {
|
|||||||
device_queue_items: vec![
|
device_queue_items: vec![
|
||||||
device_queue::DeviceQueueItem {
|
device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
device_queue::DeviceQueueItem {
|
device_queue::DeviceQueueItem {
|
||||||
id: Uuid::new_v4(),
|
id: Uuid::new_v4(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3, 4],
|
data: vec![1, 2, 3, 4],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -392,8 +392,8 @@ async fn test_downlink_scheduler() {
|
|||||||
device_session: Some(ds.clone()),
|
device_session: Some(ds.clone()),
|
||||||
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::f_cnt_up(dev.dev_eui.clone(), 8),
|
assert::f_cnt_up(dev.dev_eui, 8),
|
||||||
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
|
assert::n_f_cnt_down(dev.dev_eui, 5),
|
||||||
assert::downlink_frame(gw::DownlinkFrame {
|
assert::downlink_frame(gw::DownlinkFrame {
|
||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
items: vec![gw::DownlinkFrameItem {
|
items: vec![gw::DownlinkFrameItem {
|
||||||
@ -440,7 +440,7 @@ async fn run_uplink_test(t: &UplinkTest) {
|
|||||||
reset_redis().await.unwrap();
|
reset_redis().await.unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
@ -482,7 +482,7 @@ async fn run_scheduler_test(t: &DownlinkTest) {
|
|||||||
reset_redis().await.unwrap();
|
reset_redis().await.unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
@ -498,7 +498,7 @@ async fn run_scheduler_test(t: &DownlinkTest) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if let Some(rx_info) = &t.device_gateway_rx_info {
|
if let Some(rx_info) = &t.device_gateway_rx_info {
|
||||||
let _ = device_gateway::save_rx_info(rx_info).await.unwrap();
|
device_gateway::save_rx_info(rx_info).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
for qi in &t.device_queue_items {
|
for qi in &t.device_queue_items {
|
||||||
|
@ -38,7 +38,7 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -47,7 +47,7 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -55,7 +55,7 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_4,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -68,8 +68,8 @@ async fn test_downlink_scheduler() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::C,
|
enabled_class: DeviceClass::C,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
|
||||||
@ -115,7 +115,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -142,7 +142,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -150,7 +150,7 @@ async fn test_downlink_scheduler() {
|
|||||||
device_session: Some(ds.clone()),
|
device_session: Some(ds.clone()),
|
||||||
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
|
assert::n_f_cnt_down(dev.dev_eui, 5),
|
||||||
assert::downlink_frame(gw::DownlinkFrame {
|
assert::downlink_frame(gw::DownlinkFrame {
|
||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
items: vec![gw::DownlinkFrameItem {
|
items: vec![gw::DownlinkFrameItem {
|
||||||
@ -189,7 +189,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -216,7 +216,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![1, 2, 3],
|
data: vec![1, 2, 3],
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
@ -225,7 +225,7 @@ async fn test_downlink_scheduler() {
|
|||||||
device_session: Some(ds.clone()),
|
device_session: Some(ds.clone()),
|
||||||
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
device_gateway_rx_info: Some(device_gateway_rx_info.clone()),
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::n_f_cnt_down(dev.dev_eui.clone(), 5),
|
assert::n_f_cnt_down(dev.dev_eui, 5),
|
||||||
assert::downlink_frame(gw::DownlinkFrame {
|
assert::downlink_frame(gw::DownlinkFrame {
|
||||||
gateway_id: "0102030405060708".into(),
|
gateway_id: "0102030405060708".into(),
|
||||||
items: vec![gw::DownlinkFrameItem {
|
items: vec![gw::DownlinkFrameItem {
|
||||||
@ -277,7 +277,7 @@ async fn test_downlink_scheduler() {
|
|||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
device_queue_items: vec![device_queue::DeviceQueueItem {
|
device_queue_items: vec![device_queue::DeviceQueueItem {
|
||||||
id: Uuid::nil(),
|
id: Uuid::nil(),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
f_port: 10,
|
f_port: 10,
|
||||||
data: vec![0; 300],
|
data: vec![0; 300],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -295,7 +295,7 @@ async fn run_scheduler_test(t: &DownlinkTest) {
|
|||||||
reset_redis().await.unwrap();
|
reset_redis().await.unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
@ -311,7 +311,7 @@ async fn run_scheduler_test(t: &DownlinkTest) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
if let Some(rx_info) = &t.device_gateway_rx_info {
|
if let Some(rx_info) = &t.device_gateway_rx_info {
|
||||||
let _ = device_gateway::save_rx_info(rx_info).await.unwrap();
|
device_gateway::save_rx_info(rx_info).await.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
for qi in &t.device_queue_items {
|
for qi in &t.device_queue_items {
|
||||||
|
@ -91,5 +91,5 @@ pub async fn prepare<'a>() -> std::sync::MutexGuard<'a, ()> {
|
|||||||
// setup adr
|
// setup adr
|
||||||
adr::setup().await.unwrap();
|
adr::setup().await.unwrap();
|
||||||
|
|
||||||
return guard;
|
guard
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ async fn test_multicast() {
|
|||||||
// device-profile
|
// device-profile
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "test-dp".into(),
|
name: "test-dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -232,7 +232,7 @@ async fn run_scheduler_test(t: &MulticastTest) {
|
|||||||
println!("> {}", t.name);
|
println!("> {}", t.name);
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
// overwrite multicast-group to deal with frame-counter increments
|
// overwrite multicast-group to deal with frame-counter increments
|
||||||
multicast::update(t.multicast_group.clone()).await.unwrap();
|
multicast::update(t.multicast_group.clone()).await.unwrap();
|
||||||
|
@ -33,7 +33,7 @@ async fn test_js() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gw".into(),
|
name: "gw".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -42,7 +42,7 @@ async fn test_js() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_3,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_3,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -54,7 +54,7 @@ async fn test_js() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -62,8 +62,8 @@ async fn test_js() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "dev".into(),
|
name: "dev".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -74,7 +74,7 @@ async fn test_js() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut rx_info = gw::UplinkRxInfo {
|
let mut rx_info = gw::UplinkRxInfo {
|
||||||
gateway_id: gw.gateway_id.to_string(),
|
gateway_id: gw.gateway_id.to_string(),
|
||||||
@ -95,7 +95,7 @@ async fn test_js() {
|
|||||||
},
|
},
|
||||||
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
||||||
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
dev_nonce: 1,
|
dev_nonce: 1,
|
||||||
}),
|
}),
|
||||||
mic: Some([1, 2, 3, 4]),
|
mic: Some([1, 2, 3, 4]),
|
||||||
@ -153,7 +153,7 @@ async fn test_js() {
|
|||||||
},
|
},
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan103.into(),
|
mac_version: common::MacVersion::Lorawan103.into(),
|
||||||
@ -220,7 +220,7 @@ async fn test_js() {
|
|||||||
},
|
},
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan103.into(),
|
mac_version: common::MacVersion::Lorawan103.into(),
|
||||||
@ -290,7 +290,7 @@ async fn test_js() {
|
|||||||
},
|
},
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan103.into(),
|
mac_version: common::MacVersion::Lorawan103.into(),
|
||||||
@ -365,7 +365,7 @@ async fn run_test(t: &Test) {
|
|||||||
joinserver::setup().await.unwrap();
|
joinserver::setup().await.unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
|
@ -154,7 +154,7 @@ async fn test_fns() {
|
|||||||
dev_eui: vec![8, 7, 6, 5, 4, 3, 2, 1],
|
dev_eui: vec![8, 7, 6, 5, 4, 3, 2, 1],
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
@ -189,7 +189,7 @@ async fn test_fns() {
|
|||||||
.status(200);
|
.status(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
|
|
||||||
// Simulate uplink
|
// Simulate uplink
|
||||||
@ -281,7 +281,7 @@ async fn test_sns() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -289,7 +289,7 @@ async fn test_sns() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -302,8 +302,8 @@ async fn test_sns() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -312,7 +312,7 @@ async fn test_sns() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let dk = device_keys::create(device_keys::DeviceKeys {
|
let dk = device_keys::create(device_keys::DeviceKeys {
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
||||||
dev_nonces: vec![],
|
dev_nonces: vec![],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -368,7 +368,7 @@ async fn test_sns() {
|
|||||||
dev_eui: dev.dev_eui.to_vec(),
|
dev_eui: dev.dev_eui.to_vec(),
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
@ -467,7 +467,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -475,7 +475,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -487,8 +487,8 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -497,7 +497,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let dk = device_keys::create(device_keys::DeviceKeys {
|
let dk = device_keys::create(device_keys::DeviceKeys {
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
||||||
dev_nonces: vec![],
|
dev_nonces: vec![],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -553,7 +553,7 @@ async fn test_sns_roaming_not_allowed() {
|
|||||||
dev_eui: dev.dev_eui.to_vec(),
|
dev_eui: dev.dev_eui.to_vec(),
|
||||||
ul_freq: Some(868.1),
|
ul_freq: Some(868.1),
|
||||||
data_rate: Some(0),
|
data_rate: Some(0),
|
||||||
recv_time: recv_time,
|
recv_time,
|
||||||
rf_region: "EU868".to_string(),
|
rf_region: "EU868".to_string(),
|
||||||
gw_cnt: Some(1),
|
gw_cnt: Some(1),
|
||||||
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
gw_info: roaming::rx_info_to_gw_info(&[rx_info.clone()]).unwrap(),
|
||||||
|
@ -51,7 +51,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let gw_a = gateway::create(gateway::Gateway {
|
let gw_a = gateway::create(gateway::Gateway {
|
||||||
name: "gateway-a".into(),
|
name: "gateway-a".into(),
|
||||||
tenant_id: t_a.id.clone(),
|
tenant_id: t_a.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -60,7 +60,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let gw_b = gateway::create(gateway::Gateway {
|
let gw_b = gateway::create(gateway::Gateway {
|
||||||
name: "gateway-b".into(),
|
name: "gateway-b".into(),
|
||||||
tenant_id: t_b.id.clone(),
|
tenant_id: t_b.id,
|
||||||
gateway_id: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -69,7 +69,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t_a.id.clone(),
|
tenant_id: t_a.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -77,7 +77,7 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t_a.id.clone(),
|
tenant_id: t_a.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -89,8 +89,8 @@ async fn test_gateway_filtering() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -99,7 +99,7 @@ async fn test_gateway_filtering() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let dk = device_keys::create(device_keys::DeviceKeys {
|
let dk = device_keys::create(device_keys::DeviceKeys {
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
||||||
dev_nonces: vec![Some(258)],
|
dev_nonces: vec![Some(258)],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -135,7 +135,7 @@ async fn test_gateway_filtering() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut jr_pl = lrwn::PhyPayload {
|
let mut jr_pl = lrwn::PhyPayload {
|
||||||
mhdr: lrwn::MHDR {
|
mhdr: lrwn::MHDR {
|
||||||
@ -144,7 +144,7 @@ async fn test_gateway_filtering() {
|
|||||||
},
|
},
|
||||||
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
||||||
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
dev_nonce: 258,
|
dev_nonce: 258,
|
||||||
}),
|
}),
|
||||||
mic: None,
|
mic: None,
|
||||||
@ -156,7 +156,7 @@ async fn test_gateway_filtering() {
|
|||||||
name: "private gateway of same tenant".into(),
|
name: "private gateway of same tenant".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
})
|
})
|
||||||
@ -167,7 +167,7 @@ async fn test_gateway_filtering() {
|
|||||||
phy_payload: jr_pl.clone(),
|
phy_payload: jr_pl.clone(),
|
||||||
extra_uplink_channels: vec![],
|
extra_uplink_channels: vec![],
|
||||||
assert: vec![assert::device_session(
|
assert: vec![assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -200,7 +200,7 @@ async fn test_gateway_filtering() {
|
|||||||
name: "private gateway other tenant".into(),
|
name: "private gateway other tenant".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
})
|
})
|
||||||
@ -210,7 +210,7 @@ async fn test_gateway_filtering() {
|
|||||||
tx_info: tx_info.clone(),
|
tx_info: tx_info.clone(),
|
||||||
phy_payload: jr_pl.clone(),
|
phy_payload: jr_pl.clone(),
|
||||||
extra_uplink_channels: vec![],
|
extra_uplink_channels: vec![],
|
||||||
assert: vec![assert::no_device_session(dev.dev_eui.clone())],
|
assert: vec![assert::no_device_session(dev.dev_eui)],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -241,7 +241,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -249,7 +249,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -261,8 +261,8 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -271,7 +271,7 @@ async fn test_lorawan_10() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let dk = device_keys::create(device_keys::DeviceKeys {
|
let dk = device_keys::create(device_keys::DeviceKeys {
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
||||||
dev_nonces: vec![Some(258)],
|
dev_nonces: vec![Some(258)],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -295,7 +295,7 @@ async fn test_lorawan_10() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut jr_pl = lrwn::PhyPayload {
|
let mut jr_pl = lrwn::PhyPayload {
|
||||||
mhdr: lrwn::MHDR {
|
mhdr: lrwn::MHDR {
|
||||||
@ -304,7 +304,7 @@ async fn test_lorawan_10() {
|
|||||||
},
|
},
|
||||||
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
||||||
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
dev_nonce: 258,
|
dev_nonce: 258,
|
||||||
}),
|
}),
|
||||||
mic: None,
|
mic: None,
|
||||||
@ -391,7 +391,7 @@ async fn test_lorawan_10() {
|
|||||||
name: "join-request accepted".into(),
|
name: "join-request accepted".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
})
|
})
|
||||||
@ -407,7 +407,7 @@ async fn test_lorawan_10() {
|
|||||||
EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
),
|
),
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -563,8 +563,8 @@ async fn test_lorawan_10() {
|
|||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
assert::enabled_class(dev.dev_eui.clone(), DeviceClass::A),
|
assert::enabled_class(dev.dev_eui, DeviceClass::A),
|
||||||
assert::device_queue_items(dev.dev_eui.clone(), vec![]),
|
assert::device_queue_items(dev.dev_eui, vec![]),
|
||||||
assert::uplink_meta_log(stream::UplinkMeta {
|
assert::uplink_meta_log(stream::UplinkMeta {
|
||||||
dev_eui: dev.dev_eui.to_string(),
|
dev_eui: dev.dev_eui.to_string(),
|
||||||
tx_info: Some(tx_info.clone()),
|
tx_info: Some(tx_info.clone()),
|
||||||
@ -579,7 +579,7 @@ async fn test_lorawan_10() {
|
|||||||
name: "join-request accepted + skip fcnt check".into(),
|
name: "join-request accepted + skip fcnt check".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
|
|
||||||
@ -589,7 +589,7 @@ async fn test_lorawan_10() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dev = device::get(&dev_eui).await.unwrap();
|
let mut dev = device::get(&dev_eui).await.unwrap();
|
||||||
dev.skip_fcnt_check = false;
|
dev.skip_fcnt_check = false;
|
||||||
@ -601,7 +601,7 @@ async fn test_lorawan_10() {
|
|||||||
phy_payload: jr_pl.clone(),
|
phy_payload: jr_pl.clone(),
|
||||||
extra_uplink_channels: vec![],
|
extra_uplink_channels: vec![],
|
||||||
assert: vec![assert::device_session(
|
assert: vec![assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -635,7 +635,7 @@ async fn test_lorawan_10() {
|
|||||||
name: "join-request accepted + cflist".into(),
|
name: "join-request accepted + cflist".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
})
|
})
|
||||||
@ -647,7 +647,7 @@ async fn test_lorawan_10() {
|
|||||||
extra_uplink_channels: vec![867100000, 867300000, 867500000, 867700000, 867900000],
|
extra_uplink_channels: vec![867100000, 867300000, 867500000, 867700000, 867900000],
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
@ -787,8 +787,8 @@ async fn test_lorawan_10() {
|
|||||||
name: "join-request accepted + class-b supported".into(),
|
name: "join-request accepted + class-b supported".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
|
|
||||||
@ -798,7 +798,7 @@ async fn test_lorawan_10() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.supports_class_b = false;
|
dp.supports_class_b = false;
|
||||||
@ -809,14 +809,14 @@ async fn test_lorawan_10() {
|
|||||||
tx_info: tx_info.clone(),
|
tx_info: tx_info.clone(),
|
||||||
phy_payload: jr_pl.clone(),
|
phy_payload: jr_pl.clone(),
|
||||||
extra_uplink_channels: Vec::new(),
|
extra_uplink_channels: Vec::new(),
|
||||||
assert: vec![assert::enabled_class(dev.dev_eui.clone(), DeviceClass::A)],
|
assert: vec![assert::enabled_class(dev.dev_eui, DeviceClass::A)],
|
||||||
},
|
},
|
||||||
Test {
|
Test {
|
||||||
name: "join-request accepted + class-c supported".into(),
|
name: "join-request accepted + class-c supported".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
|
|
||||||
@ -826,7 +826,7 @@ async fn test_lorawan_10() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.supports_class_c = false;
|
dp.supports_class_c = false;
|
||||||
@ -837,13 +837,13 @@ async fn test_lorawan_10() {
|
|||||||
tx_info: tx_info.clone(),
|
tx_info: tx_info.clone(),
|
||||||
phy_payload: jr_pl.clone(),
|
phy_payload: jr_pl.clone(),
|
||||||
extra_uplink_channels: Vec::new(),
|
extra_uplink_channels: Vec::new(),
|
||||||
assert: vec![assert::enabled_class(dev.dev_eui.clone(), DeviceClass::C)],
|
assert: vec![assert::enabled_class(dev.dev_eui, DeviceClass::C)],
|
||||||
},
|
},
|
||||||
Test {
|
Test {
|
||||||
name: "device disabled".into(),
|
name: "device disabled".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
|
|
||||||
@ -853,7 +853,7 @@ async fn test_lorawan_10() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dev = device::get(&dev_eui).await.unwrap();
|
let mut dev = device::get(&dev_eui).await.unwrap();
|
||||||
dev.is_disabled = false;
|
dev.is_disabled = false;
|
||||||
@ -887,7 +887,7 @@ async fn test_lorawan_11() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -896,7 +896,7 @@ async fn test_lorawan_11() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -904,7 +904,7 @@ async fn test_lorawan_11() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_1_0,
|
||||||
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
reg_params_revision: lrwn::region::Revision::RP002_1_0_3,
|
||||||
@ -916,8 +916,8 @@ async fn test_lorawan_11() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
dev_eui: EUI64::from_be_bytes([2, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
enabled_class: DeviceClass::B,
|
enabled_class: DeviceClass::B,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -926,7 +926,7 @@ async fn test_lorawan_11() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let dk = device_keys::create(device_keys::DeviceKeys {
|
let dk = device_keys::create(device_keys::DeviceKeys {
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]),
|
||||||
app_key: AES128Key::from_bytes([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]),
|
app_key: AES128Key::from_bytes([16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]),
|
||||||
dev_nonces: vec![Some(258)],
|
dev_nonces: vec![Some(258)],
|
||||||
@ -951,7 +951,7 @@ async fn test_lorawan_11() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut jr_pl = lrwn::PhyPayload {
|
let mut jr_pl = lrwn::PhyPayload {
|
||||||
mhdr: lrwn::MHDR {
|
mhdr: lrwn::MHDR {
|
||||||
@ -960,7 +960,7 @@ async fn test_lorawan_11() {
|
|||||||
},
|
},
|
||||||
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
||||||
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
dev_nonce: 258,
|
dev_nonce: 258,
|
||||||
}),
|
}),
|
||||||
mic: None,
|
mic: None,
|
||||||
@ -1014,7 +1014,7 @@ async fn test_lorawan_11() {
|
|||||||
name: "join-request accepted".into(),
|
name: "join-request accepted".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
})
|
})
|
||||||
@ -1026,7 +1026,7 @@ async fn test_lorawan_11() {
|
|||||||
extra_uplink_channels: vec![],
|
extra_uplink_channels: vec![],
|
||||||
assert: vec![
|
assert: vec![
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan110.into(),
|
mac_version: common::MacVersion::Lorawan110.into(),
|
||||||
@ -1185,16 +1185,16 @@ async fn test_lorawan_11() {
|
|||||||
}),
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}),
|
}),
|
||||||
assert::enabled_class(dev.dev_eui.clone(), DeviceClass::A),
|
assert::enabled_class(dev.dev_eui, DeviceClass::A),
|
||||||
assert::device_queue_items(dev.dev_eui.clone(), vec![]),
|
assert::device_queue_items(dev.dev_eui, vec![]),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
Test {
|
Test {
|
||||||
name: "join-request accepted + class-c supported".into(),
|
name: "join-request accepted + class-c supported".into(),
|
||||||
dev_eui: dev.dev_eui,
|
dev_eui: dev.dev_eui,
|
||||||
before_func: Some(Box::new(move || {
|
before_func: Some(Box::new(move || {
|
||||||
let dev_eui = dev.dev_eui.clone();
|
let dev_eui = dev.dev_eui;
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
device_keys::test::reset_nonces(&dev_eui).await.unwrap();
|
||||||
|
|
||||||
@ -1204,7 +1204,7 @@ async fn test_lorawan_11() {
|
|||||||
})
|
})
|
||||||
})),
|
})),
|
||||||
after_func: Some(Box::new(move || {
|
after_func: Some(Box::new(move || {
|
||||||
let dp_id = dp.id.clone();
|
let dp_id = dp.id;
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
let mut dp = device_profile::get(&dp_id).await.unwrap();
|
||||||
dp.supports_class_c = false;
|
dp.supports_class_c = false;
|
||||||
@ -1215,7 +1215,7 @@ async fn test_lorawan_11() {
|
|||||||
tx_info: tx_info.clone(),
|
tx_info: tx_info.clone(),
|
||||||
phy_payload: jr_pl.clone(),
|
phy_payload: jr_pl.clone(),
|
||||||
extra_uplink_channels: Vec::new(),
|
extra_uplink_channels: Vec::new(),
|
||||||
assert: vec![assert::enabled_class(dev.dev_eui.clone(), DeviceClass::A)],
|
assert: vec![assert::enabled_class(dev.dev_eui, DeviceClass::A)],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -1242,7 +1242,7 @@ async fn run_test(t: &Test) {
|
|||||||
region::setup().unwrap();
|
region::setup().unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
|
@ -121,7 +121,7 @@ async fn test_lorawan_10() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 5).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 5).unwrap();
|
||||||
|
|
||||||
let ds_relay = internal::DeviceSession {
|
let ds_relay = internal::DeviceSession {
|
||||||
mac_version: common::MacVersion::Lorawan104.into(),
|
mac_version: common::MacVersion::Lorawan104.into(),
|
||||||
@ -769,7 +769,7 @@ async fn run_test(t: &Test) {
|
|||||||
reset_redis().await.unwrap();
|
reset_redis().await.unwrap();
|
||||||
|
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
|
@ -16,7 +16,7 @@ use lrwn::{AES128Key, DevAddr, EUI64};
|
|||||||
async fn test_lorawan_10() {
|
async fn test_lorawan_10() {
|
||||||
let _guard = test::prepare().await;
|
let _guard = test::prepare().await;
|
||||||
integration::set_mock().await;
|
integration::set_mock().await;
|
||||||
gateway_backend::set_backend(&"eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
gateway_backend::set_backend("eu868", Box::new(gateway_backend::mock::Backend {})).await;
|
||||||
|
|
||||||
integration::mock::reset().await;
|
integration::mock::reset().await;
|
||||||
gateway_backend::mock::reset().await;
|
gateway_backend::mock::reset().await;
|
||||||
@ -31,7 +31,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let gw = gateway::create(gateway::Gateway {
|
let gw = gateway::create(gateway::Gateway {
|
||||||
name: "gateway".into(),
|
name: "gateway".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
gateway_id: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -40,7 +40,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let app = application::create(application::Application {
|
let app = application::create(application::Application {
|
||||||
name: "app".into(),
|
name: "app".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
@ -48,7 +48,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let dp = device_profile::create(device_profile::DeviceProfile {
|
let dp = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -60,7 +60,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let dp_relay = device_profile::create(device_profile::DeviceProfile {
|
let dp_relay = device_profile::create(device_profile::DeviceProfile {
|
||||||
name: "dp".into(),
|
name: "dp".into(),
|
||||||
tenant_id: t.id.clone(),
|
tenant_id: t.id,
|
||||||
region: lrwn::region::CommonName::EU868,
|
region: lrwn::region::CommonName::EU868,
|
||||||
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
mac_version: lrwn::region::MacVersion::LORAWAN_1_0_2,
|
||||||
reg_params_revision: lrwn::region::Revision::A,
|
reg_params_revision: lrwn::region::Revision::A,
|
||||||
@ -73,8 +73,8 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let dev = device::create(device::Device {
|
let dev = device::create(device::Device {
|
||||||
name: "device".into(),
|
name: "device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp.id.clone(),
|
device_profile_id: dp.id,
|
||||||
dev_eui: EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 1]),
|
dev_eui: EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 1]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
@ -83,7 +83,7 @@ async fn test_lorawan_10() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let dk_dev = device_keys::create(device_keys::DeviceKeys {
|
let dk_dev = device_keys::create(device_keys::DeviceKeys {
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]),
|
nwk_key: AES128Key::from_bytes([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
@ -92,8 +92,8 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let dev_relay = device::create(device::Device {
|
let dev_relay = device::create(device::Device {
|
||||||
name: "relay-device".into(),
|
name: "relay-device".into(),
|
||||||
application_id: app.id.clone(),
|
application_id: app.id,
|
||||||
device_profile_id: dp_relay.id.clone(),
|
device_profile_id: dp_relay.id,
|
||||||
dev_eui: EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 2]),
|
dev_eui: EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 2]),
|
||||||
enabled_class: DeviceClass::A,
|
enabled_class: DeviceClass::A,
|
||||||
dev_addr: Some(DevAddr::from_be_bytes([4, 3, 2, 1])),
|
dev_addr: Some(DevAddr::from_be_bytes([4, 3, 2, 1])),
|
||||||
@ -133,7 +133,7 @@ async fn test_lorawan_10() {
|
|||||||
frequency: 868100000,
|
frequency: 868100000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
uplink::helpers::set_uplink_modulation(&"eu868", &mut tx_info, 0).unwrap();
|
uplink::helpers::set_uplink_modulation("eu868", &mut tx_info, 0).unwrap();
|
||||||
|
|
||||||
let mut jr_pl = lrwn::PhyPayload {
|
let mut jr_pl = lrwn::PhyPayload {
|
||||||
mhdr: lrwn::MHDR {
|
mhdr: lrwn::MHDR {
|
||||||
@ -142,7 +142,7 @@ async fn test_lorawan_10() {
|
|||||||
},
|
},
|
||||||
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
payload: lrwn::Payload::JoinRequest(lrwn::JoinRequestPayload {
|
||||||
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
join_eui: EUI64::from_be_bytes([1, 2, 3, 4, 5, 6, 7, 8]),
|
||||||
dev_eui: dev.dev_eui.clone(),
|
dev_eui: dev.dev_eui,
|
||||||
dev_nonce: 1,
|
dev_nonce: 1,
|
||||||
}),
|
}),
|
||||||
mic: None,
|
mic: None,
|
||||||
@ -265,7 +265,7 @@ async fn test_lorawan_10() {
|
|||||||
|
|
||||||
let assertions = vec![
|
let assertions = vec![
|
||||||
assert::device_session(
|
assert::device_session(
|
||||||
dev.dev_eui.clone(),
|
dev.dev_eui,
|
||||||
internal::DeviceSession {
|
internal::DeviceSession {
|
||||||
dev_addr: vec![1, 2, 3, 4],
|
dev_addr: vec![1, 2, 3, 4],
|
||||||
mac_version: common::MacVersion::Lorawan102.into(),
|
mac_version: common::MacVersion::Lorawan102.into(),
|
||||||
|
@ -1029,11 +1029,9 @@ impl Data {
|
|||||||
match v {
|
match v {
|
||||||
pbjson_types::value::Kind::NumberValue(v) => {
|
pbjson_types::value::Kind::NumberValue(v) => {
|
||||||
let record = metrics::Record {
|
let record = metrics::Record {
|
||||||
time: DateTime::<Utc>::try_from(
|
time: DateTime::<Utc>::try_from(*up_event.time.as_ref().unwrap())
|
||||||
up_event.time.as_ref().unwrap().clone(),
|
.map_err(anyhow::Error::msg)?
|
||||||
)
|
.with_timezone(&Local),
|
||||||
.map_err(anyhow::Error::msg)?
|
|
||||||
.with_timezone(&Local),
|
|
||||||
kind: match dp_m.kind {
|
kind: match dp_m.kind {
|
||||||
fields::MeasurementKind::COUNTER => metrics::Kind::COUNTER,
|
fields::MeasurementKind::COUNTER => metrics::Kind::COUNTER,
|
||||||
fields::MeasurementKind::ABSOLUTE => metrics::Kind::ABSOLUTE,
|
fields::MeasurementKind::ABSOLUTE => metrics::Kind::ABSOLUTE,
|
||||||
|
@ -69,7 +69,7 @@ pub fn get_rx_timestamp(rx_info: &[gw::UplinkRxInfo]) -> SystemTime {
|
|||||||
// Then search for time.
|
// Then search for time.
|
||||||
for rxi in rx_info {
|
for rxi in rx_info {
|
||||||
if let Some(ts) = &rxi.gw_time {
|
if let Some(ts) = &rxi.gw_time {
|
||||||
let ts: Result<DateTime<Utc>> = ts.clone().try_into().map_err(anyhow::Error::msg);
|
let ts: Result<DateTime<Utc>> = (*ts).try_into().map_err(anyhow::Error::msg);
|
||||||
if let Ok(ts) = ts {
|
if let Ok(ts) = ts {
|
||||||
return ts.into();
|
return ts.into();
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ pub fn get_rx_timestamp_chrono(rx_info: &[gw::UplinkRxInfo]) -> DateTime<Utc> {
|
|||||||
// Then search for time.
|
// Then search for time.
|
||||||
for rxi in rx_info {
|
for rxi in rx_info {
|
||||||
if let Some(ts) = &rxi.gw_time {
|
if let Some(ts) = &rxi.gw_time {
|
||||||
let ts: Result<DateTime<Utc>> = ts.clone().try_into().map_err(anyhow::Error::msg);
|
let ts: Result<DateTime<Utc>> = (*ts).try_into().map_err(anyhow::Error::msg);
|
||||||
if let Ok(ts) = ts {
|
if let Ok(ts) = ts {
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
@ -140,9 +140,7 @@ pub fn get_start_location(rx_info: &[gw::UplinkRxInfo]) -> Option<common::Locati
|
|||||||
.cloned()
|
.cloned()
|
||||||
.collect();
|
.collect();
|
||||||
with_loc.sort_by(|a, b| a.snr.partial_cmp(&b.snr).unwrap());
|
with_loc.sort_by(|a, b| a.snr.partial_cmp(&b.snr).unwrap());
|
||||||
with_loc
|
with_loc.first().map(|i| *i.location.as_ref().unwrap())
|
||||||
.first()
|
|
||||||
.map(|i| i.location.as_ref().unwrap().clone())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -75,8 +75,7 @@ impl MeshHeartbeat {
|
|||||||
let border_gw = gateway::get(&self.gateway_id).await?;
|
let border_gw = gateway::get(&self.gateway_id).await?;
|
||||||
|
|
||||||
let ts: DateTime<Utc> = match &self.mesh_stats.time {
|
let ts: DateTime<Utc> = match &self.mesh_stats.time {
|
||||||
Some(v) => v
|
Some(v) => (*v)
|
||||||
.clone()
|
|
||||||
.try_into()
|
.try_into()
|
||||||
.map_err(|e| anyhow!("Convert time error: {}", e))?,
|
.map_err(|e| anyhow!("Convert time error: {}", e))?,
|
||||||
None => {
|
None => {
|
||||||
|
@ -102,9 +102,7 @@ impl Stats {
|
|||||||
|
|
||||||
let mut m = metrics::Record {
|
let mut m = metrics::Record {
|
||||||
time: match &self.stats.time {
|
time: match &self.stats.time {
|
||||||
Some(v) => DateTime::try_from(v.clone())
|
Some(v) => DateTime::try_from(*v).map_err(anyhow::Error::msg)?.into(),
|
||||||
.map_err(anyhow::Error::msg)?
|
|
||||||
.into(),
|
|
||||||
None => Local::now(),
|
None => Local::now(),
|
||||||
},
|
},
|
||||||
kind: metrics::Kind::ABSOLUTE,
|
kind: metrics::Kind::ABSOLUTE,
|
||||||
@ -179,15 +177,12 @@ impl Stats {
|
|||||||
|
|
||||||
let window: Duration = duty_cycle_stats
|
let window: Duration = duty_cycle_stats
|
||||||
.window
|
.window
|
||||||
.clone()
|
|
||||||
.map(|v| v.try_into().unwrap_or_default())
|
.map(|v| v.try_into().unwrap_or_default())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let mut m = metrics::Record {
|
let mut m = metrics::Record {
|
||||||
time: match &self.stats.time {
|
time: match &self.stats.time {
|
||||||
Some(v) => DateTime::try_from(v.clone())
|
Some(v) => DateTime::try_from(*v).map_err(anyhow::Error::msg)?.into(),
|
||||||
.map_err(anyhow::Error::msg)?
|
|
||||||
.into(),
|
|
||||||
None => Local::now(),
|
None => Local::now(),
|
||||||
},
|
},
|
||||||
kind: metrics::Kind::COUNTER,
|
kind: metrics::Kind::COUNTER,
|
||||||
@ -197,12 +192,10 @@ impl Stats {
|
|||||||
for b in &duty_cycle_stats.bands {
|
for b in &duty_cycle_stats.bands {
|
||||||
let load_max: Duration = b
|
let load_max: Duration = b
|
||||||
.load_max
|
.load_max
|
||||||
.clone()
|
|
||||||
.map(|d| d.try_into().unwrap_or_default())
|
.map(|d| d.try_into().unwrap_or_default())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let load_tracked: Duration = b
|
let load_tracked: Duration = b
|
||||||
.load_tracked
|
.load_tracked
|
||||||
.clone()
|
|
||||||
.map(|d| d.try_into().unwrap_or_default())
|
.map(|d| d.try_into().unwrap_or_default())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ mod tests {
|
|||||||
];
|
];
|
||||||
|
|
||||||
for tst in tests {
|
for tst in tests {
|
||||||
let mut devaddr = tst.devaddr.clone();
|
let mut devaddr = tst.devaddr;
|
||||||
devaddr.set_dev_addr_prefix(tst.netid.dev_addr_prefix());
|
devaddr.set_dev_addr_prefix(tst.netid.dev_addr_prefix());
|
||||||
assert_eq!(tst.expected_devaddr, devaddr);
|
assert_eq!(tst.expected_devaddr, devaddr);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_eui64_from_str() {
|
fn test_eui64_from_str() {
|
||||||
let eui = EUI64::from_be_bytes([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]);
|
let eui = EUI64::from_be_bytes([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]);
|
||||||
assert_eq!(eui, EUI64::from_str(&"0102030405060708").unwrap());
|
assert_eq!(eui, EUI64::from_str("0102030405060708").unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2649,7 +2649,7 @@ mod test {
|
|||||||
uplink: false,
|
uplink: false,
|
||||||
command: MACCommand::NewChannelReq(NewChannelReqPayload {
|
command: MACCommand::NewChannelReq(NewChannelReqPayload {
|
||||||
ch_index: 3,
|
ch_index: 3,
|
||||||
freq: 2410_000_000,
|
freq: 2_410_000_000,
|
||||||
max_dr: 5,
|
max_dr: 5,
|
||||||
min_dr: 0,
|
min_dr: 0,
|
||||||
}),
|
}),
|
||||||
|
@ -464,7 +464,7 @@ mod tests {
|
|||||||
// before it can be decoded
|
// before it can be decoded
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Payload::Raw(vec![0x01, 0x02, 0x03]),
|
Payload::Raw(vec![0x01, 0x02, 0x03]),
|
||||||
Payload::from_slice(MType::JoinAccept, &vec![0x01, 0x02, 0x03]).unwrap()
|
Payload::from_slice(MType::JoinAccept, &[0x01, 0x02, 0x03]).unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
// test decoding the (decrypted) join-accept payload
|
// test decoding the (decrypted) join-accept payload
|
||||||
|
@ -1000,8 +1000,7 @@ pub mod test {
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn config() -> Configuration {
|
fn config() -> Configuration {
|
||||||
let c = Configuration::new(CommonName::AS923, true, true);
|
Configuration::new(CommonName::AS923, true, true)
|
||||||
c
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1219,8 +1219,7 @@ pub mod test {
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn config_full() -> Configuration {
|
fn config_full() -> Configuration {
|
||||||
let c = Configuration::new(false, false);
|
Configuration::new(false, false)
|
||||||
c
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config_chan_8_15() -> Configuration {
|
fn config_chan_8_15() -> Configuration {
|
||||||
@ -1340,7 +1339,7 @@ pub mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_cf_list() {
|
fn test_cf_list() {
|
||||||
let c = config_chan_8_15();
|
let c = config_chan_8_15();
|
||||||
assert_eq!(true, c.get_cf_list(MacVersion::LORAWAN_1_0_2).is_none());
|
assert!(c.get_cf_list(MacVersion::LORAWAN_1_0_2).is_none());
|
||||||
|
|
||||||
let lw_11_cf_list = c.get_cf_list(MacVersion::LORAWAN_1_1_0).unwrap();
|
let lw_11_cf_list = c.get_cf_list(MacVersion::LORAWAN_1_1_0).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -588,8 +588,7 @@ mod tests {
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn config_full() -> Configuration {
|
fn config_full() -> Configuration {
|
||||||
let c = Configuration::new(false);
|
Configuration::new(false)
|
||||||
c
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -566,8 +566,7 @@ mod test {
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn config() -> Configuration {
|
fn config() -> Configuration {
|
||||||
let c = Configuration::new(false);
|
Configuration::new(false)
|
||||||
c
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -872,7 +872,7 @@ mod tests {
|
|||||||
ch_mask_cntl: 0,
|
ch_mask_cntl: 0,
|
||||||
nb_rep: 0,
|
nb_rep: 0,
|
||||||
},
|
},
|
||||||
ch_mask: ChMask::from_slice(&vec![true, true, true]).unwrap(),
|
ch_mask: ChMask::from_slice(&[true, true, true]).unwrap(),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
// Base channels are active
|
// Base channels are active
|
||||||
@ -905,7 +905,7 @@ mod tests {
|
|||||||
ch_mask_cntl: 0,
|
ch_mask_cntl: 0,
|
||||||
nb_rep: 0,
|
nb_rep: 0,
|
||||||
},
|
},
|
||||||
ch_mask: ChMask::from_slice(&vec![true, true, true]).unwrap(),
|
ch_mask: ChMask::from_slice(&[true, true, true]).unwrap(),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@ -934,7 +934,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn get_uplink_channel_index() {
|
fn get_uplink_channel_index() {
|
||||||
let c = config_with_user_channels();
|
let c = config_with_user_channels();
|
||||||
let tests = vec![
|
let tests = [
|
||||||
(false, 868100000),
|
(false, 868100000),
|
||||||
(false, 868300000),
|
(false, 868300000),
|
||||||
(false, 868500000),
|
(false, 868500000),
|
||||||
@ -953,7 +953,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn get_uplink_channel_index_for_freq_dr() {
|
fn get_uplink_channel_index_for_freq_dr() {
|
||||||
let c = config_with_user_channels();
|
let c = config_with_user_channels();
|
||||||
let tests = vec![
|
let tests = [
|
||||||
(3, 868100000),
|
(3, 868100000),
|
||||||
(3, 868300000),
|
(3, 868300000),
|
||||||
(3, 868500000),
|
(3, 868500000),
|
||||||
@ -978,8 +978,8 @@ mod tests {
|
|||||||
let c = config_with_user_channels();
|
let c = config_with_user_channels();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
CFList::Channels(
|
CFList::Channels(
|
||||||
CFListChannels::from_slice(&vec![
|
CFListChannels::from_slice(&[
|
||||||
867100000, 867300000, 867500000, 867700000, 867900000,
|
867100000, 867300000, 867500000, 867700000, 867900000
|
||||||
])
|
])
|
||||||
.unwrap()
|
.unwrap()
|
||||||
),
|
),
|
||||||
|
@ -907,8 +907,7 @@ pub mod test {
|
|||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
fn config_full() -> Configuration {
|
fn config_full() -> Configuration {
|
||||||
let c = Configuration::new(false);
|
Configuration::new(false)
|
||||||
c
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn config_chan_8_15() -> Configuration {
|
fn config_chan_8_15() -> Configuration {
|
||||||
@ -1030,7 +1029,7 @@ pub mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_cf_list() {
|
fn test_cf_list() {
|
||||||
let c = config_chan_8_15();
|
let c = config_chan_8_15();
|
||||||
assert_eq!(true, c.get_cf_list(MacVersion::LORAWAN_1_0_2).is_none());
|
assert!(c.get_cf_list(MacVersion::LORAWAN_1_0_2).is_none());
|
||||||
|
|
||||||
let lw_11_cf_list = c.get_cf_list(MacVersion::LORAWAN_1_1_0).unwrap();
|
let lw_11_cf_list = c.get_cf_list(MacVersion::LORAWAN_1_1_0).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user