Beispiel #1
0
def set_firewall_rule_destination_networkgroup(hostname, firewall_name,
                                               rulenumber, dnetworkgroup):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="set",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber,
            "destination", "group", "network-group", dnetworkgroup
        ],
        description="set dnetworkgroup",
    )
    return v
Beispiel #2
0
def set_firewall_rule_source_networkgroup_delete(hostname, firewall_name,
                                                 rulenumber):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="delete",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber, "source",
            "group", "network-group"
        ],
        description="delete snetworkgroup",
    )
    return v
Beispiel #3
0
def set_firewall_rule_source_addressgroup(hostname, firewall_name, rulenumber,
                                          saddressgroup):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="set",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber, "source",
            "group", "address-group", saddressgroup
        ],
        description="set saddressgroup",
    )
    return v
Beispiel #4
0
def set_firewall_rule_destination_addressgroup_delete(hostname, firewall_name,
                                                      rulenumber):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="delete",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber,
            "destination", "group", "address-group"
        ],
        description="delete daddressgroup",
    )
    return v
Beispiel #5
0
def set_firewall_rule_source_address_delete(hostname, firewall_name,
                                            rulenumber):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="delete",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber, "source",
            "address"
        ],
        description="set saddress",
    )
    return v
Beispiel #6
0
def set_firewall_rule_destination_address(hostname, firewall_name, rulenumber,
                                          address):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="set",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber,
            "destination", "address", address
        ],
        description="set daddress",
    )
    return v
Beispiel #7
0
def set_firewall_rule_destination_ports_delete(hostname, firewall_name,
                                               rulenumber):
    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="delete",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber,
            "destination", "port"
        ],
        description="delete destination port",
    )
    return v
Beispiel #8
0
def set_firewall_rule_tcpflags(hostname, firewall_name, rulenumber, tcpflags):
    if len(tcpflags) > 0:
        tcpflags_txt = ",".join(tcpflags)
        v = vapilib.api(
            hostname=hostname,
            api="post",
            op="set",
            cmd=[
                "firewall", "name", firewall_name, "rule", rulenumber, "tcp",
                "flags", tcpflags_txt
            ],
            description="set tcpflags",
        )
    return v
Beispiel #9
0
def set_firewall_rule_source_ports(hostname, firewall_name, rulenumber, ports):
    ports_text = ','.join(ports)

    v = vapilib.api(
        hostname=hostname,
        api="post",
        op="set",
        cmd=[
            "firewall", "name", firewall_name, "rule", rulenumber, "source",
            "port", ports_text
        ],
        description="set source ports",
    )
    return v