Skip to content

Commit b38903c

Browse files
author
Capirca Team
committed
Merge pull request #364 from pc48m8n1:fortigate-localin
PiperOrigin-RevId: 766267455
2 parents 0120010 + 85d6ca7 commit b38903c

13 files changed

+2477
-2
lines changed

capirca/aclgen.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
from capirca.lib import gce
3636
from capirca.lib import gce_vpc_tf
3737
from capirca.lib import gcp_hf
38+
from capirca.lib import fortigate
39+
from capirca.lib import fortigatelocalin
3840
from capirca.lib import ipset
3941
from capirca.lib import iptables
4042
from capirca.lib import juniper
@@ -198,6 +200,8 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
198200
sonic_pol = False
199201
k8s_pol = False
200202
gce_vpc_tf_pol = False
203+
fcl = False
204+
lipfcl = False
201205

202206
try:
203207
with open(input_file) as f:
@@ -286,6 +290,10 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
286290
gca = copy.deepcopy(pol)
287291
if 'k8s' in platforms:
288292
k8s_pol = copy.deepcopy(pol)
293+
if 'fortigate' in platforms:
294+
fcl = copy.deepcopy(pol)
295+
if 'fortigatelocalin' in platforms:
296+
lipfcl = copy.deepcopy(pol)
289297

290298
acl_obj: aclgenerator.ACLGenerator
291299

@@ -448,6 +456,15 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
448456
str(acl_obj), acl_obj.SUFFIX, output_directory, input_file,
449457
write_files)
450458

459+
if fcl:
460+
acl_obj = fortigate.Fortigate(fcl, exp_info)
461+
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
462+
input_file, write_files)
463+
if lipfcl:
464+
acl_obj = fortigatelocalin.FortigateLocalIn(lipfcl, exp_info)
465+
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
466+
input_file, write_files)
467+
451468
# TODO(robankeny) add additional errors.
452469
except (
453470
juniper.Error,
@@ -465,7 +482,9 @@ def RenderFile(base_directory: str, input_file: pathlib.Path,
465482
gce.Error,
466483
gce_vpc_tf.Error,
467484
cloudarmor.Error,
468-
k8s.Error) as e:
485+
k8s.Error,
486+
fortigate.Error,
487+
fortigatelocalin.Error) as e:
469488
raise ACLGeneratorError('Error generating target ACL for %s:\n%s' %
470489
(input_file, e))
471490

0 commit comments

Comments
 (0)