@@ -5,6 +5,7 @@ package ipam
55
66import (
77 "encoding/xml"
8+ "errors"
89 "fmt"
910 "net"
1011 "net/http"
@@ -26,6 +27,8 @@ const (
2627 responseHeaderTimeout = 10
2728)
2829
30+ var errEmptyIPListRetrieved = errors .New ("ip list retrieved from azure host is empty" )
31+
2932// Microsoft Azure IPAM configuration source.
3033type azureSource struct {
3134 name string
@@ -115,6 +118,13 @@ func (s *azureSource) refresh() error {
115118 return err
116119 }
117120
121+ log .Printf ("[ipam] xml name received:%v interfaces:%d" , doc .XMLName , len (doc .Interface ))
122+
123+ if len (doc .Interface ) == 0 {
124+ log .Errorf ("[ipam] ip list retrieved from azure host is empty, doc:%v" , doc )
125+ return errEmptyIPListRetrieved
126+ }
127+
118128 // For each interface...
119129 for _ , i := range doc .Interface {
120130 ifName := ""
@@ -142,6 +152,8 @@ func (s *azureSource) refresh() error {
142152 continue
143153 }
144154
155+ log .Printf ("[ipam] processing interface:%s IsPrimary:%t macAddress:%s ips:%d" , ifName , i .IsPrimary , i .MacAddress , len (i .IPSubnet ))
156+
145157 // For each subnet on the interface...
146158 for _ , s := range i .IPSubnet {
147159 _ , subnet , err := net .ParseCIDR (s .Prefix )
@@ -156,6 +168,7 @@ func (s *azureSource) refresh() error {
156168 continue
157169 }
158170
171+ log .Printf ("[ipam] Number of IPAddress found in ipsubnet %s: %d" , s .Prefix , len (s .IPAddress ))
159172 addressCount := 0
160173 // For each address in the subnet...
161174 for _ , a := range s .IPAddress {
0 commit comments