コード例 #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)

        invalid_ip = '10.0.0.2\r'
        pools = [[{'end': '10.0.0.254', 'start': invalid_ip}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertEqual("'%s' is not a valid IP address" % invalid_ip,
                             msg)
コード例 #2
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)

        invalid_ip = '10.0.0.2\r'
        pools = [[{'end': '10.0.0.254', 'start': invalid_ip}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertEqual("'%s' is not a valid IP address" % invalid_ip,
                             msg)
コード例 #3
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)
コード例 #4
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)

        invalid_ip = "10.0.0.2\r"
        pools = [[{"end": "10.0.0.254", "start": invalid_ip}]]
        for pool in pools:
            msg = attributes._validate_ip_pools(pool)
            self.assertEqual("'%s' is not a valid IP address" % invalid_ip, msg)
コード例 #5
0
ファイル: test_attributes.py プロジェクト: VeenaSL/sriov
    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)
コード例 #6
0
ファイル: test_attributes.py プロジェクト: ZelinIO/neutron
    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)