Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [%
- import "header.egl";
- import "utils.egl";
- import "condition.egl";
- import "firewall.egl";
- import "monitor.egl";
- %]
- [% var header = getCodeHeader(); %]
- [%=header%]
- [% var counterActionDrop : Integer = 0; %]
- def mdn_handler (event):
- # Handles packet events and kills the ones with blocked property
- packet = event.parsed
- [%
- for (policy in Policy.all) {
- if (policy.policyAction.isDefined()) {
- if (policy.policyAction.type.value = Actions#DROP.value) {
- if (counterActionDrop == 0) {
- counterActionDrop = counterActionDrop + 1;
- }
- actionDrop(policy);
- }
- //IF ACTION EQUALS TO MONITOR
- if (policy.policyAction.type.value = Actions#MONITOR.value) {
- if (counterActionMonitor == 0) {
- counterActionMonitor = counterActionMonitor + 1;
- }
- monitorAction(policy);
- }
- }
- }
- %]
- [...]
- def launch ():
- [% if (counterActionDrop > 0) { %]
- core.openflow.addListenerByName("PacketIn", mdn_handler)
- [% } %]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement