@@ -333,6 +333,8 @@ class Term:
333
333
pan-application: VarType.PAN_APPLICATION
334
334
policer: VarType.POLICER
335
335
priority: VarType.PRIORITY
336
+ destination-zone: VarType.DZONE
337
+ source-zone: VarType.SZONE
336
338
vpn: VarType.VPN
337
339
"""
338
340
ICMP_TYPE = {4 : {'echo-reply' : 0 ,
@@ -458,6 +460,8 @@ def __init__(self, obj):
458
460
self .encapsulate = None
459
461
self .port_mirror = None
460
462
# srx specific
463
+ self .destination_zone = []
464
+ self .source_zone = []
461
465
self .vpn = None
462
466
# gce specific
463
467
self .source_tag = []
@@ -677,6 +681,14 @@ def __contains__(self, other):
677
681
if sorted (self .platform_exclude ) is not sorted (other .platform_exclude ):
678
682
return False
679
683
684
+ if self .source_zone :
685
+ if sorted (self .source_zone ) is not sorted (other .source_zone ):
686
+ return False
687
+
688
+ if self .destination_zone :
689
+ if sorted (self .destination_zone ) is not sorted (other .destination_zone ):
690
+ return False
691
+
680
692
# we have containment
681
693
return True
682
694
@@ -790,6 +802,10 @@ def __str__(self):
790
802
(vpn_name , pair_policy ))
791
803
else :
792
804
ret_str .append (' vpn: name = %s' % vpn_name )
805
+ if self .source_zone :
806
+ ret_str .append (' source_zone: %s' % sorted (self .source_zone ))
807
+ if self .destination_zone :
808
+ ret_str .append (' destination_zone: %s' % sorted (self .destination_zone ))
793
809
794
810
return '\n ' .join (ret_str )
795
811
@@ -937,6 +953,14 @@ def __eq__(self, other):
937
953
if self .port_mirror != other .port_mirror :
938
954
return False
939
955
956
+ # source_zone
957
+ if sorted (self .source_zone ) != sorted (other .source_zone ):
958
+ return False
959
+
960
+ # destination_zone
961
+ if sorted (self .destination_zone ) != sorted (other .destination_zone ):
962
+ return False
963
+
940
964
return True
941
965
942
966
def __ne__ (self , other ):
@@ -1137,6 +1161,10 @@ def AddObject(self, obj):
1137
1161
self .target_resources .append (x .value )
1138
1162
elif x .var_type is VarType .TARGET_SERVICE_ACCOUNTS :
1139
1163
self .target_service_accounts .append (x .value )
1164
+ elif x .var_type is VarType .SZONE :
1165
+ self .source_zone .append (x .value )
1166
+ elif x .var_type is VarType .DZONE :
1167
+ self .destination_zone .append (x .value )
1140
1168
else :
1141
1169
raise TermObjectTypeError (
1142
1170
'%s isn\' t a type I know how to deal with (contains \' %s\' )' % (
@@ -1537,6 +1565,8 @@ class VarType:
1537
1565
FILTER_TERM = 62
1538
1566
RESTRICT_ADDRESS_FAMILY = 63
1539
1567
PORT_MIRROR = 64
1568
+ SZONE = 65
1569
+ DZONE = 66
1540
1570
1541
1571
1542
1572
def __init__ (self , var_type , value ):
@@ -1711,6 +1741,7 @@ def __ne__(self, other):
1711
1741
'DSCP_RANGE' ,
1712
1742
'DSCP_SET' ,
1713
1743
'DTAG' ,
1744
+ 'DZONE' ,
1714
1745
'ENCAPSULATE' ,
1715
1746
'ESCAPEDSTRING' ,
1716
1747
'ETHER_TYPE' ,
@@ -1758,6 +1789,7 @@ def __ne__(self, other):
1758
1789
'SPFX' ,
1759
1790
'ESPFX' ,
1760
1791
'SPORT' ,
1792
+ 'SZONE' ,
1761
1793
'STAG' ,
1762
1794
'STRING' ,
1763
1795
'TARGET' ,
@@ -1793,6 +1825,7 @@ def __ne__(self, other):
1793
1825
'destination-prefix-except' : 'EDPFX' ,
1794
1826
'destination-port' : 'DPORT' ,
1795
1827
'destination-tag' : 'DTAG' ,
1828
+ 'destination-zone' : 'DZONE' ,
1796
1829
'dscp-except' : 'DSCP_EXCEPT' ,
1797
1830
'dscp-match' : 'DSCP_MATCH' ,
1798
1831
'dscp-set' : 'DSCP_SET' ,
@@ -1838,6 +1871,7 @@ def __ne__(self, other):
1838
1871
'source-prefix-except' : 'ESPFX' ,
1839
1872
'source-port' : 'SPORT' ,
1840
1873
'source-tag' : 'STAG' ,
1874
+ 'source-zone' : 'SZONE' ,
1841
1875
'target' : 'TARGET' ,
1842
1876
'target-resources' : 'TARGET_RESOURCES' ,
1843
1877
'target-service-accounts' : 'TARGET_SERVICE_ACCOUNTS' ,
@@ -2011,6 +2045,7 @@ def p_term_spec(p):
2011
2045
| term_spec qos_spec
2012
2046
| term_spec pan_application_spec
2013
2047
| term_spec routinginstance_spec
2048
+ | term_spec term_zone_spec
2014
2049
| term_spec tag_list_spec
2015
2050
| term_spec target_resources_spec
2016
2051
| term_spec target_service_accounts_spec
@@ -2365,6 +2400,15 @@ def p_verbatim_spec(p):
2365
2400
| VERBATIM ':' ':' STRING ESCAPEDSTRING """
2366
2401
p [0 ] = VarType (VarType .VERBATIM , [p [4 ], p [5 ].strip ('"' ).replace ('\\ "' , '"' )])
2367
2402
2403
+ def p_term_zone_spec (p ):
2404
+ """ term_zone_spec : SZONE ':' ':' one_or_more_strings
2405
+ | DZONE ':' ':' one_or_more_strings """
2406
+ p [0 ] = []
2407
+ for zone in p [4 ]:
2408
+ if p [1 ].find ('source-zone' ) >= 0 :
2409
+ p [0 ].append (VarType (VarType .SZONE , zone ))
2410
+ elif p [1 ].find ('destination-zone' ) >= 0 :
2411
+ p [0 ].append (VarType (VarType .DZONE , zone ))
2368
2412
2369
2413
def p_vpn_spec (p ):
2370
2414
""" vpn_spec : VPN ':' ':' STRING STRING
0 commit comments