[VOL-1668] Remove default flow rules from the Core
This commit cleans up the default flow rules that started with
VOL-1628.
Change-Id: I965e07b9bd2be1f25dca2cdf18a90aa4c16eea88
diff --git a/rw_core/flow_decomposition/flow_decomposer_test.go b/rw_core/flow_decomposition/flow_decomposer_test.go
index 6464c5d..42e42e6 100644
--- a/rw_core/flow_decomposition/flow_decomposer_test.go
+++ b/rw_core/flow_decomposition/flow_decomposer_test.go
@@ -482,29 +482,14 @@
groups := ofp.FlowGroups{}
tfd := newTestFlowDecomposer(newTestDeviceManager())
- deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups, true)
+ deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups)
onu1FlowAndGroup := deviceRules.Rules["onu1"]
oltFlowAndGroup := deviceRules.Rules["olt"]
- assert.Equal(t, 1, onu1FlowAndGroup.Flows.Len())
- assert.Equal(t, 0, onu1FlowAndGroup.Groups.Len())
+ assert.Nil(t, onu1FlowAndGroup)
assert.Equal(t, 2, oltFlowAndGroup.Flows.Len())
assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
fa = &fu.FlowArgs{
- MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(2),
- fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 0),
- },
- Actions: []*ofp.OfpAction{
- fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 101)),
- fu.Output(1),
- },
- }
- expectedOnu1Flow := fu.MkFlowStat(fa)
- derivedFlow := onu1FlowAndGroup.GetFlow(0)
- assert.Equal(t, expectedOnu1Flow.String(), derivedFlow.String())
-
- fa = &fu.FlowArgs{
KV: fu.OfpFlowModArgs{"priority": 1000},
MatchFields: []*ofp.OfpOxmOfbField{
fu.InPort(1),
@@ -519,7 +504,7 @@
},
}
expectedOltFlow := fu.MkFlowStat(fa)
- derivedFlow = oltFlowAndGroup.GetFlow(0)
+ derivedFlow := oltFlowAndGroup.GetFlow(0)
assert.Equal(t, expectedOltFlow.String(), derivedFlow.String())
fa = &fu.FlowArgs{
@@ -564,29 +549,14 @@
groups := ofp.FlowGroups{}
tfd := newTestFlowDecomposer(newTestDeviceManager())
- deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups, true)
+ deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups)
onu1FlowAndGroup := deviceRules.Rules["onu1"]
oltFlowAndGroup := deviceRules.Rules["olt"]
- assert.Equal(t, 1, onu1FlowAndGroup.Flows.Len())
- assert.Equal(t, 0, onu1FlowAndGroup.Groups.Len())
+ assert.Nil(t, onu1FlowAndGroup)
assert.Equal(t, 2, oltFlowAndGroup.Flows.Len())
assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
fa = &fu.FlowArgs{
- MatchFields: []*ofp.OfpOxmOfbField{
- fu.InPort(2),
- fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 0),
- },
- Actions: []*ofp.OfpAction{
- fu.SetField(fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 101)),
- fu.Output(1),
- },
- }
- expectedOnu1Flow := fu.MkFlowStat(fa)
- derivedFlow := onu1FlowAndGroup.GetFlow(0)
- assert.Equal(t, expectedOnu1Flow.String(), derivedFlow.String())
-
- fa = &fu.FlowArgs{
KV: fu.OfpFlowModArgs{"priority": 1000},
MatchFields: []*ofp.OfpOxmOfbField{
fu.InPort(1),
@@ -605,7 +575,7 @@
},
}
expectedOltFlow := fu.MkFlowStat(fa)
- derivedFlow = oltFlowAndGroup.GetFlow(0)
+ derivedFlow := oltFlowAndGroup.GetFlow(0)
assert.Equal(t, expectedOltFlow.String(), derivedFlow.String())
fa = &fu.FlowArgs{
@@ -662,10 +632,10 @@
groups := ofp.FlowGroups{}
tfd := newTestFlowDecomposer(newTestDeviceManager())
- deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups, true)
+ deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups)
onu1FlowAndGroup := deviceRules.Rules["onu1"]
oltFlowAndGroup := deviceRules.Rules["olt"]
- assert.Equal(t, 2, onu1FlowAndGroup.Flows.Len())
+ assert.Equal(t, 1, onu1FlowAndGroup.Flows.Len())
assert.Equal(t, 0, onu1FlowAndGroup.Groups.Len())
assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
@@ -684,7 +654,7 @@
},
}
expectedOnu1Flow := fu.MkFlowStat(fa)
- derivedFlow := onu1FlowAndGroup.GetFlow(1)
+ derivedFlow := onu1FlowAndGroup.GetFlow(0)
assert.Equal(t, expectedOnu1Flow.String(), derivedFlow.String())
fa = &fu.FlowArgs{
@@ -739,10 +709,10 @@
groups := ofp.FlowGroups{}
tfd := newTestFlowDecomposer(newTestDeviceManager())
- deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups, true)
+ deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups)
onu1FlowAndGroup := deviceRules.Rules["onu1"]
oltFlowAndGroup := deviceRules.Rules["olt"]
- assert.Equal(t, 2, onu1FlowAndGroup.Flows.Len())
+ assert.Equal(t, 1, onu1FlowAndGroup.Flows.Len())
assert.Equal(t, 0, onu1FlowAndGroup.Groups.Len())
assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
@@ -777,7 +747,7 @@
},
}
expectedOnu1Flow := fu.MkFlowStat(fa1)
- derivedFlow = onu1FlowAndGroup.GetFlow(1)
+ derivedFlow = onu1FlowAndGroup.GetFlow(0)
assert.Equal(t, expectedOnu1Flow.String(), derivedFlow.String())
}
@@ -813,10 +783,10 @@
groups := ofp.FlowGroups{Items: []*ofp.OfpGroupEntry{fu.MkGroupStat(ga)}}
tfd := newTestFlowDecomposer(newTestDeviceManager())
- deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups, true)
+ deviceRules := tfd.fd.DecomposeRules(tfd, flows, groups)
onu1FlowAndGroup := deviceRules.Rules["onu1"]
oltFlowAndGroup := deviceRules.Rules["olt"]
- assert.Equal(t, 2, onu1FlowAndGroup.Flows.Len())
+ assert.Equal(t, 1, onu1FlowAndGroup.Flows.Len())
assert.Equal(t, 0, onu1FlowAndGroup.Groups.Len())
assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
@@ -851,6 +821,6 @@
},
}
expectedOnu1Flow := fu.MkFlowStat(fa)
- derivedFlow = onu1FlowAndGroup.GetFlow(1)
+ derivedFlow = onu1FlowAndGroup.GetFlow(0)
assert.Equal(t, expectedOnu1Flow.String(), derivedFlow.String())
}