-
Notifications
You must be signed in to change notification settings - Fork 230
/
testutils.go
104 lines (101 loc) · 1.7 KB
/
testutils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package policies
import "github.com/Azure/azure-container-networking/npm/pkg/dataplane/ipsets"
var (
// TestNetworkPolicies for testing
TestNetworkPolicies = []*NPMNetworkPolicy{
{
Name: "test1",
PodSelectorIPSets: []*ipsets.TranslatedIPSet{
{Metadata: ipsets.TestKVNSList.Metadata},
},
ACLs: testACLs,
},
{
Name: "test2",
PodSelectorIPSets: []*ipsets.TranslatedIPSet{
{Metadata: ipsets.TestKVNSList.Metadata},
{Metadata: ipsets.TestKeyPodSet.Metadata},
},
ACLs: []*ACLPolicy{
testACLs[0],
},
},
{
Name: "test3",
ACLs: []*ACLPolicy{
testACLs[3],
},
},
}
testACLs = []*ACLPolicy{
{
PolicyID: "test1",
Comment: "comment1",
SrcList: []SetInfo{
{
ipsets.TestCIDRSet.Metadata,
true,
SrcMatch,
},
},
DstList: []SetInfo{
{
ipsets.TestKeyPodSet.Metadata,
false,
DstMatch,
},
},
Target: Dropped,
Direction: Ingress,
DstPorts: Ports{
222, 333,
},
Protocol: TCP,
},
{
PolicyID: "test2",
Comment: "comment2",
SrcList: []SetInfo{
{
ipsets.TestCIDRSet.Metadata,
true,
SrcMatch,
},
},
Target: Allowed,
Direction: Ingress,
Protocol: UDP,
},
{
PolicyID: "test3",
Comment: "comment3",
SrcList: []SetInfo{
{
ipsets.TestCIDRSet.Metadata,
true,
SrcMatch,
},
},
Target: Dropped,
Direction: Egress,
DstPorts: Ports{
144, 144,
},
Protocol: UDP,
},
{
PolicyID: "test4",
Comment: "comment4",
SrcList: []SetInfo{
{
ipsets.TestCIDRSet.Metadata,
true,
SrcMatch,
},
},
Target: Allowed,
Direction: Egress,
Protocol: AnyProtocol,
},
}
)