@@ -25,7 +25,6 @@ import (
25
25
26
26
log "github.com/Sirupsen/logrus"
27
27
"github.com/contiv/contivmodel/client"
28
- "github.com/contiv/netplugin/drivers"
29
28
"github.com/contiv/netplugin/netmaster/docknet"
30
29
"github.com/contiv/netplugin/netmaster/intent"
31
30
"github.com/contiv/netplugin/netmaster/master"
@@ -148,7 +147,7 @@ func deleteEndpoint(hostname string) func(http.ResponseWriter, *http.Request) {
148
147
}
149
148
150
149
netID := netName + "." + tenantName
151
- _ , err = netdGetEndpoint (netID + "-" + delreq .EndpointID )
150
+ _ , err = utils . GetEndpoint (netID + "-" + delreq .EndpointID )
152
151
if err != nil {
153
152
httpError (w , "Could not find endpoint" , err )
154
153
return
@@ -232,7 +231,7 @@ func createEndpoint(hostname string) func(http.ResponseWriter, *http.Request) {
232
231
return
233
232
}
234
233
235
- ep , err := netdGetEndpoint (netID + "-" + cereq .EndpointID )
234
+ ep , err := utils . GetEndpoint (netID + "-" + cereq .EndpointID )
236
235
if err != nil {
237
236
httpError (w , "Could not find created endpoint" , err )
238
237
return
@@ -310,13 +309,13 @@ func join(w http.ResponseWriter, r *http.Request) {
310
309
}
311
310
312
311
netID := netName + "." + tenantName
313
- ep , err := netdGetEndpoint (netID + "-" + jr .EndpointID )
312
+ ep , err := utils . GetEndpoint (netID + "-" + jr .EndpointID )
314
313
if err != nil {
315
314
httpError (w , "Could not find created endpoint" , err )
316
315
return
317
316
}
318
317
319
- nw , err := netdGetNetwork (netID )
318
+ nw , err := utils . GetNetwork (netID )
320
319
if err != nil {
321
320
httpError (w , "Could not get network" , err )
322
321
return
@@ -530,41 +529,6 @@ func discoverDelete(w http.ResponseWriter, r *http.Request) {
530
529
w .Write (content )
531
530
}
532
531
533
- func netdGetEndpoint (epID string ) (* drivers.OperEndpointState , error ) {
534
- // Get hold of the state driver
535
- stateDriver , err := utils .GetStateDriver ()
536
- if err != nil {
537
- return nil , err
538
- }
539
-
540
- operEp := & drivers.OperEndpointState {}
541
- operEp .StateDriver = stateDriver
542
- err = operEp .Read (epID )
543
- if err != nil {
544
- return nil , err
545
- }
546
-
547
- return operEp , nil
548
- }
549
-
550
- func netdGetNetwork (networkID string ) (* mastercfg.CfgNetworkState , error ) {
551
- // Get hold of the state driver
552
- stateDriver , err := utils .GetStateDriver ()
553
- if err != nil {
554
- return nil , err
555
- }
556
-
557
- // find the network from network id
558
- nwCfg := & mastercfg.CfgNetworkState {}
559
- nwCfg .StateDriver = stateDriver
560
- err = nwCfg .Read (networkID )
561
- if err != nil {
562
- return nil , err
563
- }
564
-
565
- return nwCfg , nil
566
- }
567
-
568
532
// GetDockerNetworkName gets network name from network UUID
569
533
func GetDockerNetworkName (nwID string ) (string , string , string , error ) {
570
534
// first see if we can find the network in docknet oper state
@@ -781,7 +745,7 @@ func createNetworkHelper(networkID string, tag string, IPv4Data, IPv6Data []driv
781
745
// deleteNetworkHelper removes the association between docker network and contiv network
782
746
func deleteNetworkHelper (networkID string ) error {
783
747
netID := networkID + ".default"
784
- _ , err := netdGetNetwork (netID )
748
+ _ , err := utils . GetNetwork (netID )
785
749
if err == nil {
786
750
// if we find a contiv network with the ID hash, then it must be
787
751
// a docker created network (from the libnetwork create api).
0 commit comments