@@ -26,22 +26,22 @@ const (
2626 egressIP = "10.10.10.10"
2727 nat1UUID = "nat-1-UUID"
2828 nat2UUID = "nat-2-UUID"
29- pod1V4CIDRStr = "10.128.0.5/32 "
30- pod1V6CIDRStr = "2001:0000:130F:0000:0000:09C0:876A:130B/128 "
29+ pod1V4Str = "10.128.0.5"
30+ pod1V6Str = "2001:0000:130F:0000:0000:09C0:876A:130B"
3131 pod1Namespace = "ns1"
3232 pod1Name = "pod1"
33- pod2V4CIDRStr = "10.128.0.6/32 "
34- pod2V6CIDRStr = "2001:0000:130F:0000:0000:09C0:876A:130A/128 "
33+ pod2V4Str = "10.128.0.6"
34+ pod2V6Str = "2001:0000:130F:0000:0000:09C0:876A:130A"
3535 pod2Namespace = "ns1"
3636 pod2Name = "pod2"
3737 defaultNetworkControllerName = "default-network-controller"
3838)
3939
4040var (
41- pod1V4IPNet = testing .MustParseIPNet ( pod1V4CIDRStr )
42- pod1V6IPNet = testing .MustParseIPNet ( pod1V6CIDRStr )
43- pod2V4IPNet = testing .MustParseIPNet ( pod2V4CIDRStr )
44- pod2V6IPNet = testing .MustParseIPNet ( pod2V6CIDRStr )
41+ pod1V4IP = testing .MustParseIP ( pod1V4Str )
42+ pod1V6IP = testing .MustParseIP ( pod1V6Str )
43+ pod2V4IP = testing .MustParseIP ( pod2V4Str )
44+ pod2V6IP = testing .MustParseIP ( pod2V6Str )
4545 legacyExtIDs = map [string ]string {legacyEIPNameExtIDKey : egressIPName }
4646 pod1V4ExtIDs = getEgressIPNATDbIDs (egressIPName , pod1Namespace , pod1Name , ipFamilyValueV4 , defaultNetworkControllerName ).GetExternalIDs ()
4747 pod1V6ExtIDs = getEgressIPNATDbIDs (egressIPName , pod1Namespace , pod1Name , ipFamilyValueV6 , defaultNetworkControllerName ).GetExternalIDs ()
@@ -54,64 +54,64 @@ var _ = ginkgo.Describe("NAT Syncer", func() {
5454 ginkgo .DescribeTable ("egress NATs" , func (sync natSync ) {
5555 performTest (defaultNetworkControllerName , sync .initialNATs , sync .finalNATs , sync .pods )
5656 }, ginkgo .Entry ("converts legacy IPv4 NATs" , natSync {
57- initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4CIDRStr , egressIP , legacyExtIDs )},
58- finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4CIDRStr , egressIP , pod1V4ExtIDs )},
57+ initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4Str , egressIP , legacyExtIDs )},
58+ finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4Str , egressIP , pod1V4ExtIDs )},
5959 pods : podsNetInfo {
6060 {
61- []net.IP {pod1V4IPNet . IP },
61+ []net.IP {pod1V4IP },
6262 pod1Namespace ,
6363 pod1Name ,
6464 },
6565 {
66- []net.IP {pod2V4IPNet . IP },
66+ []net.IP {pod2V4IP },
6767 pod2Namespace ,
6868 pod2Name ,
6969 },
7070 },
7171 }),
7272 ginkgo .Entry ("converts legacy IPv6 NATs" , natSync {
73- initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6CIDRStr , egressIP , legacyExtIDs )},
74- finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6CIDRStr , egressIP , pod1V6ExtIDs )},
73+ initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6Str , egressIP , legacyExtIDs )},
74+ finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6Str , egressIP , pod1V6ExtIDs )},
7575 pods : podsNetInfo {
7676 {
77- []net.IP {pod1V6IPNet . IP },
77+ []net.IP {pod1V6IP },
7878 pod1Namespace ,
7979 pod1Name ,
8080 },
8181 {
82- []net.IP {pod2V6IPNet . IP },
82+ []net.IP {pod2V6IP },
8383 pod2Namespace ,
8484 pod2Name ,
8585 },
8686 },
8787 }),
8888 ginkgo .Entry ("converts legacy dual stack NATs" , natSync {
89- initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4CIDRStr , egressIP , legacyExtIDs ), getSNAT (nat2UUID , pod1V6CIDRStr , egressIP , legacyExtIDs )},
90- finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4CIDRStr , egressIP , pod1V4ExtIDs ), getSNAT (nat2UUID , pod1V6CIDRStr , egressIP , pod1V6ExtIDs )},
89+ initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4Str , egressIP , legacyExtIDs ), getSNAT (nat2UUID , pod1V6Str , egressIP , legacyExtIDs )},
90+ finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V4Str , egressIP , pod1V4ExtIDs ), getSNAT (nat2UUID , pod1V6Str , egressIP , pod1V6ExtIDs )},
9191 pods : podsNetInfo {
9292 {
93- []net.IP {pod1V4IPNet . IP , pod1V6IPNet . IP },
93+ []net.IP {pod1V4IP , pod1V6IP },
9494 pod1Namespace ,
9595 pod1Name ,
9696 },
9797 {
98- []net.IP {pod2V4IPNet . IP , pod2V6IPNet . IP },
98+ []net.IP {pod2V4IP , pod2V6IP },
9999 pod2Namespace ,
100100 pod2Name ,
101101 },
102102 },
103103 }),
104104 ginkgo .Entry ("doesn't alter NAT with correct external IDs" , natSync {
105- initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6CIDRStr , egressIP , pod1V6ExtIDs )},
106- finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6CIDRStr , egressIP , pod1V6ExtIDs )},
105+ initialNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6Str , egressIP , pod1V6ExtIDs )},
106+ finalNATs : []* nbdb.NAT {getSNAT (nat1UUID , pod1V6Str , egressIP , pod1V6ExtIDs )},
107107 pods : podsNetInfo {
108108 {
109- []net.IP {pod1V4IPNet . IP , pod1V6IPNet . IP },
109+ []net.IP {pod1V4IP , pod1V6IP },
110110 pod1Namespace ,
111111 pod1Name ,
112112 },
113113 {
114- []net.IP {pod2V4IPNet . IP , pod2V6IPNet . IP },
114+ []net.IP {pod2V4IP , pod2V6IP },
115115 pod2Namespace ,
116116 pod2Name ,
117117 },
0 commit comments