use crate::utils::*;
use crate::tc;
use crate::tc::*;
#[test]
fn tc_qdisc_add_priomap() {
#[cfg_attr(any(), rustfmt::skip)]
let payload = &[
0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, 0x00, 0x70, 0x72, 0x69, 0x6f, 0x00, 0x00, 0x00, 0x00,
0x1c, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x00, 0x02, 0x00,
];
dump_hex(payload);
let (header, attrs) = OpNewqdiscDoRequest::new(payload);
assert_eq!(header.family(), 0);
assert_eq!(header.ifindex(), 44);
assert_eq!(header.handle(), 65536);
assert_eq!(header.parent(), 4294967295);
assert_eq!(header.info(), 0);
assert_eq!(attrs.get_kind(), Ok(c"prio"));
let OptionsMsg::Prio(prio) = attrs.get_options().unwrap() else {
unreachable!()
};
assert_eq!(prio.bands(), 8);
assert_eq!(
prio.priomap(),
[7, 6, 5, 4, 3, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1,]
);
}