summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2019-10-11 14:49:12 -0700
committerKiran Kamineni <kiran.k.kamineni@intel.com>2019-10-11 14:49:17 -0700
commite492a72a094cd4a54f96e47521578d0938d85d87 (patch)
tree3a565957f4a65d98b5e65309cf6906395423f6a7 /src
parent1b8bee840af30f67fcdc0d45ef9334f0461ca1c7 (diff)
Remove unused code
Remove unused code. This is part of the old legacy code and will anyway have to be re-implemented whenever the update functionality gets added. Issue-ID: MULTICLOUD-666 Change-Id: I02a91a2b221da9d82433f8c2ee1dd014a81e4f4d Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/k8splugin/api/instancehandler.go69
-rw-r--r--src/k8splugin/api/instancehandler_test.go58
2 files changed, 0 insertions, 127 deletions
diff --git a/src/k8splugin/api/instancehandler.go b/src/k8splugin/api/instancehandler.go
index be8e64fa..acbeb53f 100644
--- a/src/k8splugin/api/instancehandler.go
+++ b/src/k8splugin/api/instancehandler.go
@@ -144,72 +144,3 @@ func (i instanceHandler) deleteHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusAccepted)
}
-
-// // UpdateHandler method to update a VNF instance.
-// func UpdateHandler(w http.ResponseWriter, r *http.Request) {
-// vars := mux.Vars(r)
-// id := vars["vnfInstanceId"]
-
-// var resource UpdateVnfRequest
-
-// if r.Body == nil {
-// http.Error(w, "Body empty", http.StatusBadRequest)
-// return
-// }
-
-// err := json.NewDecoder(r.Body).Decode(&resource)
-// if err != nil {
-// http.Error(w, err.Error(), http.StatusUnprocessableEntity)
-// return
-// }
-
-// err = validateBody(resource)
-// if err != nil {
-// http.Error(w, err.Error(), http.StatusUnprocessableEntity)
-// return
-// }
-
-// kubeData, err := utils.ReadCSARFromFileSystem(resource.CsarID)
-
-// if kubeData.Deployment == nil {
-// werr := pkgerrors.Wrap(err, "Update VNF deployment error")
-// http.Error(w, werr.Error(), http.StatusInternalServerError)
-// return
-// }
-// kubeData.Deployment.SetUID(types.UID(id))
-
-// if err != nil {
-// werr := pkgerrors.Wrap(err, "Update VNF deployment information error")
-// http.Error(w, werr.Error(), http.StatusInternalServerError)
-// return
-// }
-
-// // (TODO): Read kubeconfig for specific Cloud Region from local file system
-// // if present or download it from AAI
-// s, err := NewVNFInstanceService("../kubeconfig/config")
-// if err != nil {
-// http.Error(w, err.Error(), http.StatusInternalServerError)
-// return
-// }
-
-// err = s.Client.UpdateDeployment(kubeData.Deployment, resource.Namespace)
-// if err != nil {
-// werr := pkgerrors.Wrap(err, "Update VNF error")
-
-// http.Error(w, werr.Error(), http.StatusInternalServerError)
-// return
-// }
-
-// resp := UpdateVnfResponse{
-// DeploymentID: id,
-// }
-
-// w.Header().Set("Content-Type", "application/json")
-// w.WriteHeader(http.StatusCreated)
-
-// err = json.NewEncoder(w).Encode(resp)
-// if err != nil {
-// werr := pkgerrors.Wrap(err, "Parsing output of new VNF error")
-// http.Error(w, werr.Error(), http.StatusInternalServerError)
-// }
-// }
diff --git a/src/k8splugin/api/instancehandler_test.go b/src/k8splugin/api/instancehandler_test.go
index 418054ec..b20575e7 100644
--- a/src/k8splugin/api/instancehandler_test.go
+++ b/src/k8splugin/api/instancehandler_test.go
@@ -488,61 +488,3 @@ func TestDeleteHandler(t *testing.T) {
})
}
}
-
-// TODO: Update this test when the UpdateVNF endpoint is fixed.
-/*
-func TestVNFInstanceUpdate(t *testing.T) {
- t.Run("Succesful update a VNF", func(t *testing.T) {
- payload := []byte(`{
- "cloud_region_id": "region1",
- "csar_id": "UUID-1",
- "oof_parameters": [{
- "key1": "value1",
- "key2": "value2",
- "key3": {}
- }],
- "network_parameters": {
- "oam_ip_address": {
- "connection_point": "string",
- "ip_address": "string",
- "workload_name": "string"
- }
- }
- }`)
- expected := &UpdateVnfResponse{
- DeploymentID: "1",
- }
-
- var result UpdateVnfResponse
-
- req := httptest.NewRequest("PUT", "/v1/vnf_instances/1", bytes.NewBuffer(payload))
-
- GetVNFClient = func(configPath string) (krd.VNFInstanceClientInterface, error) {
- return &mockClient{
- update: func() error {
- return nil
- },
- }, nil
- }
- utils.ReadCSARFromFileSystem = func(csarID string) (*krd.KubernetesData, error) {
- kubeData := &krd.KubernetesData{
- Deployment: &appsV1.Deployment{},
- Service: &coreV1.Service{},
- }
- return kubeData, nil
- }
-
- response := executeRequest(req)
- checkResponseCode(t, http.StatusCreated, response.Code)
-
- err := json.NewDecoder(response.Body).Decode(&result)
- if err != nil {
- t.Fatalf("TestVNFInstanceUpdate returned:\n result=%v\n expected=%v", err, expected.DeploymentID)
- }
-
- if resp.DeploymentID != expected.DeploymentID {
- t.Fatalf("TestVNFInstanceUpdate returned:\n result=%v\n expected=%v", resp.DeploymentID, expected.DeploymentID)
- }
- })
-}
-*/