示例#1
0
def rules_list(ctx, name):
    try:
        gateway_resource = get_gateway(ctx, name)
        firewall_rules = gateway_resource.get_firewall_rules_list()
        stdout(firewall_rules, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#2
0
def list(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        nat_list = gateway_resource.list_nat_rules()
        stdout(nat_list, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#3
0
def list_objects(ctx, name, type, object_type):
    try:
        gateway_resource = get_gateway(ctx, name)
        objects = gateway_resource.list_firewall_objects(type, object_type)
        stdout(objects, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#4
0
def list_objects(ctx, name, type, object_type):
    try:
        gateway_resource = get_gateway(ctx, name)
        objects = gateway_resource.list_firewall_objects(type, object_type)
        stdout(objects, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#5
0
def list_static_routes(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        static_route_list = gateway_resource.list_static_routes()
        stdout(static_route_list, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#6
0
def list_service_certificate(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.list_service_certificates()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#7
0
def change_shared_key(ctx, gateway_name, new_shared_key):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.change_shared_key_ipsec_vpn(new_shared_key)
        stdout('IPsec VPN shared key changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#8
0
def list_dhcp_pool(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.list_dhcp_pools()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#9
0
def set_log_level(ctx, gateway_name, log_level):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.set_log_level_ipsec_vpn(log_level)
        stdout('IPsec VPN log level changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#10
0
def list_ipsec_vpn(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.list_ipsec_vpn()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#11
0
def info_logging_settings(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.info_logging_settings_ipsec_vpn()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#12
0
def enable_logging(ctx, gateway_name, enabled):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.enable_logging_ipsec_vpn(enabled)
        stdout('IPsec VPN logging enable status changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#13
0
def info_activation_status(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.info_activation_status_ipsec_vpn()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#14
0
def list_static_routes(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        static_route_list = gateway_resource.list_static_routes()
        stdout(static_route_list, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#15
0
def change_shared_key(ctx, gateway_name, new_shared_key):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.change_shared_key_ipsec_vpn(new_shared_key)
        stdout('IPsec VPN shared key changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#16
0
def info_activation_status(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.info_activation_status_ipsec_vpn()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#17
0
def reorder_nat_rule(ctx, gateway_name, rule_id, index):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.reorder_nat_rule(rule_id, position=index)
        stdout('NAT rule reordered successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#18
0
def info_logging_settings(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.info_logging_settings_ipsec_vpn()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#19
0
def enable_activation_status(ctx, gateway_name, enabled):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.enable_activation_status_ipsec_vpn(enabled)
        stdout('IPsec VPN activation status changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#20
0
def set_log_level(ctx, gateway_name, log_level):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.set_log_level_ipsec_vpn(log_level)
        stdout('IPsec VPN log level changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#21
0
def list_service_certificate(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.list_service_certificates()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#22
0
def enable_activation_status(ctx, gateway_name, enabled):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.enable_activation_status_ipsec_vpn(enabled)
        stdout('IPsec VPN activation status changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#23
0
def list(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        nat_list = gateway_resource.list_nat_rules()
        stdout(nat_list, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#24
0
def rules_list(ctx, name):
    try:
        gateway_resource = get_gateway(ctx, name)
        firewall_rules = gateway_resource.get_firewall_rules_list()
        stdout(firewall_rules, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#25
0
def list_ipsec_vpn(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.list_ipsec_vpn()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#26
0
def list_dhcp_pool(ctx, gateway_name):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        result = gateway_resource.list_dhcp_pools()
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
示例#27
0
def enable_logging(ctx, gateway_name, enabled):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.enable_logging_ipsec_vpn(enabled)
        stdout('IPsec VPN logging enable status changed.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#28
0
def create_static_route(ctx, gateway_name, type, network, next_hop,
                        mtu, description, vnic):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_static_route(network, next_hop, mtu,
                                          description, type, vnic)
        stdout('Static route created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#29
0
def create_firewall_rule(ctx, gateway_name, name, action, type, enabled,
                         logging_enabled):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_firewall_rule(name, action, type, enabled,
                                           logging_enabled)
        stdout('Firewall rule created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#30
0
def create_static_route(ctx, gateway_name, type, network, next_hop, mtu,
                        description, vnic):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_static_route(network, next_hop, mtu, description,
                                          type, vnic)
        stdout('Static route created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#31
0
def create_firewall_rule(ctx, gateway_name, name, action, type, enabled,
                         logging_enabled):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_firewall_rule(name, action, type, enabled,
                                           logging_enabled)
        stdout('Firewall rule created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#32
0
def add_crl_certificate(ctx, gateway_name, certificate_file_path, desc):
    try:
        restore_session(ctx, vdc_required=True)
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_crl_certificate(
            crl_certificate_file_path=certificate_file_path, description=desc)
        stdout('CRL certificate added successfully', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#33
0
def create_dhcp_pool(ctx, gateway_name, ip_range, is_auto_dns, gateway_ip,
                     domain, lease_expire, primary_server, secondary_server,
                     lease, subnet):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_dhcp_pool(ip_range, is_auto_dns, gateway_ip,
                                       domain, lease_expire, lease, subnet,
                                       primary_server, secondary_server)
        stdout('DHCP Pool created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#34
0
def add_ca_certificate(ctx, gateway_name, certificate_file_path, desc):
    try:
        restore_session(ctx, vdc_required=True)
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource. \
            add_ca_certificate(ca_certificate_file_path=
                               certificate_file_path,
                               description=desc)
        stdout('CA certificate added successfully', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#35
0
def create_dhcp_pool(ctx, gateway_name, ip_range, is_auto_dns, gateway_ip,
                     domain, lease_expire, primary_server, secondary_server,
                     lease, subnet):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_dhcp_pool(ip_range, is_auto_dns, gateway_ip
                                              , domain, lease_expire, lease,
                                              subnet, primary_server,
                                              secondary_server)
        stdout('DHCP Pool created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#36
0
def add_service_certificate(ctx, gateway_name, certificate_file_path,
                            private_key_file_path, pass_phrase, desc):
    try:
        restore_session(ctx, vdc_required=True)
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_service_certificate(
            service_certificate_file_path=certificate_file_path,
            private_key_file_path=private_key_file_path,
            private_key_passphrase=pass_phrase,
            description=desc)
        stdout('Service certificate added successfully', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#37
0
def add_service_certificate(ctx, gateway_name, certificate_file_path,
                            private_key_file_path, pass_phrase, desc):
    try:
        restore_session(ctx, vdc_required=True)
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.\
            add_service_certificate(service_certificate_file_path=
                                            certificate_file_path,
                                    private_key_file_path=private_key_file_path,
                                    private_key_passphrase=pass_phrase,
                                    description=desc)
        stdout('Service certificate added successfully', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#38
0
def create_snat_rule(ctx, gateway_name, action, type, original_address,
                     translated_address, enabled, logging_enabled, description,
                     vnic):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_nat_rule(action=action,
                                      original_address=original_address,
                                      translated_address=translated_address,
                                      description=description,
                                      type=type,
                                      logging_enabled=logging_enabled,
                                      enabled=enabled,
                                      vnic=vnic)
        stdout('SNAT rule created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#39
0
def create_snat_rule(ctx, gateway_name, action, type, original_address,
                     translated_address, enabled, logging_enabled,
                     description, vnic):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_nat_rule(
            action=action,
            original_address=original_address,
            translated_address=translated_address,
            description=description,
            type=type,
            logging_enabled=logging_enabled,
            enabled=enabled,
            vnic=vnic)
        stdout('SNAT rule created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#40
0
def create_ipsec_vpn(ctx, gateway_name, name, local_id, peer_id, local_ip,
                     peer_ip, local_subnet, peer_subnet, pre_shared_key,
                     description, encryption_protocol, authentication_mode,
                     dh_group, mtu, enabled, enable_pfs):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_ipsec_vpn(name=name,
                                       peer_id=peer_id,
                                       peer_ip_address=peer_ip,
                                       local_id=local_id,
                                       local_ip_address=local_ip,
                                       local_subnet=local_subnet,
                                       peer_subnet=peer_subnet,
                                       shared_secret_encrypted=pre_shared_key,
                                       encryption_protocol=encryption_protocol,
                                       authentication_mode=authentication_mode,
                                       dh_group=dh_group,
                                       mtu=mtu,
                                       description=description,
                                       is_enabled=enabled,
                                       enable_pfs=enable_pfs)
        stdout('IPsec VPN created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)
示例#41
0
def create_ipsec_vpn(ctx, gateway_name, name, local_id, peer_id, local_ip,
                     peer_ip, local_subnet, peer_subnet, pre_shared_key,
                     description, encryption_protocol, authentication_mode,
                     dh_group, mtu, enabled, enable_pfs):
    try:
        gateway_resource = get_gateway(ctx, gateway_name)
        gateway_resource.add_ipsec_vpn(name=name,
                                       peer_id=peer_id,
                                       peer_ip_address=peer_ip,
                                       local_id=local_id,
                                       local_ip_address=local_ip,
                                       local_subnet=local_subnet,
                                       peer_subnet=peer_subnet,
                                       shared_secret_encrypted=pre_shared_key,
                                       encryption_protocol=encryption_protocol,
                                       authentication_mode=authentication_mode,
                                       dh_group=dh_group,
                                       mtu=mtu,
                                       description=description,
                                       is_enabled=enabled,
                                       enable_pfs=enable_pfs)
        stdout('IPsec VPN created successfully.', ctx)
    except Exception as e:
        stderr(e, ctx)