Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 1 | #include "translation.h" |
| 2 | |
| 3 | int interface_key_to_port_no(bcmbal_interface_key key) { |
| 4 | if (key.intf_type == BCMBAL_INTF_TYPE_NNI) { |
Nicolas Palpacuer | 4198356 | 2018-09-10 13:54:35 -0400 | [diff] [blame] | 5 | return (0x1 << 16) + key.intf_id; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 6 | } |
| 7 | if (key.intf_type == BCMBAL_INTF_TYPE_PON) { |
Nicolas Palpacuer | 6a63ea9 | 2018-09-05 17:21:37 -0400 | [diff] [blame] | 8 | return (0x2 << 28) + key.intf_id; |
Nicolas Palpacuer | a32f4c3 | 2018-06-28 12:55:10 -0400 | [diff] [blame] | 9 | } |
| 10 | return key.intf_id; |
| 11 | } |
| 12 | |
| 13 | std::string alarm_status_to_string(bcmbal_alarm_status status) { |
| 14 | switch (status) { |
| 15 | case BCMBAL_ALARM_STATUS_OFF: |
| 16 | return "off"; |
| 17 | case BCMBAL_ALARM_STATUS_ON: |
| 18 | return "on"; |
| 19 | case BCMBAL_ALARM_STATUS_NO__CHANGE: |
| 20 | return "no_change"; |
| 21 | } |
| 22 | return "unknown"; |
| 23 | } |