Exemplo n.º 1
0
    def test_ignored_c3850(self):

        f = Platform(device=self.device)
        g = Platform(device=self.device)

        f.maker.outputs[ShowVersion] = \
            {'':PlatformOutput.showVersionC3850}
        f.maker.outputs[Dir] = \
            {'':PlatformOutput.showDirC3850}
        f.maker.outputs[ShowRedundancy] = \
            {'':PlatformOutput.showRedundancyC3850}
        f.maker.outputs[ShowInventory] = \
            {'':PlatformOutput.showInventoryC3850}
        f.maker.outputs[ShowPlatform] = \
            {'':PlatformOutput.showPlatformC3850}
        f.maker.outputs[ShowIssuStateDetail] = \
            {'':PlatformOutput.ShowIssuStateDetailC3850}
        f.maker.outputs[ShowIssuRollbackTimer] = \
            {'':PlatformOutput.ShowIssuRollbackTimerC3850}

        g.maker.outputs[ShowVersion] = \
            {'':PlatformOutput.showVersionC3850}
        g.maker.outputs[Dir] = \
            {'':PlatformOutput.showDirC3850}
        g.maker.outputs[ShowRedundancy] = \
            {'':PlatformOutput.showRedundancyC3850}
        g.maker.outputs[ShowInventory] = \
            {'':PlatformOutput.showInventoryC3850}
        g.maker.outputs[ShowPlatform] = \
            {'':PlatformOutput.showPlatformC3850}
        g.maker.outputs[ShowIssuStateDetail] = \
            {'':PlatformOutput.ShowIssuStateDetailC3850}
        g.maker.outputs[ShowIssuRollbackTimer] = \
            {'':PlatformOutput.ShowIssuRollbackTimerC3850}

        f.learn()
        g.learn()

        f.diff_ignore.append('name[slot][0][rp][WS-C3850-24P-E][rp_sn]')

        self.assertNotEqual(f, g)
        # Verify diff now
        diff = f.diff(g)
        sorted_diff = str(diff)
        sorted_result = (
            '''+diff_ignore: deque(['maker', 'callables', 'device', 'name[slot][0][rp][WS-C3850-24P-E][rp_sn]'])\n-diff_ignore: deque(['maker', 'callables', 'device'])'''
        )
        self.assertEqual(sorted_diff, sorted_result)
Exemplo n.º 2
0
    def test_ignored_asr1k(self):

        f = Platform(device=self.device)
        g = Platform(device=self.device)

        f.maker.outputs[ShowVersion] = \
            {'':PlatformOutput.showVersionAsr1k}
        f.maker.outputs[Dir] = \
            {'':PlatformOutput.showDirAsr1k}
        f.maker.outputs[ShowRedundancy] = \
            {'':PlatformOutput.showRedundancyAsr1k}
        f.maker.outputs[ShowInventory] = \
            {'':PlatformOutput.showInventoryAsr1k}
        f.maker.outputs[ShowPlatform] = \
            {'':PlatformOutput.showPlatformAsr1k}
        f.maker.outputs[ShowIssuStateDetail] = \
            {'':PlatformOutput.ShowIssuStateDetailAsr1k}
        f.maker.outputs[ShowIssuRollbackTimer] = \
            {'':PlatformOutput.ShowIssuRollbackTimerAsr1k}

        g.maker.outputs[ShowVersion] = \
            {'':PlatformOutput.showVersionAsr1k}
        g.maker.outputs[Dir] = \
            {'':PlatformOutput.showDirAsr1k}
        g.maker.outputs[ShowRedundancy] = \
            {'':PlatformOutput.showRedundancyAsr1k}
        g.maker.outputs[ShowInventory] = \
            {'':PlatformOutput.showInventoryAsr1k}
        g.maker.outputs[ShowPlatform] = \
            {'':PlatformOutput.showPlatformAsr1k}
        g.maker.outputs[ShowIssuStateDetail] = \
            {'':PlatformOutput.ShowIssuStateDetailAsr1k}
        g.maker.outputs[ShowIssuRollbackTimer] = \
            {'':PlatformOutput.ShowIssuRollbackTimerAsr1k}

        f.learn()
        g.learn()

        f.s = 2

        self.assertNotEqual(f, g)
        # Verify diff now
        diff = f.diff(g)
        sorted_diff = str(diff)
        sorted_result = ('+s: 2')
        self.assertEqual(sorted_diff, sorted_result)