def test_complete_output(self): vrf = Vrf(device=self.device) # Set outputs vrf.maker.outputs[ShowVrfDetail] = {'': VrfOutput.ShowVrfDetail} # Learn the feature vrf.learn() # Verify Ops was created successfully self.assertEqual(vrf.info, VrfOutput.VrfInfo)
def test_custom_output(self): vrf = Vrf(device=self.device) vrf.maker.outputs[ShowVrfDetail] = {'': VrfOutput.ShowVrfDetailCustom} # Set outputs self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature vrf.learn(vrf='default') self.maxDiff = None # Verify Ops was created successfully self.assertDictEqual(vrf.info, VrfOutput.VrfCustomInfo)
def test_selective_attribute(self): vrf = Vrf(device=self.device) # Set outputs vrf.maker.outputs[ShowVrfDetail] = {'': VrfOutput.ShowVrfDetail} # Learn the feature vrf.learn() # Test specific attributes in info self.assertEqual(vrf.info['vrfs']['VRF1']['address_family']['ipv6'], {})
def test_selective_attribute(self): vrf = Vrf(device=self.device) # Set outputs vrf.maker.outputs[ShowVrfDetail] = {'': VrfOutput.ShowVrfDetail} self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature vrf.learn() # Test specific attributes in info self.assertEqual(vrf.info['vrfs']['VRF1']['address_family']['ipv6'], {'table_id': '0x80000003'})
def test_empty_output(self): vrf = Vrf(device=self.device) # Set outputs vrf.maker.outputs[ShowVrfDetail] = {'': {}} # Learn the feature vrf.learn() # Check no outputs in vrf.info with self.assertRaises(AttributeError): neighbor_address = vrf.info['vrfs']['default'][ 'route_distinguisher']
def test_empty_output(self): vrf = Vrf(device=self.device) # Set outputs vrf.maker.outputs[ShowVrfDetail] = {'': {}} outputs['show vrf default detail'] = '' outputs['show vrf all detail'] = '' self.device.execute = Mock() self.device.execute.side_effect = mapper # Learn the feature vrf.learn() # revert back outputs['show vrf default detail'] = VrfOutput.showVrfDetail_default outputs['show vrf all detail'] = VrfOutput.showVrfDetail_all # Check no outputs in vrf.info with self.assertRaises(AttributeError): neighbor_address = vrf.info['vrfs']['default'][ 'route_distinguisher']