@@ -2,7 +2,6 @@ package dataplane
22
33import (
44 "encoding/json"
5- "errors"
65 "fmt"
76 "strings"
87 "time"
@@ -12,6 +11,7 @@ import (
1211 "github.com/Azure/azure-container-networking/npm/util"
1312 npmerrors "github.com/Azure/azure-container-networking/npm/util/errors"
1413 "github.com/Microsoft/hcsshim/hcn"
14+ "github.com/pkg/errors"
1515 "k8s.io/klog"
1616)
1717
@@ -63,14 +63,14 @@ func (dp *DataPlane) initializeDataPlane() error {
6363 filterMap := map [string ]uint16 {"State" : hcnEndpointStateAttachedSharing }
6464 filterMapL1VH := map [string ]uint16 {"State" : hcnEndpointStateAttached }
6565
66- filter , err := marshalFilterMap (filterMap )
67-
68- filterL1VH , errL1VH := marshalFilterMap (filterMapL1VH )
69-
66+ filter , err := json .Marshal (filterMap )
7067 if err != nil {
71- return err
72- } else if errL1VH != nil {
73- return errL1VH
68+ return errors .Wrap (err , "failed to marshal endpoint filter map" )
69+ }
70+
71+ filterL1VH , errL1VH := json .Marshal (filterMapL1VH )
72+ if errL1VH != nil {
73+ return errors .Wrap (errL1VH , "failed to marshal endpoint filter map" )
7474 }
7575
7676 dp .endpointQuery .query .Filter = string (filter )
@@ -83,14 +83,6 @@ func (dp *DataPlane) initializeDataPlane() error {
8383 return nil
8484}
8585
86- func marshalFilterMap (filtermap map [string ]uint16 ) ([]byte , error ) {
87- filter , err := json .Marshal (filtermap )
88- if err != nil {
89- return nil , npmerrors .SimpleErrorWrapper ("failed to marshal endpoint filter map" , err )
90- }
91- return filter , nil
92- }
93-
9486func (dp * DataPlane ) getNetworkInfo () error {
9587 retryNumber := 0
9688 ticker := time .NewTicker (time .Second * time .Duration (maxNoNetSleepTime ))
0 commit comments