예제 #1
0
def get_first_valid_cidr(value_specs):
    # Bug 1442771, argparse does not allow optional positional parameter
    # to be separated from previous positional parameter.
    # When cidr was separated from network, the value will not be able
    # to be parsed into known_args, but saved to _values_specs instead.
    for value in value_specs:
        if utils.is_valid_cidr(value):
            return value
예제 #2
0
def get_first_valid_cidr(value_specs):
    # Bug 1442771, argparse does not allow optional positional parameter
    # to be separated from previous positional parameter.
    # When cidr was separated from network, the value will not be able
    # to be parsed into known_args, but saved to _values_specs instead.
    for value in value_specs:
        if utils.is_valid_cidr(value):
            return value
예제 #3
0
 def test_is_cidr(self):
     self.assertTrue(utils.is_valid_cidr('10.10.10.0/24'))
     self.assertFalse(utils.is_valid_cidr('10.10.10..0/24'))
     self.assertFalse(utils.is_valid_cidr('wrong_cidr_format'))