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

[sonic-cfggen]: translate_acl tool adds TCP mask #697

Merged
merged 1 commit into from
Jun 13, 2017
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@
"priority":9998
},
"OP":"SET"
},
{
"ACL_RULE_TABLE:dataacl:Rule_4":{
"IP_PROTOCOL":6,
"PACKET_ACTION":"FORWARD",
"TCP_FLAGS":"0x10/0x10",
"priority":9996
},
"OP":"SET"
}
]
62 changes: 42 additions & 20 deletions src/sonic-config-engine/tests/t0-sample-acl.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,77 @@
"config": {
"forwarding-action": "ACCEPT"
}
},
},
"config": {
"sequence-id": 1
},
},
"ip": {
"config": {
"protocol": "IP_UDP",
"protocol": "IP_UDP",
"source-ip-address": "10.0.0.0/8"
}
}
},
},
"2": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
},
"config": {
"sequence-id": 2
},
},
"ip": {
"config": {
"protocol": "IP_UDP",
"protocol": "IP_UDP",
"source-ip-address": "100.64.0.0/10"
}
}
},
},
"3": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
},
"config": {
"sequence-id": 3
},
},
"ip": {
"config": {
"protocol": "IP_UDP",
"protocol": "IP_UDP",
"source-ip-address": "25.0.0.0/8"
}
}
},
"4": {
"actions": {
"config": {
"forwarding-action": "ACCEPT"
}
},
"config": {
"sequence-id": 4
},
"ip": {
"config": {
"protocol": "IP_TCP"
}
},
"transport": {
"config": {
"tcp-flags": [
"TCP_ACK"
]
}
}
}
}
},
},
"config": {
"name": "dataacl"
}
},
},
"everflow": {
"acl-entries": {
"acl-entry": {
Expand All @@ -67,26 +89,26 @@
"config": {
"forwarding-action": "ACCEPT"
}
},
},
"config": {
"sequence-id": 1
},
},
"ip": {
"config": {
"destination-ip-address": "127.0.0.1/32",
"protocol": "IP_TCP",
"destination-ip-address": "127.0.0.1/32",
"protocol": "IP_TCP",
"source-ip-address": "127.0.0.1/32"
}
},
},
"transport": {
"config": {
"destination-port": "0",
"destination-port": "0",
"source-port": "0"
}
}
}
}
},
},
"config": {
"name": "everflow"
}
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-config-engine/translate_acl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def generate_rule_json(table_name, rule, max_priority, mirror):
if flag == "TCP_CWR":
tcp_flags = tcp_flags | 0x80
if tcp_flags != 0x00:
rule_props["TCP_FLAGS"] = '0x{:02x}'.format(tcp_flags)
rule_props["TCP_FLAGS"] = '0x{:02x}/0x{:02x}'.format(tcp_flags, tcp_flags)
return rule_data

def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_path='.'):
Expand Down