If application installs two flows that are different only by the match extension they use,
second flow will match the first flow, because we don't use match
extensions for flow comparison.To include match extension in flow
comparison require quite a bit work, which can not be done in this
release. I am adding flow cookie also in flow comparison, so that
apps who are using extensions can use that to differentiate two flows
that matches if extension is excluded.If applications don't use it,
or use same cookie, it won't impact the existing working of statistics manager.
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
FLOW_COMPARATORS.add(FlowComparatorFactory.createPriority());
FLOW_COMPARATORS.add(FlowComparatorFactory.createTableId());
FLOW_COMPARATORS.add(FlowComparatorFactory.createContainerName());
+ FLOW_COMPARATORS.add(FlowComparatorFactory.createCookie());
FLOW_COMPARATORS.add(FlowComparatorFactory.createMatch());
}
};
}
+ public static SimpleComparator<Flow> createCookie() {
+ return new SimpleComparator<Flow>() {
+ /**
+ * Compares flows by cookie value
+ */
+ @Override
+ public boolean areObjectsEqual(final Flow statsFlow, final Flow storedFlow) {
+ if (statsFlow.getCookie() == null) {
+ if (storedFlow.getCookie() != null) {
+ return false;
+ }
+ } else if (!statsFlow.getCookie().equals(storedFlow.getCookie())) {
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+
public static SimpleComparator<Flow> createMatch() {
return new SimpleComparator<Flow>() {
/**