Beispiel #1
0
    def test_full_vlan_new(self):
        f = Vlan(device=self.device)
        # Get 'show vlan' output
        f.maker.outputs[ShowVlan] = {'': VlanOutput.showVlan}
        self.device.execute = Mock()
        # Learn the feature
        f.learn()

        self.maxDiff = None
        self.assertEqual(f.info, VlanOutput.vlanOpsOutput)
Beispiel #2
0
    def test_selective_attribute_vlan_new(self):
        f = Vlan(device=self.device)

        # Get 'show vlan' output
        f.maker.outputs[ShowVlan] = {'': VlanOutput.showVlan}

        # Learn the feature
        f.learn()
        # Check match
        self.assertEqual('VLAN0020', f.info['vlans']['20']['name'])
        # Check does not match
        self.assertNotEqual(10, f.info['vlans']['20']['vlan_id'])
Beispiel #3
0
    def test_empty_output_vlan_new(self):
        self.maxDiff = None
        f = Vlan(device=self.device)

        # Get outputs
        f.maker.outputs[ShowVlan] = {'': {}}

        # Learn the feature
        f.learn()

        # Check no attribute not found
        with self.assertRaises(AttributeError):
            f.info['vlans']