diff options
Diffstat (limited to 'packet/bgp/validate_test.go')
-rw-r--r-- | packet/bgp/validate_test.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/packet/bgp/validate_test.go b/packet/bgp/validate_test.go index 12f81e03..4228c260 100644 --- a/packet/bgp/validate_test.go +++ b/packet/bgp/validate_test.go @@ -368,28 +368,23 @@ func Test_Validate_flowspec(t *testing.T) { cmp := make([]FlowSpecComponentInterface, 0) cmp = append(cmp, NewFlowSpecDestinationPrefix(NewIPAddrPrefix(24, "10.0.0.0"))) cmp = append(cmp, NewFlowSpecSourcePrefix(NewIPAddrPrefix(24, "10.0.0.0"))) - eq := 0x1 - gt := 0x2 - lt := 0x4 - and := 0x40 - not := 0x2 - item1 := NewFlowSpecComponentItem(eq, TCP) + item1 := NewFlowSpecComponentItem(DEC_NUM_OP_EQ, TCP) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_IP_PROTO, []*FlowSpecComponentItem{item1})) - item2 := NewFlowSpecComponentItem(gt|eq, 20) - item3 := NewFlowSpecComponentItem(and|lt|eq, 30) - item4 := NewFlowSpecComponentItem(eq, 10) + item2 := NewFlowSpecComponentItem(DEC_NUM_OP_GT_EQ, 20) + item3 := NewFlowSpecComponentItem(DEC_NUM_OP_AND|DEC_NUM_OP_LT_EQ, 30) + item4 := NewFlowSpecComponentItem(DEC_NUM_OP_EQ, 10) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_PORT, []*FlowSpecComponentItem{item2, item3, item4})) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_DST_PORT, []*FlowSpecComponentItem{item2, item3, item4})) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_SRC_PORT, []*FlowSpecComponentItem{item2, item3, item4})) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_ICMP_TYPE, []*FlowSpecComponentItem{item2, item3, item4})) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_ICMP_CODE, []*FlowSpecComponentItem{item2, item3, item4})) item5 := NewFlowSpecComponentItem(0, TCP_FLAG_ACK) - item6 := NewFlowSpecComponentItem(and|not, TCP_FLAG_URGENT) + item6 := NewFlowSpecComponentItem(BITMASK_FLAG_OP_AND|BITMASK_FLAG_OP_NOT, TCP_FLAG_URGENT) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_TCP_FLAG, []*FlowSpecComponentItem{item5, item6})) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_PKT_LEN, []*FlowSpecComponentItem{item2, item3, item4})) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_DSCP, []*FlowSpecComponentItem{item2, item3, item4})) - isFragment := 0x02 - item7 := NewFlowSpecComponentItem(isFragment, 0) + isFragment := uint64(0x02) + item7 := NewFlowSpecComponentItem(BITMASK_FLAG_OP_MATCH, isFragment) cmp = append(cmp, NewFlowSpecComponent(FLOW_SPEC_TYPE_FRAGMENT, []*FlowSpecComponentItem{item7})) n1 := NewFlowSpecIPv4Unicast(cmp) a := NewPathAttributeMpReachNLRI("", []AddrPrefixInterface{n1}) |