Exemplo n.º 1
0
    def test_missing_attributes_static_route(self):
        f = StaticRouting(device=self.device)
        f.maker.outputs[ShowVrfDetail] = {'': StaticRouteOutput.ShowVrfDetail}

        # Get 'show ip static route' output
        self.device.execute = Mock()
        self.device.execute.side_effect = mapper
        # Learn the feature
        f.learn()

        with self.assertRaises(KeyError):
            interfaces = f.info['vrf']['VRF1']['address_family']['ipv4']['routes']\
                ['10.36.3.3/32']['next_hop']['interface']
Exemplo n.º 2
0
    def test_selective_attribute_static_route(self):
        f = StaticRouting(device=self.device)
        f.maker.outputs[ShowVrfDetail] = {'': StaticRouteOutput.ShowVrfDetail}

        # Get 'show ip static route' output
        self.device.execute = Mock()
        self.device.execute.side_effect = mapper
        # Learn the feature
        f.learn()
        # Check match

        self.assertEqual('GigabitEthernet0/2', f.info['vrf']['VRF1']['address_family']['ipv4']['routes']\
            ['10.36.3.3/32']['next_hop']['outgoing_interface']['GigabitEthernet0/2']['outgoing_interface'])
        # Check does not match
        self.assertNotEqual('GigabitEthernet0/0', f.info['vrf']['VRF1']['address_family']['ipv4']['routes']\
            ['10.36.3.3/32']['next_hop']['outgoing_interface']['GigabitEthernet0/2']['outgoing_interface'])