def get_interface_name(self, device, ipaddress): """Method to return the ip address corresponding interface name Args: device (`Device`): Genie device object ipaddress (`str`): connection ip address Returns: `str`: a `str` of the interface name Examples: >>> managment_interface_instance.\ get_interface_name(device, ipaddress) """ # Create parser object parser_obj = ShowIpInterfaceBriefPipeIp(device=device) intf_name = super().get_interface_name(ipaddress, parser_obj) return intf_name
def test_empty(self): self.device1 = Mock(**self.empty_output) obj = ShowIpInterfaceBriefPipeIp(device=self.device1) with self.assertRaises(SchemaEmptyParserError): parsed_output = obj.parse(ip='10.1.18.80')
def test_golden(self): self.device = Mock(**self.golden_output) obj = ShowIpInterfaceBriefPipeIp(device=self.device) parsed_output = obj.parse(ip='10.1.18.80') self.assertEqual(parsed_output, self.golden_parsed_output)