aboutsummaryrefslogtreecommitdiffstats
path: root/src/ncm/api/api.go
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2020-04-27 17:33:25 -0700
committerEric Multanen <eric.w.multanen@intel.com>2020-04-30 10:44:03 -0700
commit4100bfb764c40e2a788d28691b0f891e2ae86b74 (patch)
tree40ea142bf10236b53ca1479e99193094e06ce7c9 /src/ncm/api/api.go
parent7f6d2717e367c007ad836c39626c9eacc572f068 (diff)
Add API support for network chain intent
Adds API for managing Network Chain intents for composite applications. Issue-ID: MULTICLOUD-1029 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com> Change-Id: Ie3d4e8f1e3179397d86829d951e2bb877597b38d
Diffstat (limited to 'src/ncm/api/api.go')
-rw-r--r--src/ncm/api/api.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ncm/api/api.go b/src/ncm/api/api.go
index 2b105716..29ed46bd 100644
--- a/src/ncm/api/api.go
+++ b/src/ncm/api/api.go
@@ -72,6 +72,13 @@ func setClient(client, testClient interface{}) interface{} {
return c
}
}
+ case *moduleLib.ChainClient:
+ if testClient != nil && reflect.TypeOf(testClient).Implements(reflect.TypeOf((*moduleLib.ChainManager)(nil)).Elem()) {
+ c, ok := testClient.(moduleLib.ChainManager)
+ if ok {
+ return c
+ }
+ }
default:
fmt.Printf("unknown type %T\n", cl)
}
@@ -155,5 +162,14 @@ func NewRouter(testClient interface{}) *mux.Router {
router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/workload-intents/{workload-intent}/interfaces/{name}", workloadifintentHandler.getHandler).Methods("GET")
router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/workload-intents/{workload-intent}/interfaces/{name}", workloadifintentHandler.deleteHandler).Methods("DELETE")
+ chainHandler := chainHandler{
+ client: setClient(moduleClient.Chain, testClient).(moduleLib.ChainManager),
+ }
+ router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/network-chains", chainHandler.createHandler).Methods("POST")
+ router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/network-chains", chainHandler.getHandler).Methods("GET")
+ router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/network-chains/{name}", chainHandler.putHandler).Methods("PUT")
+ router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/network-chains/{name}", chainHandler.getHandler).Methods("GET")
+ router.HandleFunc("/projects/{project}/composite-apps/{composite-app-name}/{version}/network-controller-intent/{net-control-intent}/network-chains/{name}", chainHandler.deleteHandler).Methods("DELETE")
+
return router
}