def test_incomplete_output(self): self.maxDiff = None mld = Mld(device=self.device) # Get outputs mld.maker.outputs[ShowIpv6MldInterface] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldInterface} mld.maker.outputs[ShowIpv6MldGroups] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldGroups} mld.maker.outputs[ShowIpv6MldLocalGroups] = \ {"{'vrf':'all'}": {}} # Learn the feature mld.learn() # Delete missing specific attribute values expect_dict = deepcopy(MldOutput.Mld_info) del (expect_dict['vrfs']['default']['interfaces']['Ethernet2/1'] ['join_group']) del (expect_dict['vrfs']['default']['interfaces']['Ethernet2/1'] ['static_group']) del (expect_dict['vrfs']['VRF1']['interfaces']['Ethernet2/2'] ['join_group']) del (expect_dict['vrfs']['VRF1']['interfaces']['Ethernet2/2'] ['static_group']) # Verify Ops was created successfully self.assertEqual(mld.info, expect_dict)
def test_selective_attribute(self): self.maxDiff = None mld = Mld(device=self.device) # Get outputs mld.maker.outputs[ShowIpv6MldInterface] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldInterface} mld.maker.outputs[ShowIpv6MldGroups] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldGroups} mld.maker.outputs[ShowIpv6MldLocalGroups] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldLocalGroups} # Learn the feature mld.learn() # Check specific attribute values # info - default vrf self.assertEqual(mld.info['vrfs']['default']['interfaces']\ ['Ethernet2/1']['group_policy'], 'test') # info - vrf VRF1 self.assertEqual(mld.info['vrfs']['VRF1']['interfaces']\ ['Ethernet2/2']['group']\ ['fffe::2']['last_reporter'], '2001:db8:8404:751c::1')
def test_complete_output(self): self.maxDiff = None mld = Mld(device=self.device) # Get outputs mld.maker.outputs[ShowIpv6MldInterface] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldInterface} mld.maker.outputs[ShowIpv6MldGroups] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldGroups} mld.maker.outputs[ShowIpv6MldLocalGroups] = \ {"{'vrf':'all'}": MldOutput.ShowIpv6MldLocalGroups} # Learn the feature mld.learn() # Verify Ops was created successfully self.assertEqual(mld.info, MldOutput.Mld_info)
def test_empty_output(self): self.maxDiff = None mld = Mld(device=self.device) # Get outputs mld.maker.outputs[ShowIpv6MldInterface] = \ {"{'vrf':'all'}": {}} mld.maker.outputs[ShowIpv6MldGroups] = \ {"{'vrf':'all'}": {}} mld.maker.outputs[ShowIpv6MldLocalGroups] = \ {"{'vrf':'all'}": {}} # Learn the feature mld.learn() # Check no attribute not found with self.assertRaises(AttributeError): mld.info['vrfs']