1use serde::{Deserialize, Serialize};
2use utoipa::ToSchema;
3
4#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
5pub struct OntAutofindEntry {
6 pub number: u32,
8 pub fsp: Fsp,
10 pub serial_number: String,
12 pub serial_number_readable: String,
14 pub password: String,
16 pub lo_id: String,
18 pub check_code: String,
19 pub vendor_id: String,
20 pub version: String,
21 pub software_version: String,
22 pub equipment_id: String,
23 pub customized_info: String,
24 pub auto_find_time: String,
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
28pub struct OntInfo {
29 pub fsp: Fsp,
31 pub id: u32,
32 pub control_flag: String,
33 pub run_state: String,
34 pub config_state: String,
35 pub match_state: String,
36 pub dba_type: String,
37 pub distance: u32,
39 pub last_distance: u32,
41 pub memory_occupation: String,
43 pub cpu_occupation: String,
45 pub temperature: i32,
47 pub authentic_type: String,
48 pub sn: String,
50 pub sn_readable: String,
52 pub management_mode: String,
53 pub description: String,
54 pub last_down_cause: String,
55 pub last_up_time: String,
56 pub last_down_time: String,
57 pub online_duration: String,
58 pub line_profile_id: u32,
59 pub line_profile_name: String,
60 pub service_profile_id: u32,
61 pub service_profile_name: String,
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
65pub struct OpticalInfo {
66 pub onu_nni_port_id: String,
67 pub module_type: String,
68 pub module_sub_type: String,
69 pub used_type: String,
70 pub encapsulation_type: String,
71 pub optical_power_precision: String,
72 pub vendor_name: String,
73 pub vendor_rev: String,
74 pub vendor_pn: String,
75 pub vendor_sn: String,
76 pub date_code: String,
77 pub rx_optical_power: String,
78 pub rx_power_current_warning_threshold: String,
79 pub rx_power_current_alarm_threshold: String,
80 pub tx_optical_power: String,
81 pub tx_power_current_warning_threshold: String,
82 pub tx_power_current_alarm_threshold: String,
83 pub laser_bias_current: String,
84 pub tx_bias_current_warning_threshold: String,
85 pub tx_bias_current_alarm_threshold: String,
86 pub temperature: String,
87 pub temperature_warning_threshold: String,
88 pub temperature_alarm_threshold: String,
89 pub voltage: String,
90 pub supply_voltage_warning_threshold: String,
91 pub supply_voltage_alarm_threshold: String,
92 pub olt_rx_ont_optical_power: String,
93 pub catv_rx_optical_power: String,
94 pub catv_rx_power_alarm_threshold: String,
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
98pub struct ServicePort {
99 pub index: u32,
100 pub vlan: u32,
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, PartialEq, Eq)]
104pub struct BoardSlot {
105 pub frame: u32,
106 pub slot_id: u32,
107 pub board_name: Option<String>,
108 pub status: Option<String>,
109 pub subtype0: Option<String>,
110 pub subtype1: Option<String>,
111 pub online_status: Option<String>,
112}
113
114#[derive(Debug, Clone, Copy, Serialize, Deserialize, ToSchema, PartialEq, Eq, Default)]
116pub struct Fsp {
117 pub frame: u32,
118 pub slot: u32,
119 pub port: u32,
120}
121
122impl Fsp {
123 #[must_use]
124 pub fn parse(fsp: &str) -> Option<Self> {
125 let parts: Vec<&str> = fsp.split('/').collect();
126 if parts.len() != 3 {
127 return None;
128 }
129
130 Some(Self {
131 frame: parts[0].parse().ok()?,
132 slot: parts[1].parse().ok()?,
133 port: parts[2].parse().ok()?,
134 })
135 }
136}
137
138impl std::fmt::Display for Fsp {
139 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
140 write!(f, "{}/{}/{}", self.frame, self.slot, self.port)
141 }
142}