def test_missing_attributes(self): self.maxDiff = None msdp = Msdp(device=self.device) # Set outputs msdp.maker.outputs[ShowIpMsdpPeer] = {'': MsdpOutput.ShowIpMsdpPeer} msdp.maker.outputs[ShowIpMsdpSaCache] = {'': {}} # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature msdp.learn() with self.assertRaises(KeyError): msdp.info['vrf']['default']['sa_cache']
def test_empty_output(self): self.maxDiff = None msdp = Msdp(device=self.device) # Set outputs msdp.maker.outputs[ShowIpMsdpPeer] = {'': {}} msdp.maker.outputs[ShowIpMsdpSaCache] = {'': {}} # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature msdp.learn() with self.assertRaises(AttributeError): msdp.info['vrf']
def test_selective_attribute(self): self.maxDiff = None msdp = Msdp(device=self.device) # Set outputs msdp.maker.outputs[ShowIpMsdpPeer] = {'': MsdpOutput.ShowIpMsdpPeer} msdp.maker.outputs[ShowIpMsdpSaCache] = { '': MsdpOutput.ShowIpMsdpSaCache } # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature msdp.learn() self.assertEqual('Loopback0', msdp.info['vrf']['default']\ ['peer']['10.1.100.4']['connect_source'])
def test_complete_output(self): self.maxDiff = None msdp = Msdp(device=self.device) # Set outputs msdp.maker.outputs[ShowIpMsdpPeer] = {'': MsdpOutput.ShowIpMsdpPeer} msdp.maker.outputs[ShowIpMsdpSaCache] = { '': MsdpOutput.ShowIpMsdpSaCache } # Return outputs above as inputs to parser when called self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature msdp.learn() # Verify Ops was created successfully self.assertEqual(msdp.info, MsdpOutput.MsdpInfo)