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

Create fw_ipv4_access_rules with "AND" combination in source #36

Closed
Donlouigi opened this issue Oct 19, 2022 · 2 comments
Closed

Create fw_ipv4_access_rules with "AND" combination in source #36

Donlouigi opened this issue Oct 19, 2022 · 2 comments

Comments

@Donlouigi
Copy link

Donlouigi commented Oct 19, 2022

Hello,

I'm trying to import rules from a cisco ftd into the forcepoint smc.
I want to have in my rule that the IP-Address and Zone field are "AND" combined (like in the picture).

What is the code to create a "AND" combination as the source?
I can't find anything in the descriptions.

I tried this one and others, but I always get errors:
source_as_list=[ [source[0] ,source[3]]]
source_as_list=["AND", {source[0] ,source[3]}]

The creation of a rule works fine with my code, but when I use this code I have all elements separated in the rule:

policy.fw_ipv4_access_rules.create(name=rule_name,sources=source_as_list, destinations=dest,services=services, action=actions,log_options=options, is_disabled=disabled,comment=comment, add_pos=add_after_position)

Forcepoint_ngfw_AND_combination

Thanks in advance

@ggrimaux
Copy link

Hello,

When you want to mix several elements for source destination or service you have to create MatchExpression() element first.
Please take a look at this example to handle MatchExpression. Then add the MatchExpression element as the source.
Example:
https://github.com/Forcepoint/fp-NGFW-SMC-python/blob/master/smc/examples/match_expression.py

BR,
/Greg.

@Donlouigi
Copy link
Author

Oh damn, I overlooked it the whole day...
Thank you very much 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