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

Fortinet FortiGate - Official Support for Capirca with Local-In Policy Support #362

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion capirca/aclgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from capirca.lib import gce
from capirca.lib import gce_vpc_tf
from capirca.lib import gcp_hf
from capirca.lib import fortigate
from capirca.lib import fortigatelocalin
from capirca.lib import ipset
from capirca.lib import iptables
from capirca.lib import juniper
Expand Down Expand Up @@ -198,6 +200,8 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
sonic_pol = False
k8s_pol = False
gce_vpc_tf_pol = False
fcl = False
lipfcl = False

try:
with open(input_file) as f:
Expand Down Expand Up @@ -286,6 +290,10 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
gca = copy.deepcopy(pol)
if 'k8s' in platforms:
k8s_pol = copy.deepcopy(pol)
if 'fortigate' in platforms:
fcl = copy.deepcopy(pol)
if 'fortigatelocalin' in platforms:
lipfcl = copy.deepcopy(pol)

acl_obj: aclgenerator.ACLGenerator

Expand Down Expand Up @@ -447,6 +455,15 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
RenderACL(
str(acl_obj), acl_obj.SUFFIX, output_directory, input_file,
write_files)

if fcl:
acl_obj = fortigate.Fortigate(fcl, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)
if lipfcl:
acl_obj = fortigatelocalin.FortigateLocalIn(lipfcl, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)

# TODO(robankeny) add additional errors.
except (
Expand All @@ -465,7 +482,9 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
gce.Error,
gce_vpc_tf.Error,
cloudarmor.Error,
k8s.Error) as e:
k8s.Error,
fortigate.Error,
fortigatelocalin.Error) as e:
raise ACLGeneratorError('Error generating target ACL for %s:\n%s' %
(input_file, e))

Expand Down
Loading