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