Flow monitoring as default NIC rule action
This patch enables per-rule byte and packet counters
on server NICs. A bug fix is also applied related to
IP protocol matches.
Change-Id: I96ba16d84ecffbde181fb58bf33c43aabbd98612
Signed-off-by: Georgios Katsikas <katsikas.gp@gmail.com>
diff --git a/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultDpdkNicFlowRule.java b/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultDpdkNicFlowRule.java
index b7b6f05..4c2b7f0 100644
--- a/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultDpdkNicFlowRule.java
+++ b/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultDpdkNicFlowRule.java
@@ -75,8 +75,7 @@
rule += "ipv4 ";
if (this.ipv4Protocol() > 0) {
- rule += "proto spec " + Integer.toString(this.ipv4Protocol()) + " ";
- rule += "proto mask 0x0 ";
+ rule += "proto is " + Integer.toString(this.ipv4Protocol()) + " ";
}
if (this.ipv4SrcAddress() != null) {
@@ -129,15 +128,16 @@
// No subsequent field
if (action.actionField().isEmpty()) {
+ rule += "/ ";
continue;
}
// A subsequent field is associated with a value
rule += action.actionField() + " ";
- rule += Long.toString(action.actionValue()) + " ";
+ rule += Long.toString(action.actionValue()) + " / ";
}
- rule += "/ end";
+ rule += " end";
}
return rule;
diff --git a/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultNicFlowRule.java b/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultNicFlowRule.java
index abbf0b8..019b875 100644
--- a/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultNicFlowRule.java
+++ b/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/DefaultNicFlowRule.java
@@ -167,6 +167,9 @@
new NicRuleAction(NicRuleAction.Action.METER, meterInstruction.meterId().id()));
}
}
+
+ // This action provides basic rule match counters
+ this.actions.add(new NicRuleAction(NicRuleAction.Action.COUNT));
}
@Override
diff --git a/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/NicRuleAction.java b/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/NicRuleAction.java
index 3ec13c3..ff3afeb 100644
--- a/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/NicRuleAction.java
+++ b/drivers/server/src/main/java/org/onosproject/drivers/server/devices/nic/NicRuleAction.java
@@ -196,7 +196,7 @@
ACTION_FIELD.put(Action.JUMP, "group");
ACTION_FIELD.put(Action.MARK, "id");
ACTION_FIELD.put(Action.FLAG, "");
- ACTION_FIELD.put(Action.COUNT, "id");
+ ACTION_FIELD.put(Action.COUNT, "");
ACTION_FIELD.put(Action.QUEUE, "index");
ACTION_FIELD.put(Action.RSS, "queue");
ACTION_FIELD.put(Action.PF, "");