Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How change tunnel Mode in PolicyVPN #52

Closed
fgazelot opened this issue Oct 19, 2023 · 3 comments
Closed

How change tunnel Mode in PolicyVPN #52

fgazelot opened this issue Oct 19, 2023 · 3 comments

Comments

@fgazelot
Copy link

Hello,

I dont know if i missed something or if it's a library limitation or a SMC API limitation.

But, i don't find a way to change tunnel mode on PolicyVPN from standby to active or reverse...

policy_vpn = get_policy_vpn(policy_vpn_name)
policy_vpn.open()

policy_vpn_tunnels = list(policy_vpn.tunnels)

for t in policy_vpn_tunnels:
    l_endpoint_tunnels = t.endpoint_tunnels.get_all_contains(primary_pop,case_sensitive=False)
    for endpoint_tunnel in l_endpoint_tunnels:
           pprint(endpoint_tunnel.data.data)

Return exemple :

{'enabled': False,
 'endpoint_1': 'http://X.X.X.X:8082/6.10/elements/single_fw/5561/internal_gateway/1331/internal_endpoint/1330',
 'endpoint_2': 'http://X.X.X.X:8082/6.10/elements/external_gateway/1350/external_endpoint/1642',
 'key': 0,
 'link': [{'href': 'http://X.X.X.X:8082/6.10/elements/vpn/1/tunnels/MTMzMSMxMzUw/endpoints/MTMzMCMxNjQy',
           'rel': 'self',
           'type': 'gateway_endpoint_tunnel'}],
 'name': 'Gateway EndPoint Tunnel Endpoint 1330-akl1'}

We can't see any key "mode" for this tunnels or make a change on this option.

Information of my environement :

session.api_version = 6.10

pip list | grep SMC                                                                                                                                                             
fp-NGFW-SMC-python 1.0.21

Thank you in advance for your help.

Kind regards,
Fgazelot

@gregory83
Copy link

Hello,

Please try something like this

policy_vpn = PolicyVPN("Corporate VPN")
policy_vpn.open()

policy_vpn_tunnels = list(policy_vpn.tunnels)

for t in policy_vpn_tunnels:
    l_endpoint_tunnels = t.endpoint_tunnels.get_all_contains("gateway",case_sensitive=False)
    for endpoint_tunnel in l_endpoint_tunnels:
        endpoint_tunnel.update(balancing_mode="standby")
policy_vpn.save()
policy_vpn.close()

Best Regards,
/Greg.

@fgazelot
Copy link
Author

Hello,

That's work like a charm.
I dont know where i can find that xD

Thanks for your response !

Kind regards,
FGazelot.

@gregory83
Copy link

Hello,

Good to hear that it has help.
We'll try to make it more visible in newer smc-python version.

Best Regards,
/Greg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants