コード例 #1
0
def q_device():
    """Ask for the type of device.  Used to determine the use of Alcatel, Cisco, or Juniper"""
    device = input(POLITE_STRING + DEVICE_STRINGS['general'])
    is_true = key_word_check(device, "device")
    valid_input = False

    while valid_input is False:
        if is_true is True:
            return device
        else:
            device = input(str(device) + INVALID_STRING + str(DEVICE_STRINGS['invalid']))
            is_true = key_word_check(device, "device")
コード例 #2
0
def q_new_term():
    """Ask for a new term.  Accepts no arguments"""
    new = input(NEW_TERM_STRINGS['general']) or "n"
    is_true = key_word_check(new, "y_or_n")
    valid_input = False

    while valid_input is False:
        if is_true is True:
            return new
        else:
            new = input(str(new) + INVALID_STRING +
                        str(NEW_TERM_STRINGS['invalid'])) or "n"
            is_true = key_word_check(new, "y_or_n")
コード例 #3
0
def q_protocol():
    """Ask for a protocol.  Accepts no arguments"""
    protocol = input(POLITE_STRING + PROTOCOL_STRINGS['general']) or "any"
    is_true = key_word_check(protocol, "protocol")
    valid_input = False

    while valid_input is False:
        if is_true is True:
            return protocol
        else:
            protocol = input(
                str(protocol) + INVALID_STRING + PROTOCOL_STRINGS['invalid']) or "any"
            is_true = key_word_check(protocol, "protocol")
コード例 #4
0
ファイル: Main.py プロジェクト: c4ch3c4d3/ACL_Generator
def q_action(kind):
    """
    Ask for an action.
    Kinds -- alcatel, cisco, juniper
    """
    
    DROP_KINDS = {'alcatel': 'drop', 'juniper': 'reject', 'cisco': 'deny'}
    action = input(POLITE_STRING +
                   str(ACTION_STRINGS[kind])) or DROP_KINDS[kind]
    is_true = key_word_check(action, "action")
    valid_input = False

    while valid_input is False:
        if is_true is True:
            return action
        else:
            action = input(str(action) + INVALID_STRING + str(ACTION_STRINGS[kind])) or DROP_KINDS[kind]
            is_true = key_word_check(action, "action")