| Conditions | 8 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 2 |
| CRAP Score | 35 |
| Changes | 0 | ||
| 1 | """ This class helps to handle multi-home physical loops (two ports). """ |
||
| 17 | 1 | @property |
|
| 18 | 1 | def destination(self) -> Optional[Interface]: |
|
| 19 | """Destination interface of the loop.""" |
||
| 20 | if ( |
||
| 21 | self.source.status != EntityStatus.UP |
||
| 22 | or "looped" not in self.source.metadata |
||
| 23 | or "port_numbers" not in self.source.metadata["looped"] |
||
| 24 | or not self.source.metadata["looped"]["port_numbers"] |
||
| 25 | or len(self.source.metadata["looped"]["port_numbers"]) < 2 |
||
| 26 | ): |
||
| 27 | return None |
||
| 28 | |||
| 29 | destination = self.source.switch.get_interface_by_port_no( |
||
| 30 | self.source.metadata["looped"]["port_numbers"][1] |
||
| 31 | ) |
||
| 32 | if not destination or destination.status != EntityStatus.UP: |
||
| 33 | return None |
||
| 34 | return destination |
||
| 35 | |||
| 39 |