Exemple #1
0
def host_reservation_extension(reservation_number, subnet, reservation_type, reserved_value):
    pointer = locate_entry(world.subcfg[subnet][5], '}', reservation_number)
    if reservation_type == "address":
        tmp = world.subcfg[subnet][5][:pointer] + ',"ip-addresses":"{reserved_value}"'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    elif reservation_type == "hostname":
        tmp = world.subcfg[subnet][5][:pointer] + ',"hostname":"{reserved_value}"'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    else:
        assert False, "Not supported"
        # if reservation will allow on another value - add it here

    world.subcfg[subnet][5] = tmp
Exemple #2
0
def host_reservation_extension(reservation_number, subnet, reservation_type, reserved_value):
    pointer = locate_entry(world.subcfg[subnet][5], '}', reservation_number)
    if reservation_type == "address":
        tmp = world.subcfg[subnet][5][:pointer] + ',"ip-address":"{reserved_value}"'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    elif reservation_type == "hostname":
        tmp = world.subcfg[subnet][5][:pointer] + ',"hostname":"{reserved_value}"'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    else:
        assert False, "Not supported"
        # if reservation will allow on another value - add it here

    world.subcfg[subnet][5] = tmp
Exemple #3
0
def host_reservation_extension(reservation_number, subnet, reservation_type, reserved_value):
    pointer = locate_entry(world.subcfg[subnet][5], '}', reservation_number)

    if reservation_type == "address":
        tmp = world.subcfg[subnet][5][:pointer] + ',"ip-addresses":["{reserved_value}"]'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    elif reservation_type == "prefix":
        tmp = world.subcfg[subnet][5][:pointer] + ',"prefixes":["{reserved_value}"]'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    elif reservation_type == "hostname":
        tmp = world.subcfg[subnet][5][:pointer] + ',"hostname":"{reserved_value}"'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    else:
        assert False, "Not supported"
        # TODO implement this if we needs it.
    world.subcfg[subnet][5] = tmp
Exemple #4
0
def host_reservation_extension(reservation_number, subnet, reservation_type, reserved_value):
    pointer = locate_entry(world.subcfg[subnet][5], '}', reservation_number)

    if reservation_type == "address":
        tmp = world.subcfg[subnet][5][:pointer] + ',"ip-addresses":["{reserved_value}"]'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    elif reservation_type == "prefix":
        tmp = world.subcfg[subnet][5][:pointer] + ',"prefixes":["{reserved_value}"]'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    elif reservation_type == "hostname":
        tmp = world.subcfg[subnet][5][:pointer] + ',"hostname":"{reserved_value}"'.format(**locals())
        tmp += world.subcfg[subnet][5][pointer:]
    else:
        assert False, "Not supported"
        # TODO implement this if we needs it.
    world.subcfg[subnet][5] = tmp