Esempio n. 1
0
    def test_validate_ip_pools(self):
        pools = [[{
            'end': '10.0.0.254'
        }], [{
            'start': '10.0.0.254'
        }], [{
            'start': '1000.0.0.254',
            'end': '1.1.1.1'
        }], [{
            'start': '10.0.0.2',
            'end': '10.0.0.254',
            'forza': 'juve'
        }], [{
            'start': '10.0.0.2',
            'end': '10.0.0.254'
        }, {
            'end': '10.0.0.254'
        }], [None], None]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [[{
            'end': '10.0.0.254',
            'start': '10.0.0.2'
        }, {
            'start': '11.0.0.2',
            'end': '11.1.1.1'
        }], [{
            'start': '11.0.0.2',
            'end': '11.0.0.100'
        }]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)
    def test_validate_ip_pools(self):
        pools = [[{'end': '10.0.0.254'}],
                 [{'start': '10.0.0.254'}],
                 [{'start': '1000.0.0.254',
                   'end': '1.1.1.1'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254',
                   'forza': 'juve'}],
                 [{'start': '10.0.0.2', 'end': '10.0.0.254'},
                  {'end': '10.0.0.254'}],
                 [None],
                 None]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNotNone(msg)

        pools = [[{'end': '10.0.0.254', 'start': '10.0.0.2'},
                  {'start': '11.0.0.2', 'end': '11.1.1.1'}],
                 [{'start': '11.0.0.2', 'end': '11.0.0.100'}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertIsNone(msg)