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

ACL ICMP (#2) #465

Merged
merged 4 commits into from
Feb 15, 2018
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
32 changes: 32 additions & 0 deletions ansible/roles/test/files/acstests/acltb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,38 @@ def runAclTests(self, dst_ip, dst_ip_blocked, src_port, dst_ports):
tests_passed += (1 if res else 0)
print "Test #11 %s" % ("PASSED" if res else "FAILED")

#Creates a ICMP packet
pkt0 = simple_icmp_packet(
eth_dst = self.router_mac,
eth_src = self.dataplane.get_mac(0, 0),
ip_src = "10.0.0.1",
ip_dst = dst_ip,
icmp_type=8,
icmp_code=0,
ip_ttl = 64
)
#exp_pkt = pkt.deepcopy()
exp_pkt0 = simple_icmp_packet(
eth_dst = self.dataplane.get_mac(0, 0),
eth_src = self.router_mac,
ip_src = "10.0.0.1",
ip_dst = dst_ip,
icmp_type=8,
icmp_code=0,
ip_ttl = 63
)

# Test #12 - Verify IP protocol & source IP match
pkt = pkt0.copy()
exp_pkt = exp_pkt0.copy()
pkt['IP'].src = "10.0.0.2"
exp_pkt['IP'].src = "10.0.0.2"
pkt['IP'].proto=0x1
exp_pkt['IP'].proto=0x1
res = self.runSendReceiveTest(pkt, src_port, exp_pkt, dst_ports)
tests_passed += (0 if res else 1)
print "Test #12 %s" % ("FAILED" if res else "PASSED")

return tests_passed, self.tests_total

#---------------------------------------------------------------------
Expand Down
16 changes: 16 additions & 0 deletions ansible/roles/test/tasks/acl/acltb_test_rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@
"ethertype": "ETHERTYPE_IPV4"
}
}
},
"13": {
"actions": {
"config": {
"forwarding-action": "DROP"
}
},
"config": {
"sequence-id": 13
},
"ip": {
"config": {
"protocol":1,
"source-ip-address": "10.0.0.2/32"
}
}
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions ansible/roles/test/tasks/acl/acltb_test_rules_part_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@
"ethertype": "ETHERTYPE_IPV4"
}
}
},
"13": {
"actions": {
"config": {
"forwarding-action": "DROP"
}
},
"config": {
"sequence-id": 13
},
"ip": {
"config": {
"protocol":1,
"source-ip-address": "10.0.0.2/32"
}
}
}
}
}
Expand Down