MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_device_session

Function test_device_session

chirpstack/src/storage/device.rs:1486–1871  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1484
1485 #[tokio::test]
1486 async fn test_device_session() {
1487 let _guard = test::prepare().await;
1488
1489 let t = storage::tenant::create(storage::tenant::Tenant {
1490 name: "test-tenant".into(),
1491 ..Default::default()
1492 })
1493 .await
1494 .unwrap();
1495
1496 let dp = storage::device_profile::create(storage::device_profile::DeviceProfile {
1497 name: "test-dp".into(),
1498 tenant_id: Some(t.id),
1499 ..Default::default()
1500 })
1501 .await
1502 .unwrap();
1503
1504 let app = storage::application::create(storage::application::Application {
1505 name: "test-app".into(),
1506 tenant_id: t.id,
1507 ..Default::default()
1508 })
1509 .await
1510 .unwrap();
1511
1512 let mut devices = vec![
1513 Device {
1514 application_id: app.id,
1515 device_profile_id: dp.id,
1516 name: "0101010101010101".into(),
1517 dev_eui: EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 1]),
1518 dev_addr: Some(DevAddr::from_be_bytes([1, 2, 3, 4])),
1519 f_cnt_up: 100,
1520 device_session: Some(
1521 internal::DeviceSession {
1522 region_config_id: "eu868".into(),
1523 dev_addr: vec![0x01, 0x02, 0x03, 0x04],
1524 s_nwk_s_int_key: vec![
1525 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
1526 0x01, 0x01, 0x01, 0x01,
1527 ],
1528 f_nwk_s_int_key: vec![
1529 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
1530 0x01, 0x01, 0x01, 0x01,
1531 ],
1532 nwk_s_enc_key: vec![
1533 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
1534 0x01, 0x01, 0x01, 0x01,
1535 ],
1536 skip_f_cnt_check: true,
1537 ..Default::default()
1538 }
1539 .into(),
1540 ),
1541 ..Default::default()
1542 },
1543 Device {

Callers

nothing calls this directly

Calls 7

prepareFunction · 0.85
MACPayloadClass · 0.85
unwrapMethod · 0.80
set_uplink_data_micMethod · 0.80
createFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected