aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lcm/ns/ns_create.py17
-rw-r--r--lcm/ns/ns_delete.py4
-rw-r--r--lcm/ns/views.py5
-rw-r--r--lcm/ns/vnfs/create_vnfs.py2
-rw-r--r--lcm/ns/vnfs/terminate_nfs.py4
-rw-r--r--lcm/pub/msapi/aai.py47
-rw-r--r--pom.xml2
-rw-r--r--version.properties2
8 files changed, 67 insertions, 16 deletions
diff --git a/lcm/ns/ns_create.py b/lcm/ns/ns_create.py
index e5435816..26d0a7d8 100644
--- a/lcm/ns/ns_create.py
+++ b/lcm/ns/ns_create.py
@@ -26,8 +26,8 @@ logger = logging.getLogger(__name__)
class CreateNSService(object):
- def __init__(self, nsd_id, ns_name, description):
- self.nsd_id = nsd_id
+ def __init__(self, csar_id, ns_name, description):
+ self.csar_id = csar_id
self.ns_name = ns_name
self.description = description
self.ns_inst_id = ''
@@ -43,13 +43,14 @@ class CreateNSService(object):
return self.ns_inst_id
def check_nsd_valid(self):
- logger.debug("CreateNSService::check_nsd_valid::nsd_id=%s" % self.nsd_id)
- ns_package_info = query_nspackage_by_id(self.nsd_id)
+ logger.debug("CreateNSService::check_nsd_valid::csar_id=%s" % self.csar_id)
+ ns_package_info = query_nspackage_by_id(self.csar_id)
if not ns_package_info:
- raise NSLCMException("nsd(%s) not exists." % self.nsd_id)
+ raise NSLCMException("nsd(%s) not exists." % self.csar_id)
packageInfo = ns_package_info["packageInfo"]
self.ns_package_id = ignore_case_get(packageInfo, "nsPackageId")
- logger.debug("CreateNSService::check_nsd_valid::ns_package_id=%s" % self.ns_package_id)
+ self.nsd_id = ignore_case_get(packageInfo, "nsdId")
+ logger.debug("CreateNSService::check_nsd_valid::ns_package_id=%s,nsd_id=%s", self.ns_package_id, self.nsd_id)
def check_ns_inst_name_exist(self):
is_exist = NSInstModel.objects.filter(name=self.ns_name).exists()
@@ -74,13 +75,13 @@ class CreateNSService(object):
"service-subscriptions": {
"service-subscription": [
{
- "service-type": "service-type-" + self.ns_inst_id,
+ "service-type": "Network",
"service-instances": {
"service-instance": [
{
"service-instance-id": self.ns_inst_id,
"service-instance-name": self.ns_name,
- "service-type": "service-type-" + self.ns_inst_id,
+ "service-type": "Network",
"service-role": "service-role-" + self.ns_inst_id
}
]
diff --git a/lcm/ns/ns_delete.py b/lcm/ns/ns_delete.py
index 52b0df84..dde89d1a 100644
--- a/lcm/ns/ns_delete.py
+++ b/lcm/ns/ns_delete.py
@@ -62,5 +62,5 @@ class DeleteNsService(object):
if resp_data:
logger.debug("Fail to delete ns instance[%s] from aai, resp_status: [%s]." % (self.ns_inst_id, resp_status))
else:
- logger.debug(
- "Success to delete ns instance[%s] from aai, resp_status: [%s]." % (self.ns_inst_id, resp_status))
+ logger.debug("Success to delete ns instance[%s] from aai, resp_status: [%s]."
+ % (self.ns_inst_id, resp_status))
diff --git a/lcm/ns/views.py b/lcm/ns/views.py
index f7bb97a5..6d19263d 100644
--- a/lcm/ns/views.py
+++ b/lcm/ns/views.py
@@ -53,11 +53,12 @@ class CreateNSView(APIView):
logger.debug("Enter CreateNS: %s", request.data)
if ignore_case_get(request.data, 'test') == "test":
return Response(data={'nsInstanceId': "test"}, status=status.HTTP_201_CREATED)
- nsd_id = ignore_case_get(request.data, 'nsdId')
+ # nsd_id = ignore_case_get(request.data, 'nsdId')
+ csar_id = ignore_case_get(request.data, 'csarId')
ns_name = ignore_case_get(request.data, 'nsName')
description = ignore_case_get(request.data, 'description')
try:
- ns_inst_id = CreateNSService(nsd_id, ns_name, description).do_biz()
+ ns_inst_id = CreateNSService(csar_id, ns_name, description).do_biz()
except Exception as e:
logger.error("Exception in CreateNS: %s", e.message)
return Response(data={'error': e.message}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
diff --git a/lcm/ns/vnfs/create_vnfs.py b/lcm/ns/vnfs/create_vnfs.py
index caaefc2d..f7b94911 100644
--- a/lcm/ns/vnfs/create_vnfs.py
+++ b/lcm/ns/vnfs/create_vnfs.py
@@ -295,7 +295,7 @@ class CreateVnfs(Thread):
},
{
"relationship-key": "service-subscription.service-type",
- "relationship-value": "service-type-" + self.ns_inst_id
+ "relationship-value": "Network"
},
{
"relationship-key": "service-instance.service-instance-id",
diff --git a/lcm/ns/vnfs/terminate_nfs.py b/lcm/ns/vnfs/terminate_nfs.py
index c88e844e..d641debc 100644
--- a/lcm/ns/vnfs/terminate_nfs.py
+++ b/lcm/ns/vnfs/terminate_nfs.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 logging
import traceback
import json
@@ -142,7 +143,8 @@ class TerminateVnfs(threading.Thread):
# delete vnf instance from aai
resp_data, resp_status = delete_vnf_aai(self.vnf_inst_id, resource_version)
if resp_data:
- logger.debug("Fail to delete vnf instance[%s] from aai, resp_status: [%s]." % (self.vnf_inst_id, resp_status))
+ logger.debug("Fail to delete vnf instance[%s] from aai, resp_status: [%s]."
+ % (self.vnf_inst_id, resp_status))
else:
logger.debug(
"Success to delete vnf instance[%s] from aai, resp_status: [%s]." % (self.vnf_inst_id, resp_status))
diff --git a/lcm/pub/msapi/aai.py b/lcm/pub/msapi/aai.py
index bc3313c2..ec0bee93 100644
--- a/lcm/pub/msapi/aai.py
+++ b/lcm/pub/msapi/aai.py
@@ -246,3 +246,50 @@ def delete_vserver_relationship(cloud_owner, cloud_region_id, tenant_id, vserver
logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
raise NSLCMException("Delete vserver relationship exception in AAI")
return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def create_network_aai(network_id, data):
+ resource = "/network/l3-networks/l3-network/%s" % network_id
+ ret = call_aai(resource, "PUT", data)
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Network creation exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def query_network_aai(network_id):
+ resource = "/network/l3-networks/l3-network/%s" % network_id
+ ret = call_aai(resource, "GET")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Network query exception in AAI")
+ return json.JSONDecoder().decode(ret[1])
+
+
+def delete_network_aai(network_id, resource_version=""):
+ resource = "/network/l3-networks/l3-network/%s" % network_id
+ if resource_version:
+ resource = resource + "?resource-version=%s" % resource_version
+ ret = call_aai(resource, "DELETE")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Network delete exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def put_network_relationship(network_id, data):
+ resource = "/network/l3-networks/l3-network/%s/relationship-list/relationship" % network_id
+ ret = call_aai(resource, "PUT", data)
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Put or update network relationship exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]
+
+
+def delete_network_relationship(network_id):
+ resource = "/network/l3-networks/l3-network/%s/relationship-list/relationship" % network_id
+ ret = call_aai(resource, "DELETE")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise NSLCMException("Delete network relationship exception in AAI")
+ return json.JSONDecoder().decode(ret[1]), ret[2]
diff --git a/pom.xml b/pom.xml
index ac70d490..2d0612dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>0.1.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.vfc.nfvo.lcm</groupId>
diff --git a/version.properties b/version.properties
index 7f86aa15..51287873 100644
--- a/version.properties
+++ b/version.properties
@@ -3,7 +3,7 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=1
-minor=1
+minor=0
patch=0
base_version=${major}.${minor}.${patch}