blob: 28a6d46fd2a5e04df444a64062b269e9c9d12cf8 [file] [log] [blame]
vinokumaf7605fc2023-06-02 18:08:01 +05301/*
2* Copyright 2022-present Open Networking Foundation
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14 */
15
16package of
17
18import (
19 "net"
20 "testing"
21)
22
23func TestMatch_SetTableMetadata(t *testing.T) {
24 type fields struct {
25 SrcMacAddr net.HardwareAddr
26 SrcMacMask net.HardwareAddr
27 DstMacAddr net.HardwareAddr
28 DstMacMask net.HardwareAddr
29 SrcIpv4Addr net.IP
30 DstIpv4Addr net.IP
31 TableMetadata uint64
32 InPort uint32
33 MatchVlan VlanType
34 Pbits PbitType
35 L3Protocol EtherType
36 SrcPort uint16
37 DstPort uint16
38 L4Protocol IPProtocol
39 DstIpv4Match bool
40 SrcIpv4Match bool
41 SrcMacMatch bool
42 DstMacMatch bool
43 MatchPbits bool
44 }
45 type args struct {
46 metadata uint64
47 }
48 tests := []struct {
49 name string
50 fields fields
51 args args
52 }{
53 {
54 name: "test",
55 args: args{
56 metadata: uint64(537416),
57 },
58 },
59 }
60 for _, tt := range tests {
61 t.Run(tt.name, func(t *testing.T) {
62 m := &Match{
63 SrcMacAddr: tt.fields.SrcMacAddr,
64 SrcMacMask: tt.fields.SrcMacMask,
65 DstMacAddr: tt.fields.DstMacAddr,
66 DstMacMask: tt.fields.DstMacMask,
67 SrcIpv4Addr: tt.fields.SrcIpv4Addr,
68 DstIpv4Addr: tt.fields.DstIpv4Addr,
69 TableMetadata: tt.fields.TableMetadata,
70 InPort: tt.fields.InPort,
71 MatchVlan: tt.fields.MatchVlan,
72 Pbits: tt.fields.Pbits,
73 L3Protocol: tt.fields.L3Protocol,
74 SrcPort: tt.fields.SrcPort,
75 DstPort: tt.fields.DstPort,
76 L4Protocol: tt.fields.L4Protocol,
77 DstIpv4Match: tt.fields.DstIpv4Match,
78 SrcIpv4Match: tt.fields.SrcIpv4Match,
79 SrcMacMatch: tt.fields.SrcMacMatch,
80 DstMacMatch: tt.fields.DstMacMatch,
81 MatchPbits: tt.fields.MatchPbits,
82 }
83 m.SetTableMetadata(tt.args.metadata)
84 })
85 }
86}