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

Add Juniper ethernet-switching and specific tcp-flag support #333

Open
wants to merge 6 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
3 changes: 2 additions & 1 deletion capirca/lib/aclgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ class Term:
}
AF_MAP = {'inet': 4,
'inet6': 6,
'bridge': 4 # if this doesn't exist, output includes v4 & v6
'bridge': 4, # if this doesn't exist, output includes v4 & v6
'ethernet-switching': 4
}
# These protos are always expressed as numbers instead of name
# due to inconsistencies on the end platform's name-to-number
Expand Down
13 changes: 10 additions & 3 deletions capirca/lib/juniper.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ class Term(aclgenerator.Term):
'daddr': 'ip-destination-address',
'protocol': 'ip-protocol',
'protocol-except': 'ip-protocol-except',
'tcp-est': 'tcp-flags "(ack|rst)"'}
'tcp-est': 'tcp-flags "(ack|rst)"'},
'ethernet-switching': {'addr': 'ip-address',
'saddr': 'ip-source-address',
'daddr': 'ip-destination-address',
'protocol': 'ip-protocol',
'protocol-except': 'ip-protocol-except',
'tcp-est': 'tcp-established'}
}

def __init__(self, term, term_type, enable_dsmo, noverbose, filter_direction=None, interface_type=None):
Expand Down Expand Up @@ -278,7 +284,8 @@ def __str__(self):
from_str.append('tcp-initial;')
elif opt.startswith('first-fragment'):
from_str.append('first-fragment;')

elif opt.startswith('no-syn-ack'):
from_str.append('tcp-flags "!(syn&ack)";')
# we don't have a special way of dealing with this, so we output it and
# hope the user knows what they're doing.
else:
Expand Down Expand Up @@ -895,7 +902,7 @@ class Juniper(aclgenerator.ACLGenerator):

_PLATFORM = 'juniper'
_DEFAULT_PROTOCOL = 'ip'
_SUPPORTED_AF = frozenset(('inet', 'inet6', 'bridge', 'mixed'))
_SUPPORTED_AF = frozenset(('inet', 'inet6', 'bridge', 'ethernet-switching', 'mixed'))
_TERM = Term
SUFFIX = '.jcl'

Expand Down