Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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')
Exemplo n.º 3
0
 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)