Skip to content

Commit 08987e8

Browse files
author
kkumar
committed
Refactored tests for ipv6
1 parent eb111e7 commit 08987e8

File tree

4 files changed

+198
-204
lines changed

4 files changed

+198
-204
lines changed

plugins/oob/k8s.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ func (k K8sClient) waitForCreation(ipamIP *ipamv1alpha1.IP) (*ipamv1alpha1.IP, e
320320
}
321321
}
322322
}
323-
return nil, errors.New("Timeout reached, IP not created")
323+
return ipamIP, errors.New("Timeout reached, IP not created")
324324
}
325325

326326
func (k K8sClient) getOOBNetworks(subnetType ipamv1alpha1.SubnetAddressType) []string {
@@ -359,11 +359,11 @@ func (k K8sClient) getMatchingSubnet(subnetName string, ipaddr net.IP) (*ipamv1a
359359
return nil, fmt.Errorf("failed to get subnet %s/%s: %w", k.Namespace, subnetName, err)
360360
}
361361
if apierrors.IsNotFound(err) {
362-
log.Debugf("Cannot select subnet %s/%s, does not exist", k.Namespace, subnetName)
362+
log.Infof("Cannot select subnet %s/%s, does not exist", k.Namespace, subnetName)
363363
return nil, nil
364364
}
365365
if !checkIPInCIDR(ipaddr, existingSubnet.Status.Reserved.String()) && ipaddr.String() != UNKNOWN_IP {
366-
log.Debugf("Cannot select subnet %s/%s, CIDR mismatch", k.Namespace, subnetName)
366+
log.Infof("Cannot select subnet %s/%s, CIDR mismatch", k.Namespace, subnetName)
367367
return nil, nil
368368
}
369369

plugins/oob/plugin.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func setup4(args ...string) (handler.Handler4, error) {
162162
func handler4(req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHCPv4, bool) {
163163
mac := req.ClientHWAddr
164164

165-
log.Debugf("received DHCPv4 packet: %s", req.Summary())
165+
log.Infof("received DHCPv4 packet: %s", req.Summary())
166166
log.Tracef("Message type: %s", req.MessageType().String())
167167

168168
var ipaddr net.IP
@@ -175,23 +175,23 @@ func handler4(req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHCPv4, bool) {
175175
// ack requested address
176176
exactIP = true
177177
ipaddr = clientIP
178-
log.Debugf("IP client: %v", ipaddr)
178+
log.Infof("IP client: %v", ipaddr)
179179
} else if requestedIP != nil {
180180
// ack requested address
181181
exactIP = true
182182
ipaddr = requestedIP
183-
log.Debugf("IP client: %v", ipaddr)
183+
log.Infof("IP client: %v", ipaddr)
184184
} else if serverIP != nil {
185185
// no client information, use server address for subnet detection
186186
exactIP = false
187187
ipaddr = serverIP
188-
log.Debugf("IP server: %v", ipaddr)
188+
log.Infof("IP server: %v", ipaddr)
189189
} else {
190190
ipaddr = net.ParseIP(UNKNOWN_IP)
191191
exactIP = false
192192
}
193193

194-
log.Debugf("IP: %v", ipaddr)
194+
log.Infof("IP: %v", ipaddr)
195195
leaseIP, err := k8sClient.getIp(ipaddr, mac, exactIP, ipamv1alpha1.CIPv4SubnetType)
196196
if err != nil {
197197
log.Errorf("Could not get IPAM IP: %s", err)
@@ -200,7 +200,7 @@ func handler4(req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHCPv4, bool) {
200200

201201
resp.YourIPAddr = leaseIP
202202

203-
log.Debugf("Sent DHCPv4 response: %s", resp.Summary())
203+
log.Infof("Sent DHCPv4 response: %s", resp.Summary())
204204

205205
return resp, false
206206
}

0 commit comments

Comments
 (0)