summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-02 11:01:46 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-09-02 11:01:46 +0800
commite1a495b59a429486b3e5566bec86895cbbee9bbe (patch)
tree64326ada9d43b9fc5cd560e8ccfa0afc33d88645
parente4f53709988ef82a4afbb53bc34200755eb4a33b (diff)
Update report resoure code and other files
Change-Id: Iffc2f50bf93510a25ec00346723001ba9754766b Issue-Id: VFC-238 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rwxr-xr-xlcm/initialize.sh1
-rw-r--r--lcm/lcm/pub/aaiapi/aai.py49
-rw-r--r--lcm/lcm/pub/config/config.py1
-rw-r--r--lcm/lcm/pub/database/models.py1
-rw-r--r--lcm/lcm/pub/msapi/gvnfmdriver.py1
-rw-r--r--lcm/lcm/pub/utils/restcall.py2
-rw-r--r--lcm/lcm/pub/utils/toscautil_new.py4
-rw-r--r--lcm/lcm/pub/utils/values.py2
-rw-r--r--lcm/lcm/samples/resources.py1
-rwxr-xr-xlcm/run.sh1
-rwxr-xr-xlcm/stop.sh1
-rw-r--r--lcm/version.properties15
12 files changed, 46 insertions, 33 deletions
diff --git a/lcm/initialize.sh b/lcm/initialize.sh
index 7ace3828..3425019b 100755
--- a/lcm/initialize.sh
+++ b/lcm/initialize.sh
@@ -12,4 +12,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
pip install -r requirements.txt
diff --git a/lcm/lcm/pub/aaiapi/aai.py b/lcm/lcm/pub/aaiapi/aai.py
index 632e4f37..698b7c52 100644
--- a/lcm/lcm/pub/aaiapi/aai.py
+++ b/lcm/lcm/pub/aaiapi/aai.py
@@ -24,34 +24,34 @@ logger = logging.getLogger(__name__)
def call_aai(resource, method, data=''):
return call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, method, data)
+
def create_ns(global_customer_id, service_type, service_instance_id, data):
resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \
"%s/service-instances/service-instance/%s" % \
(global_customer_id, service_type, service_instance_id)
ret = call_aai(resource, "PUT", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Ns instance creation exception in AAI")
return json.JSONDecoder().decode(ret[1])
-def delete_ns(global_customer_id, service_type, service_instance_id, data):
+
+def delete_ns(global_customer_id, service_type, service_instance_id):
resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \
"%s/service-instances/service-instance/%s" % \
(global_customer_id, service_type, service_instance_id)
- ret = call_aai(resource, "DELETE", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)
+ ret = call_aai(resource, "DELETE")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Ns instance delete exception in AAI")
return json.JSONDecoder().decode(ret[1])
+
def query_ns(global_customer_id, service_type, service_instance_id, data):
resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \
"%s/service-instances/service-instance/%s" % \
(global_customer_id, service_type, service_instance_id)
ret = call_aai(resource, "GET", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "GET", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Ns instance query exception in AAI")
@@ -61,25 +61,24 @@ def query_ns(global_customer_id, service_type, service_instance_id, data):
def create_vnf(vnf_id, data):
resource = "/network/generic-vnfs/generic-vnf/%s" % vnf_id
ret = call_aai(resource, "PUT", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vnf instance creation exception in AAI")
return json.JSONDecoder().decode(ret[1])
-def delete_vnf(vnf_id, data=[]):
+
+def delete_vnf(vnf_id):
resource = "/network/generic-vnfs/generic-vnf/%s" % vnf_id
- ret = call_aai(resource, "DELETE", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)
+ ret = call_aai(resource, "DELETE")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vnf instance delete exception in AAI")
return json.JSONDecoder().decode(ret[1])
+
def query_vnf(vnf_id, data):
resource = "/network/generic-vnfs/generic-vnf/%s" % vnf_id
ret = call_aai(resource, "GET", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "GET", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vnf instance query exception in AAI")
@@ -91,29 +90,28 @@ def create_vserver(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
"%s/tenants/tenant/%s/vservers/vserver/%s" % \
(cloud_owner, cloud_region_id, tenant_id, vserver_id)
ret = call_aai(resource, "PUT", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vserver creation exception in AAI")
return json.JSONDecoder().decode(ret[1])
-def delete_vserver(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
+
+def delete_vserver(cloud_owner, cloud_region_id, tenant_id, vserver_id):
resource = "/cloud-infrastructure/cloud-regions/cloud-region/%s/" \
"%s/tenants/tenant/%s/vservers/vserver/%s" % \
(cloud_owner, cloud_region_id, tenant_id, vserver_id)
- ret = call_aai(resource, "DELETE", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)
+ ret = call_aai(resource, "DELETE")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vserver delete exception in AAI")
return json.JSONDecoder().decode(ret[1])
+
def query_vserver(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
resource = "/cloud-infrastructure/cloud-regions/cloud-region/%s/" \
"%s/tenants/tenant/%s/vservers/vserver/%s" % \
(cloud_owner, cloud_region_id, tenant_id, vserver_id)
ret = call_aai(resource, "GET", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "GET", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Vserver query exception in AAI")
@@ -125,18 +123,17 @@ def put_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver_id
"%s/tenants/tenant/%s/vservers/vserver/%s/relationship-list/relationship" % \
(cloud_owner, cloud_region_id, tenant_id, vserver_id)
ret = call_aai(resource, "PUT", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Put or update vserver relationship exception in AAI")
return json.JSONDecoder().decode(ret[1])
-def delete_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver_id, data):
+
+def delete_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver_id):
resource = "/cloud-infrastructure/cloud-regions/cloud-region/%s/" \
"%s/tenants/tenant/%s/vservers/vserver/%s/relationship-list/relationship" % \
(cloud_owner, cloud_region_id, tenant_id, vserver_id)
- ret = call_aai(resource, "DELETE", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)
+ ret = call_aai(resource, "DELETE")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Delete vserver relationship exception in AAI")
@@ -146,16 +143,15 @@ def delete_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver
def put_vnf_relationship(vnf_id, data):
resource = "/network/generic-vnfs/generic-vnf/%s/relationship-list/relationship" % vnf_id
ret = call_aai(resource, "PUT", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Put or update vnf instance relationship exception in AAI")
return json.JSONDecoder().decode(ret[1])
-def delete_vnf_relationship(vnf_id, data):
+
+def delete_vnf_relationship(vnf_id):
resource = "/network/generic-vnfs/generic-vnf/%s/relationship-list/relationship" % vnf_id
- ret = call_aai(resource, "DELETE", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)
+ ret = call_aai(resource, "DELETE")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Delete vnf instance relationship exception in AAI")
@@ -167,18 +163,17 @@ def put_ns_relationship(global_customer_id, service_type, service_instance_id, d
"%s/service-instances/service-instance/%s/relationship-list/relationship" % \
(global_customer_id, service_type, service_instance_id)
ret = call_aai(resource, "PUT", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "PUT", data)
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Put or update ns instance relationship exception in AAI")
return json.JSONDecoder().decode(ret[1])
-def delete_ns_relationship(global_customer_id, service_type, service_instance_id, data):
+
+def delete_ns_relationship(global_customer_id, service_type, service_instance_id):
resource = "/business/customers/customer/%s/service-subscriptions/service-subscription/" \
"%s/service-instances/service-instance/%s/relationship-list/relationship" % \
(global_customer_id, service_type, service_instance_id)
- ret = call_aai(resource, "DELETE", data)
- # ret = call_req_aai(AAI_BASE_URL, AAI_USER, AAI_PASSWORD, rest_no_auth, resource, "DELETE", data)
+ ret = call_aai(resource, "DELETE")
if ret[0] != 0:
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NFLCMException("Delete ns instance relationship exception in AAI")
diff --git a/lcm/lcm/pub/config/config.py b/lcm/lcm/pub/config/config.py
index 492595df..650d6755 100644
--- a/lcm/lcm/pub/config/config.py
+++ b/lcm/lcm/pub/config/config.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
import os
# [MSB]
diff --git a/lcm/lcm/pub/database/models.py b/lcm/lcm/pub/database/models.py
index 826ba748..e46f7af9 100644
--- a/lcm/lcm/pub/database/models.py
+++ b/lcm/lcm/pub/database/models.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
from django.db import models
diff --git a/lcm/lcm/pub/msapi/gvnfmdriver.py b/lcm/lcm/pub/msapi/gvnfmdriver.py
index a09cb2a0..8449f6d3 100644
--- a/lcm/lcm/pub/msapi/gvnfmdriver.py
+++ b/lcm/lcm/pub/msapi/gvnfmdriver.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
import json
import logging
diff --git a/lcm/lcm/pub/utils/restcall.py b/lcm/lcm/pub/utils/restcall.py
index c13d07a6..89c4d224 100644
--- a/lcm/lcm/pub/utils/restcall.py
+++ b/lcm/lcm/pub/utils/restcall.py
@@ -141,4 +141,4 @@ def call_req_aai(base_url, user, passwd, auth_type, resource, method, content=''
ret = [4, str(sys.exc_info()), resp_status]
logger.debug("[%s]ret=%s" % (callid, str(ret)))
- return ret \ No newline at end of file
+ return ret
diff --git a/lcm/lcm/pub/utils/toscautil_new.py b/lcm/lcm/pub/utils/toscautil_new.py
index 90ce5fef..279fb09b 100644
--- a/lcm/lcm/pub/utils/toscautil_new.py
+++ b/lcm/lcm/pub/utils/toscautil_new.py
@@ -1450,7 +1450,3 @@ if __name__ == '__main__':
}
})
print convert_vnfd_model(src_json)
-
-
-
-
diff --git a/lcm/lcm/pub/utils/values.py b/lcm/lcm/pub/utils/values.py
index 4b7855c0..00cf5899 100644
--- a/lcm/lcm/pub/utils/values.py
+++ b/lcm/lcm/pub/utils/values.py
@@ -33,4 +33,4 @@ def get_boolean(val, def_val=0):
return 1 if val else 0
def get_integer(val, def_val=0):
- return val if val else 0 \ No newline at end of file
+ return val if val else 0
diff --git a/lcm/lcm/samples/resources.py b/lcm/lcm/samples/resources.py
index c873b117..2a4fa4ec 100644
--- a/lcm/lcm/samples/resources.py
+++ b/lcm/lcm/samples/resources.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
import json
import logging
import threading
diff --git a/lcm/run.sh b/lcm/run.sh
index eb8a6f46..dbe11e95 100755
--- a/lcm/run.sh
+++ b/lcm/run.sh
@@ -12,4 +12,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
nohup python manage.py runserver 127.0.0.1:8801 > /dev/null &
diff --git a/lcm/stop.sh b/lcm/stop.sh
index 6f9ff21f..db87c64d 100755
--- a/lcm/stop.sh
+++ b/lcm/stop.sh
@@ -12,4 +12,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
ps auxww | grep 'manage.py runserver 127.0.0.1:8801' | awk '{print $2}' | xargs kill -9
diff --git a/lcm/version.properties b/lcm/version.properties
index 7f86aa15..d7c69cd5 100644
--- a/lcm/version.properties
+++ b/lcm/version.properties
@@ -1,3 +1,18 @@
+#!/bin/bash
+# Copyright 2017 ZTE Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
# Versioning variables
# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... )
# because they are used in Jenkins, whose plug-in doesn't support