@@ -5,6 +5,7 @@ package ipam
5
5
6
6
import (
7
7
"encoding/xml"
8
+ "errors"
8
9
"fmt"
9
10
"net"
10
11
"net/http"
@@ -26,6 +27,8 @@ const (
26
27
responseHeaderTimeout = 10
27
28
)
28
29
30
+ var errEmptyIPListRetrieved = errors .New ("ip list retrieved from azure host is empty" )
31
+
29
32
// Microsoft Azure IPAM configuration source.
30
33
type azureSource struct {
31
34
name string
@@ -115,6 +118,13 @@ func (s *azureSource) refresh() error {
115
118
return err
116
119
}
117
120
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
+
118
128
// For each interface...
119
129
for _ , i := range doc .Interface {
120
130
ifName := ""
@@ -142,6 +152,8 @@ func (s *azureSource) refresh() error {
142
152
continue
143
153
}
144
154
155
+ log .Printf ("[ipam] processing interface:%s IsPrimary:%t macAddress:%s ips:%d" , ifName , i .IsPrimary , i .MacAddress , len (i .IPSubnet ))
156
+
145
157
// For each subnet on the interface...
146
158
for _ , s := range i .IPSubnet {
147
159
_ , subnet , err := net .ParseCIDR (s .Prefix )
@@ -156,6 +168,7 @@ func (s *azureSource) refresh() error {
156
168
continue
157
169
}
158
170
171
+ log .Printf ("[ipam] Number of IPAddress found in ipsubnet %s: %d" , s .Prefix , len (s .IPAddress ))
159
172
addressCount := 0
160
173
// For each address in the subnet...
161
174
for _ , a := range s .IPAddress {
0 commit comments