summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2017-02-03 15:52:26 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2017-02-07 22:53:49 +0800
commitba64ce23c5572b0de5e5596a479d9090115009e4 (patch)
treea3e4549ed0473e386083e771840b5c1105c4dbaf
parent38a7066543a27c613a7d5ad85395a4bd4d7e7318 (diff)
Add code framework of gvnfm-vnflcm
Change-Id: I67e7499293613ad001c73193b4b59536fc087657 Issure-Id: GVNFM-23 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--lcm/README.md15
-rw-r--r--lcm/assembly.xml51
-rw-r--r--lcm/initialize.sh15
-rw-r--r--lcm/lcm/__init__.py13
-rw-r--r--lcm/lcm/pub/__init__.py13
-rw-r--r--lcm/lcm/pub/config/__init__.py13
-rw-r--r--lcm/lcm/pub/config/config.py46
-rw-r--r--lcm/lcm/pub/database/__init__.py13
-rw-r--r--lcm/lcm/pub/database/models.py23
-rw-r--r--lcm/lcm/pub/exceptions.py17
-rw-r--r--lcm/lcm/pub/msapi/__init__.py13
-rw-r--r--lcm/lcm/pub/utils/__init__.py13
-rw-r--r--lcm/lcm/pub/utils/enumutil.py16
-rw-r--r--lcm/lcm/pub/utils/fileutil.py53
-rw-r--r--lcm/lcm/pub/utils/idutil.py21
-rw-r--r--lcm/lcm/pub/utils/jobutil.py140
-rw-r--r--lcm/lcm/pub/utils/restcall.py95
-rw-r--r--lcm/lcm/pub/utils/share_lock.py78
-rw-r--r--lcm/lcm/pub/utils/syscomm.py19
-rw-r--r--lcm/lcm/pub/utils/timeutil.py19
-rw-r--r--lcm/lcm/pub/utils/toscautil.py2606
-rw-r--r--lcm/lcm/pub/utils/values.py24
-rw-r--r--lcm/lcm/samples/__init__.py13
-rw-r--r--lcm/lcm/samples/tests.py32
-rw-r--r--lcm/lcm/samples/urls.py19
-rw-r--r--lcm/lcm/samples/views.py29
-rw-r--r--lcm/lcm/settings.py144
-rw-r--r--lcm/lcm/urls.py26
-rw-r--r--lcm/lcm/wsgi.py22
-rw-r--r--lcm/logs/empty.txt0
-rw-r--r--lcm/manage.py22
-rw-r--r--lcm/pom.xml51
-rw-r--r--lcm/requirements.txt21
-rw-r--r--lcm/run.sh15
-rw-r--r--lcm/stop.sh15
-rw-r--r--lcm/tox.ini10
36 files changed, 3735 insertions, 0 deletions
diff --git a/lcm/README.md b/lcm/README.md
new file mode 100644
index 00000000..65717d61
--- /dev/null
+++ b/lcm/README.md
@@ -0,0 +1,15 @@
+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.
+
+Micro service of vnf life cycle management.
diff --git a/lcm/assembly.xml b/lcm/assembly.xml
new file mode 100644
index 00000000..08fffa0f
--- /dev/null
+++ b/lcm/assembly.xml
@@ -0,0 +1,51 @@
+<!--
+ 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.
+-->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>lcm</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>lcm</directory>
+ <outputDirectory>/lcm</outputDirectory>
+ <includes>
+ <include>**/*.py</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>logs</directory>
+ <outputDirectory>/logs</outputDirectory>
+ <includes>
+ <include>*.txt</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>*.py</include>
+ <include>*.txt</include>
+ <include>*.sh</include>
+ <include>*.ini</include>
+ <include>*.md</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <baseDirectory>gvnfm/lcm</baseDirectory>
+</assembly>
diff --git a/lcm/initialize.sh b/lcm/initialize.sh
new file mode 100644
index 00000000..7ace3828
--- /dev/null
+++ b/lcm/initialize.sh
@@ -0,0 +1,15 @@
+#!/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.
+pip install -r requirements.txt
diff --git a/lcm/lcm/__init__.py b/lcm/lcm/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/pub/__init__.py b/lcm/lcm/pub/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/pub/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/pub/config/__init__.py b/lcm/lcm/pub/config/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/pub/config/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/pub/config/config.py b/lcm/lcm/pub/config/config.py
new file mode 100644
index 00000000..f603178b
--- /dev/null
+++ b/lcm/lcm/pub/config/config.py
@@ -0,0 +1,46 @@
+# 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.
+import os
+
+# [MSB]
+MSB_SERVICE_IP = '127.0.0.1'
+MSB_SERVICE_PORT = '10080'
+
+# [REDIS]
+REDIS_HOST = '127.0.0.1'
+REDIS_PORT = '6379'
+REDIS_PASSWD = ''
+
+# [mysql]
+DB_IP = "127.0.0.1"
+DB_PORT = 3306
+DB_NAME = "gvnfm"
+DB_USER = "gvnfm"
+DB_PASSWD = "gvnfm"
+
+# [register]
+REG_TO_MSB_WHEN_START = True
+REG_TO_MSB_REG_URL = "/openoapi/microservices/v1/services"
+REG_TO_MSB_REG_PARAM = {
+ "serviceName": "vnflcm",
+ "version": "v1",
+ "url": "/openoapi/vnflcm/v1",
+ "protocol": "REST",
+ "visualRange": "1",
+ "nodes": [{
+ "ip": "127.0.0.1",
+ "port": "8703",
+ "ttl": 0
+ }]
+}
diff --git a/lcm/lcm/pub/database/__init__.py b/lcm/lcm/pub/database/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/pub/database/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/pub/database/models.py b/lcm/lcm/pub/database/models.py
new file mode 100644
index 00000000..91bec30a
--- /dev/null
+++ b/lcm/lcm/pub/database/models.py
@@ -0,0 +1,23 @@
+# 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.
+from django.db import models
+
+
+class VnfInstModel(models.Model):
+ class Meta:
+ db_table = 'GVNFM_VNFINST'
+
+ id = models.CharField(db_column='ID', primary_key=True, max_length=200)
+
+
diff --git a/lcm/lcm/pub/exceptions.py b/lcm/lcm/pub/exceptions.py
new file mode 100644
index 00000000..e06632c7
--- /dev/null
+++ b/lcm/lcm/pub/exceptions.py
@@ -0,0 +1,17 @@
+# 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.
+
+
+class NSLCMException(Exception):
+ pass
diff --git a/lcm/lcm/pub/msapi/__init__.py b/lcm/lcm/pub/msapi/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/pub/msapi/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/pub/utils/__init__.py b/lcm/lcm/pub/utils/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/pub/utils/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/pub/utils/enumutil.py b/lcm/lcm/pub/utils/enumutil.py
new file mode 100644
index 00000000..9656f7de
--- /dev/null
+++ b/lcm/lcm/pub/utils/enumutil.py
@@ -0,0 +1,16 @@
+# 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.
+
+def enum(**enums):
+ return type('Enum', (), enums)
diff --git a/lcm/lcm/pub/utils/fileutil.py b/lcm/lcm/pub/utils/fileutil.py
new file mode 100644
index 00000000..e99b9d47
--- /dev/null
+++ b/lcm/lcm/pub/utils/fileutil.py
@@ -0,0 +1,53 @@
+# 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.
+
+import os
+import shutil
+import logging
+import traceback
+import urllib2
+
+logger = logging.getLogger(__name__)
+
+
+def make_dirs(path):
+ if not os.path.exists(path):
+ os.makedirs(path, 0777)
+
+
+def delete_dirs(path):
+ try:
+ if os.path.exists(path):
+ shutil.rmtree(path)
+ except Exception as e:
+ logger.error(traceback.format_exc())
+ logger.error("Failed to delete %s:%s", path, e.message)
+
+
+def download_file_from_http(url, local_dir, file_name):
+ local_file_name = os.path.join(local_dir, file_name)
+ is_download_ok = False
+ try:
+ make_dirs(local_dir)
+ r = urllib2.Request(url)
+ req = urllib2.urlopen(r)
+ save_file = open(local_file_name, 'wb')
+ save_file.write(req.read())
+ save_file.close()
+ req.close()
+ is_download_ok = True
+ except:
+ logger.error(traceback.format_exc())
+ logger.error("Failed to download %s to %s.", url, local_file_name)
+ return is_download_ok, local_file_name
diff --git a/lcm/lcm/pub/utils/idutil.py b/lcm/lcm/pub/utils/idutil.py
new file mode 100644
index 00000000..16b5b763
--- /dev/null
+++ b/lcm/lcm/pub/utils/idutil.py
@@ -0,0 +1,21 @@
+# 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.
+
+from redisco import containers as cont
+
+
+def get_auto_id(id_type, id_group="auto_id_hash"):
+ auto_id_hash = cont.Hash(id_group)
+ auto_id_hash.hincrby(id_type, 1)
+ return auto_id_hash.hget(id_type)
diff --git a/lcm/lcm/pub/utils/jobutil.py b/lcm/lcm/pub/utils/jobutil.py
new file mode 100644
index 00000000..3efc4635
--- /dev/null
+++ b/lcm/lcm/pub/utils/jobutil.py
@@ -0,0 +1,140 @@
+# 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.
+
+import datetime
+import logging
+import uuid
+import traceback
+
+from lcm.pub.database.models import JobStatusModel, JobModel
+from lcm.pub.utils import idutil
+
+logger = logging.getLogger(__name__)
+
+
+def enum(**enums):
+ return type('Enum', (), enums)
+
+
+JOB_STATUS = enum(PROCESSING=0, FINISH=1)
+JOB_MODEL_STATUS = enum(STARTED='started', PROCESSING='processing', FINISHED='finished', ERROR='error',
+ TIMEOUT='timeout')
+JOB_TYPE = enum(CREATE_VNF="create vnf", TERMINATE_VNF="terminate vnf", GRANT_VNF="grant vnf")
+
+
+class JobUtil(object):
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def __gen_job_id(job_name):
+ return "%s-%s" % (job_name if job_name else "UnknownJob", uuid.uuid1())
+
+ @staticmethod
+ def query_job_status(job_id, index_id=-1):
+ #logger.info("Query job status, jobid =[%s], responseid [%d]" % (job_id, index_id))
+ jobs = []
+ if index_id < 0:
+ row = JobStatusModel.objects.filter(jobid=job_id).order_by("-indexid").first()
+ if row:
+ jobs.append(row)
+ else:
+ [jobs.append(job) for job in JobStatusModel.objects.filter(jobid=job_id).order_by("-indexid")
+ if job.indexid > index_id]
+
+ #logger.info("Query job status, rows=%s" % str(jobs))
+ return jobs
+
+ @staticmethod
+ def is_job_exists(job_id):
+ jobs = JobModel.objects.filter(jobid=job_id)
+ return len(jobs) > 0
+
+ @staticmethod
+ def create_job(inst_type, jobaction, inst_id, user='', job_id=None, res_name=''):
+ if job_id is None:
+ job_id = JobUtil.__gen_job_id(
+ '%s-%s-%s' % (str(inst_type).replace(' ', '_'), str(jobaction).replace(' ', '_'), str(inst_id)))
+ job = JobModel()
+ job.jobid = job_id
+ job.jobtype = inst_type
+ job.jobaction = jobaction
+ job.resid = str(inst_id)
+ job.status = JOB_STATUS.PROCESSING
+ job.user = user
+ job.starttime = datetime.datetime.now().strftime('%Y-%m-%d %X')
+ job.progress = 0
+ job.resname = res_name
+ logger.debug("create a new job, jobid=%s, jobtype=%s, jobaction=%s, resid=%s, status=%d" %
+ (job.jobid, job.jobtype, job.jobaction, job.resid, job.status))
+ job.save()
+ return job_id
+
+ @staticmethod
+ def clear_job(job_id):
+ [job.delete() for job in JobModel.objects.filter(jobid=job_id)]
+ logger.debug("Clear job, job_id=%s" % job_id)
+
+ @staticmethod
+ def add_job_status(job_id, progress, status_decs, error_code=""):
+ jobs = JobModel.objects.filter(jobid=job_id)
+ if not jobs:
+ logger.error("Job[%s] is not exists, please create job first." % job_id)
+ raise Exception("Job[%s] is not exists." % job_id)
+ try:
+ int_progress = int(progress)
+ job_status = JobStatusModel()
+ job_status.indexid = int(idutil.get_auto_id(job_id))
+ job_status.jobid = job_id
+ job_status.status = "processing"
+ job_status.progress = int_progress
+
+ if job_status.progress == 0:
+ job_status.status = "started"
+ elif job_status.progress == 100:
+ job_status.status = "finished"
+ elif job_status.progress == 101:
+ job_status.status = "partly_finished"
+ elif job_status.progress > 101:
+ job_status.status = "error"
+
+ job_status.descp = status_decs
+ job_status.errcode = error_code
+ job_status.addtime = datetime.datetime.now().strftime('%Y-%m-%d %X')
+ job_status.save()
+ logger.debug("Add a new job status, jobid=%s, indexid=%d,"
+ " status=%s, description=%s, progress=%d, errcode=%s, addtime=%r" %
+ (job_status.jobid, job_status.indexid, job_status.status, job_status.descp,
+ job_status.progress, job_status.errcode, job_status.addtime))
+
+ job = jobs[0]
+ job.progress = int_progress
+ if job_status.progress >= 100:
+ job.status = JOB_STATUS.FINISH
+ job.endtime = datetime.datetime.now().strftime('%Y-%m-%d %X')
+ job.save()
+ logger.debug("update job, jobid=%s, progress=%d" % (job_status.jobid, int_progress))
+ except:
+ logger.error(traceback.format_exc())
+
+ @staticmethod
+ def clear_job_status(job_id):
+ [job.delete() for job in JobStatusModel.objects.filter(jobid=job_id)]
+ logger.debug("Clear job status, job_id=%s" % job_id)
+
+ @staticmethod
+ def get_unfinished_jobs(url_prefix, inst_id, inst_type):
+ jobs = JobModel.objects.filter(resid=inst_id, jobtype=inst_type, status=JOB_STATUS.PROCESSING)
+ progresses = reduce(lambda content, job: content + [url_prefix + "/" + job.jobid], jobs, [])
+ return progresses
diff --git a/lcm/lcm/pub/utils/restcall.py b/lcm/lcm/pub/utils/restcall.py
new file mode 100644
index 00000000..663f16cb
--- /dev/null
+++ b/lcm/lcm/pub/utils/restcall.py
@@ -0,0 +1,95 @@
+# 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.
+
+import sys
+import traceback
+import logging
+import urllib2
+import uuid
+import httplib2
+
+from lcm.pub.config.config import MSB_SERVICE_IP, MSB_SERVICE_PORT
+
+rest_no_auth, rest_oneway_auth, rest_bothway_auth = 0, 1, 2
+HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED = '200', '201', '204', '202'
+status_ok_list = [HTTP_200_OK, HTTP_201_CREATED, HTTP_204_NO_CONTENT, HTTP_202_ACCEPTED]
+HTTP_404_NOTFOUND, HTTP_403_FORBIDDEN, HTTP_401_UNAUTHORIZED, HTTP_400_BADREQUEST = '404', '403', '401', '400'
+
+logger = logging.getLogger(__name__)
+
+
+def call_req(base_url, user, passwd, auth_type, resource, method, content=''):
+ callid = str(uuid.uuid1())
+ logger.debug("[%s]call_req('%s','%s','%s',%s,'%s','%s','%s')" % (
+ callid, base_url, user, passwd, auth_type, resource, method, content))
+ ret = None
+ resp_status = ''
+ try:
+ full_url = combine_url(base_url, resource)
+ headers = {'content-type': 'application/json', 'accept': 'application/json'}
+ if user:
+ headers['Authorization'] = 'Basic ' + ('%s:%s' % (user, passwd)).encode("base64")
+ ca_certs = None
+ for retry_times in range(3):
+ http = httplib2.Http(ca_certs=ca_certs, disable_ssl_certificate_validation=(auth_type == rest_no_auth))
+ http.follow_all_redirects = True
+ try:
+ resp, resp_content = http.request(full_url, method=method.upper(), body=content, headers=headers)
+ resp_status, resp_body = resp['status'], resp_content.decode('UTF-8')
+ logger.debug("[%s][%d]status=%s,resp_body=%s)" % (callid, retry_times, resp_status, resp_body))
+ if resp_status in status_ok_list:
+ ret = [0, resp_body, resp_status]
+ else:
+ ret = [1, resp_body, resp_status]
+ break
+ except Exception as ex:
+ if 'httplib.ResponseNotReady' in str(sys.exc_info()):
+ logger.debug("retry_times=%d", retry_times)
+ logger.error(traceback.format_exc())
+ ret = [1, "Unable to connect to %s" % full_url, resp_status]
+ continue
+ raise ex
+ except urllib2.URLError as err:
+ ret = [2, str(err), resp_status]
+ except Exception as ex:
+ logger.error(traceback.format_exc())
+ logger.error("[%s]ret=%s" % (callid, str(sys.exc_info())))
+ res_info = str(sys.exc_info())
+ if 'httplib.ResponseNotReady' in res_info:
+ res_info = "The URL[%s] request failed or is not responding." % full_url
+ ret = [3, res_info, resp_status]
+ except:
+ logger.error(traceback.format_exc())
+ ret = [4, str(sys.exc_info()), resp_status]
+
+ logger.debug("[%s]ret=%s" % (callid, str(ret)))
+ return ret
+
+
+def req_by_msb(resource, method, content=''):
+ base_url = "http://%s:%s/" % (MSB_SERVICE_IP, MSB_SERVICE_PORT)
+ return call_req(base_url, "", "", rest_no_auth, resource, method, content)
+
+
+def combine_url(base_url, resource):
+ full_url = None
+ if base_url.endswith('/') and resource.startswith('/'):
+ full_url = base_url[:-1] + resource
+ elif base_url.endswith('/') and not resource.startswith('/'):
+ full_url = base_url + resource
+ elif not base_url.endswith('/') and resource.startswith('/'):
+ full_url = base_url + resource
+ else:
+ full_url = base_url + '/' + resource
+ return full_url
diff --git a/lcm/lcm/pub/utils/share_lock.py b/lcm/lcm/pub/utils/share_lock.py
new file mode 100644
index 00000000..cb0e38c4
--- /dev/null
+++ b/lcm/lcm/pub/utils/share_lock.py
@@ -0,0 +1,78 @@
+# 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.
+
+import time
+
+import redis
+
+from lcm.pub.config.config import REDIS_HOST, REDIS_PORT, REDIS_PASSWD
+
+
+class SharedLock:
+ def __init__(self, lock_key, host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWD, db=9, lock_timeout=5 * 60):
+ self.lock_key = lock_key
+ self.lock_timeout = lock_timeout
+ self.redis = redis.Redis(host=host, port=port, db=db, password=password)
+ self.acquire_time = -1
+
+ def acquire(self):
+ begin = now = int(time.time())
+ while (now - begin) < self.lock_timeout:
+
+ result = self.redis.setnx(self.lock_key, now + self.lock_timeout + 1)
+ if result == 1 or result is True:
+ self.acquire_time = now
+ return True
+
+ current_lock_timestamp = self.redis.get(self.lock_key)
+ if not current_lock_timestamp:
+ time.sleep(1)
+ continue
+
+ current_lock_timestamp = int(current_lock_timestamp)
+
+ if now > current_lock_timestamp:
+ next_lock_timestamp = self.redis.getset(self.lock_key, now + self.lock_timeout + 1)
+ if not next_lock_timestamp:
+ time.sleep(1)
+ continue
+ next_lock_timestamp = int(next_lock_timestamp)
+
+ if next_lock_timestamp == current_lock_timestamp:
+ self.acquire_time = now
+ return True
+ else:
+ time.sleep(1)
+ continue
+ return False
+
+ def release(self):
+ now = int(time.time())
+ if now > self.acquire_time + self.lock_timeout:
+ # key expired, do nothing and let other clients handle it
+ return
+ self.acquire_time = None
+ self.redis.delete(self.lock_key)
+
+
+def do_biz_with_share_lock(lock_name, callback):
+ lock = SharedLock(lock_name)
+ try:
+ if not lock.acquire():
+ raise Exception(lock_name + " timeout")
+ callback()
+ except Exception as e:
+ raise e
+ finally:
+ lock.release()
diff --git a/lcm/lcm/pub/utils/syscomm.py b/lcm/lcm/pub/utils/syscomm.py
new file mode 100644
index 00000000..89219ec9
--- /dev/null
+++ b/lcm/lcm/pub/utils/syscomm.py
@@ -0,0 +1,19 @@
+# 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.
+
+import inspect
+
+
+def fun_name():
+ return inspect.stack()[1][3]
diff --git a/lcm/lcm/pub/utils/timeutil.py b/lcm/lcm/pub/utils/timeutil.py
new file mode 100644
index 00000000..1d97e9d7
--- /dev/null
+++ b/lcm/lcm/pub/utils/timeutil.py
@@ -0,0 +1,19 @@
+# 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.
+
+import datetime
+
+
+def now_time(fmt="%Y-%m-%d %H:%M:%S"):
+ return datetime.datetime.now().strftime(fmt)
diff --git a/lcm/lcm/pub/utils/toscautil.py b/lcm/lcm/pub/utils/toscautil.py
new file mode 100644
index 00000000..70fba673
--- /dev/null
+++ b/lcm/lcm/pub/utils/toscautil.py
@@ -0,0 +1,2606 @@
+# 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.
+
+import json
+
+def safe_get(key_val, key):
+ return key_val[key] if key in key_val else ""
+
+
+def find_node_name(node_id, node_list):
+ for node in node_list:
+ if node['id'] == node_id:
+ return node['template_name']
+ raise Exception('can not find node(%s).' % node_id)
+
+
+def find_node_type(node_id, node_list):
+ for node in node_list:
+ if node['id'] == node_id:
+ return node['type_name']
+ raise Exception('can not find node(%s).' % node_id)
+
+
+def find_related_node(node_id, src_json_model, requirement_name):
+ related_nodes = []
+ for model_tpl in safe_get(src_json_model, "node_templates"):
+ for rt in safe_get(model_tpl, 'requirement_templates'):
+ if safe_get(rt, 'name') == requirement_name and \
+ safe_get(rt, 'target_node_template_name') == node_id:
+ related_nodes.append(model_tpl['name'])
+ return related_nodes
+
+
+def convert_props(src_node, dest_node):
+ if 'properties' in src_node and src_node['properties']:
+ for prop_name, prop_info in src_node['properties'].items():
+ if 'value' in prop_info:
+ dest_node['properties'][prop_name] = prop_info['value']
+
+
+def convert_metadata(src_json):
+ return src_json['metadata'] if 'metadata' in src_json else {}
+
+
+def convert_inputs(src_json):
+ inputs = {}
+ if 'inputs' in src_json:
+ src_inputs = src_json['inputs']
+ for param_name, param_info in src_inputs.items():
+ input_param = {}
+ if 'type_name' in param_info:
+ input_param['type'] = param_info['type_name']
+ if 'description' in param_info:
+ input_param['description'] = param_info['description']
+ if 'value' in param_info:
+ input_param['value'] = param_info['value']
+ inputs[param_name] = input_param
+ return inputs
+
+
+def convert_vnf_node(src_node, src_json_model):
+ vnf_node = {'type': src_node['type_name'], 'vnf_id': src_node['template_name'],
+ 'description': '', 'properties': {}, 'dependencies': [], 'networks': []}
+ convert_props(src_node, vnf_node)
+ for model_tpl in safe_get(src_json_model, "node_templates"):
+ if model_tpl['name'] != vnf_node['vnf_id']:
+ continue
+ vnf_node['dependencies'] = [{
+ 'key_name': requirement['name'],
+ 'vl_id': requirement['target_node_template_name']} for \
+ requirement in safe_get(model_tpl, 'requirement_templates') if \
+ safe_get(requirement, 'target_capability_name') == 'virtual_linkable']
+ vnf_node['networks'] = [requirement['target_node_template_name'] for \
+ requirement in safe_get(model_tpl, 'requirement_templates') if \
+ safe_get(requirement, 'name') == 'dependency']
+ return vnf_node
+
+
+def convert_pnf_node(src_node, src_json_model):
+ pnf_node = {'pnf_id': src_node['template_name'], 'description': '', 'properties': {}}
+ convert_props(src_node, pnf_node)
+ pnf_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
+ return pnf_node
+
+
+def convert_vl_node(src_node, src_node_list):
+ vl_node = {'vl_id': src_node['template_name'], 'description': '', 'properties': {}}
+ convert_props(src_node, vl_node)
+ vl_node['route_id'] = ''
+ for relation in safe_get(src_node, 'relationships'):
+ if safe_get(relation, 'type_name').endswith('.VirtualLinksTo'):
+ vl_node['route_id'] = find_node_name(relation['target_node_id'], src_node_list)
+ break
+ vl_node['route_external'] = (src_node['type_name'].find('.RouteExternalVL') > 0)
+ return vl_node
+
+
+def convert_cp_node(src_node, src_node_list, model_type='NSD'):
+ cp_node = {'cp_id': src_node['template_name'], 'description': '', 'properties': {}}
+ convert_props(src_node, cp_node)
+ src_relationships = src_node['relationships']
+ for relation in src_relationships:
+ if safe_get(relation, 'name') == 'virtualLink':
+ cp_node['vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
+ elif safe_get(relation, 'name') == 'virtualbinding':
+ node_key = 'pnf_id' if model_type == 'NSD' else 'vdu_id'
+ cp_node[node_key] = find_node_name(relation['target_node_id'], src_node_list)
+ return cp_node
+
+
+def convert_router_node(src_node, src_node_list):
+ router_node = {'router_id': src_node['template_name'], 'description': '', 'properties': {}}
+ convert_props(src_node, router_node)
+ for relation in src_node['relationships']:
+ if safe_get(relation, 'name') != 'external_virtual_link':
+ continue
+ router_node['external_vl_id'] = find_node_name(relation['target_node_id'], src_node_list)
+ router_node['external_ip_addresses'] = []
+ if 'properties' not in relation:
+ continue
+ for prop_name, prop_info in relation['properties'].items():
+ if prop_name == 'router_ip_address':
+ router_node['external_ip_addresses'].append(prop_info['value'])
+ break
+ return router_node
+
+
+def convert_fp_node(src_node, src_node_list, src_json_model):
+ fp_node = {'fp_id': src_node['template_name'], 'description': '',
+ 'properties': {}, 'forwarder_list': []}
+ convert_props(src_node, fp_node)
+ for relation in safe_get(src_node, 'relationships'):
+ if safe_get(relation, 'name') != 'forwarder':
+ continue
+ forwarder_point = {'type': 'vnf'}
+ target_node_type = find_node_type(relation['target_node_id'], src_node_list).upper()
+ if target_node_type.find('.CP.') >= 0 or target_node_type.endswith('.CP'):
+ forwarder_point['type'] = 'cp'
+ forwarder_point['node_name'] = find_node_name(relation['target_node_id'], src_node_list)
+ forwarder_point['capability'] = ''
+ if forwarder_point['type'] == 'vnf':
+ for node_tpl in src_json_model["node_templates"]:
+ if fp_node['fp_id'] != node_tpl["name"]:
+ continue
+ for r_tpl in safe_get(node_tpl, "requirement_templates"):
+ if safe_get(r_tpl, "target_node_template_name") != forwarder_point['node_name']:
+ continue
+ forwarder_point['capability'] = safe_get(r_tpl, "target_capability_name")
+ break
+ break
+ fp_node['forwarder_list'].append(forwarder_point)
+ return fp_node
+
+
+def convert_vnffg_group(src_group, src_group_list, src_node_list):
+ vnffg = {'vnffg_id': src_group['template_name'], 'description': '',
+ 'properties': {}, 'members': []}
+ convert_props(src_group, vnffg)
+ for member_node_id in src_group['member_node_ids']:
+ vnffg['members'].append(find_node_name(member_node_id, src_node_list))
+ return vnffg
+
+
+def convert_imagefile_node(src_node, src_node_list):
+ image_node = {'image_file_id': src_node['template_name'], 'description': '',
+ 'properties': {}}
+ convert_props(src_node, image_node)
+ return image_node
+
+
+def convert_localstorage_node(src_node, src_node_list):
+ localstorage_node = {'local_storage_id': src_node['template_name'], 'description': '',
+ 'properties': {}}
+ convert_props(src_node, localstorage_node)
+ return localstorage_node
+
+
+def convert_vdu_node(src_node, src_node_list, src_json_model):
+ vdu_node = {'vdu_id': src_node['template_name'], 'description': '', 'properties': {},
+ 'image_file': '', 'local_storages': [], 'dependencies': [], 'nfv_compute': {},
+ 'vls': [], 'artifacts': []}
+ convert_props(src_node, vdu_node)
+
+ for relation in src_node['relationships']:
+ r_id, r_name = safe_get(relation, 'target_node_id'), safe_get(relation, 'name')
+ if r_name == 'guest_os':
+ vdu_node['image_file'] = find_node_name(r_id, src_node_list)
+ elif r_name == 'local_storage':
+ vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
+ elif r_name.endswith('.AttachesTo'):
+ nt = find_node_type(r_id, src_node_list)
+ if nt.endswith('.BlockStorage.Local') or nt.endswith('.LocalStorage'):
+ vdu_node['local_storages'].append(find_node_name(r_id, src_node_list))
+
+ for capability in src_node['capabilities']:
+ if capability['name'] != 'nfv_compute':
+ continue
+ for prop_name, prop_info in capability['properties'].items():
+ if 'value' in prop_info:
+ vdu_node['nfv_compute'][prop_name] = prop_info['value']
+
+ vdu_node['cps'] = find_related_node(src_node['id'], src_json_model, 'virtualbinding')
+
+ for cp_node in vdu_node['cps']:
+ for src_cp_node in src_node_list:
+ if src_cp_node['template_name'] != cp_node:
+ continue
+ for relation in safe_get(src_cp_node, 'relationships'):
+ if relation['name'] != 'virtualLink':
+ continue
+ vl_node_name = find_node_name(relation['target_node_id'], src_node_list)
+ if vl_node_name not in vdu_node['vls']:
+ vdu_node['vls'].append(vl_node_name)
+
+ for item in safe_get(src_node, 'artifacts'):
+ artifact = {'artifact_name': item['name'], 'type': item['type_name'],
+ 'file': item['source_path']}
+ vdu_node['artifacts'].append(artifact)
+
+ return vdu_node
+
+
+def convert_exposed_node(src_json, src_nodes, exposed):
+ for item in safe_get(safe_get(src_json, 'substitution'), 'requirements'):
+ exposed['external_cps'].append({'key_name': item['mapped_name'],
+ "cp_id": find_node_name(item['node_id'], src_nodes)})
+ for item in safe_get(safe_get(src_json, 'substitution'), 'capabilities'):
+ exposed['forward_cps'].append({'key_name': item['mapped_name'],
+ "cp_id": find_node_name(item['node_id'], src_nodes)})
+
+
+def convert_vnffgs(src_json_inst, src_nodes):
+ vnffgs = []
+ src_groups = safe_get(src_json_inst, 'groups')
+ for group in src_groups:
+ type_name = group['type_name'].upper()
+ if type_name.find('.VNFFG.') >= 0 or type_name.endswith('.VNFFG'):
+ vnffgs.append(convert_vnffg_group(group, src_groups, src_nodes))
+ return vnffgs
+
+
+def convert_common(src_json, target_json):
+ if isinstance(src_json, (unicode, str)):
+ src_json_dict = json.loads(src_json)
+ else:
+ src_json_dict = src_json
+ src_json_inst = src_json_dict["instance"]
+ src_json_model = src_json_dict["model"] if "model" in src_json_dict else {}
+
+ target_json['metadata'] = convert_metadata(src_json_inst)
+ target_json['inputs'] = convert_inputs(src_json_inst)
+ target_json['vls'] = []
+ target_json['cps'] = []
+ target_json['routers'] = []
+
+ return src_json_inst, src_json_model
+
+
+def convert_nsd_model(src_json):
+ target_json = {'vnfs': [], 'pnfs': [], 'fps': []}
+ src_json_inst, src_json_model = convert_common(src_json, target_json)
+
+ src_nodes = src_json_inst['nodes']
+ for node in src_nodes:
+ type_name = node['type_name']
+ if type_name.find('.VNF.') > 0 or type_name.endswith('.VNF'):
+ target_json['vnfs'].append(convert_vnf_node(node, src_json_model))
+ elif type_name.find('.PNF.') > 0 or type_name.endswith('.PNF'):
+ target_json['pnfs'].append(convert_pnf_node(node, src_json_model))
+ elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
+ or node['type_name'].find('.RouteExternalVL') > 0:
+ target_json['vls'].append(convert_vl_node(node, src_nodes))
+ elif type_name.find('.CP.') > 0 or type_name.endswith('.CP'):
+ target_json['cps'].append(convert_cp_node(node, src_nodes))
+ elif type_name.find('.FP.') > 0 or type_name.endswith('.FP'):
+ target_json['fps'].append(convert_fp_node(node, src_nodes, src_json_model))
+ elif type_name.endswith('.Router'):
+ target_json['routers'].append(convert_router_node(node, src_nodes))
+
+ target_json['vnffgs'] = convert_vnffgs(src_json_inst, src_nodes)
+
+ target_json['ns_exposed'] = {'external_cps': [], 'forward_cps': []}
+ convert_exposed_node(src_json_inst, src_nodes, target_json['ns_exposed'])
+ return json.dumps(target_json)
+
+
+def convert_vnfd_model(src_json):
+ target_json = {'image_files': [], 'local_storages': [], 'vdus': []}
+ src_json_inst, src_json_model = convert_common(src_json, target_json)
+
+ src_nodes = src_json_inst['nodes']
+ for node in src_nodes:
+ type_name = node['type_name']
+ if type_name.endswith('.ImageFile'):
+ target_json['image_files'].append(convert_imagefile_node(node, src_nodes))
+ elif type_name.endswith('.BlockStorage.Local') or type_name.endswith('.LocalStorage'):
+ target_json['local_storages'].append(convert_localstorage_node(node, src_nodes))
+ elif type_name.find('.VDU.') > 0 or type_name.endswith('.VDU'):
+ target_json['vdus'].append(convert_vdu_node(node, src_nodes, src_json_model))
+ elif type_name.find('.VL.') > 0 or type_name.endswith('.VL') \
+ or node['type_name'].find('.RouteExternalVL') > 0:
+ target_json['vls'].append(convert_vl_node(node, src_nodes))
+ elif type_name.find('.CP.') > 0 or type_name.endswith('.CP'):
+ target_json['cps'].append(convert_cp_node(node, src_nodes, 'VNFD'))
+ elif type_name.endswith('.Router'):
+ target_json['routers'].append(convert_router_node(node, src_nodes))
+
+ target_json['vnf_exposed'] = {'external_cps': [], 'forward_cps': []}
+ convert_exposed_node(src_json_inst, src_nodes, target_json['vnf_exposed'])
+ return json.dumps(target_json)
+
+if __name__ == '__main__':
+ src_json = json.dumps(
+ {
+ "instance":{
+ "metadata":{
+ "vendor":"ZTE",
+ "name":"VCPE_NS",
+ "csarVersion":"v1.0",
+ "csarType":"NSAR",
+ "csarProvider":"ZTE",
+ "version":1,
+ "invariant_id":"vcpe_ns_sff_1",
+ "id":"VCPE_NS",
+ "description":"vcpe_ns"
+ },
+ "nodes":[
+ {
+ "id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "type_name":"tosca.nodes.nfv.ext.FP",
+ "template_name":"path2",
+ "properties":{
+ "symmetric":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "policy":{
+ "type_name":"tosca.datatypes.nfv.ext.FPPolicy",
+ "value":{
+ "type":"ACL",
+ "criteria":{
+ "dest_port_range":"1-100",
+ "ip_protocol":"tcp",
+ "source_ip_range":[
+ "119.1.1.1-119.1.1.10"
+ ],
+ "dest_ip_range":[
+ {"get_input":"NatIpRange"}
+ ],
+ "dscp":0,
+ "source_port_range":"1-100"
+ }
+ }
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"forwarder",
+ "source_requirement_index":0,
+ "target_node_id":"m6000_data_out_qeukdtf6g87cnparxi51fa8s6"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":1,
+ "target_node_id":"m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":2,
+ "target_node_id":"VNAT_cfdljtspvkp234irka59wgab0",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"path1_bv53fblv26hawr8dj4fxe2rsd",
+ "type_name":"tosca.nodes.nfv.ext.FP",
+ "template_name":"path1",
+ "properties":{
+ "symmetric":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "policy":{
+ "type_name":"tosca.datatypes.nfv.ext.FPPolicy",
+ "value":{
+ "type":"ACL",
+ "criteria":{
+ "dest_port_range":"1-100",
+ "ip_protocol":"tcp",
+ "source_ip_range":[
+ "1-100"
+ ],
+ "dest_ip_range":[
+ "1-100"
+ ],
+ "dscp":4,
+ "source_port_range":"1-100"
+ }
+ }
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"forwarder",
+ "source_requirement_index":0,
+ "target_node_id":"m6000_data_in_eldly5txw4frny3cc349uz3nc"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":1,
+ "target_node_id":"m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":2,
+ "target_node_id":"VFW_57z0ua89aiyl8ncvw7h7mjf34",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":3,
+ "target_node_id":"VNAT_cfdljtspvkp234irka59wgab0",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":4,
+ "target_node_id":"m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":5,
+ "target_node_id":"m6000_data_out_qeukdtf6g87cnparxi51fa8s6"
+ }
+ ]
+ },
+ {
+ "id":"m6000_data_out_qeukdtf6g87cnparxi51fa8s6",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "template_name":"m6000_data_out",
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"11-22-33-22-11-44"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"xgei-0/4/1/5"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"176.1.1.2"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"virtualbinding",
+ "source_requirement_index":0,
+ "target_node_id":"m6000_s_7qtzo5nuocyfmebc6kp9raq18",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"virtualLink",
+ "source_requirement_index":1,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":2,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"VFW_57z0ua89aiyl8ncvw7h7mjf34",
+ "type_name":"tosca.nodes.nfv.ext.zte.VNF.VFW",
+ "template_name":"VFW",
+ "properties":{
+ "is_shared":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "plugin_info":{
+ "type_name":"string",
+ "value":"vbrasplugin_1.0"
+ },
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "request_reclassification":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "vnf_extend_type":{
+ "type_name":"string",
+ "value":"driver"
+ },
+ "name":{
+ "type_name":"string",
+ "value":"VFW"
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "cross_dc":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "vnf_type":{
+ "type_name":"string",
+ "value":"VFW"
+ },
+ "vnfd_version":{
+ "type_name":"string",
+ "value":"1.0.0"
+ },
+ "id":{
+ "type_name":"string",
+ "value":"vcpe_vfw_zte_1_0"
+ },
+ "nsh_aware":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "adjust_vnf_capacity":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "vmnumber_overquota_alarm":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "csarProvider":{
+ "type_name":"string",
+ "value":"ZTE"
+ },
+ "csarVersion":{
+ "type_name":"string",
+ "value":"v1.0"
+ },
+ "externalPluginManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4007_plugin_net"
+ },
+ "csarType":{
+ "type_name":"string",
+ "value":"NFAR"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ },
+ {
+ "name":"vfw_fw_inout",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"vfw_ctrl_by_manager_cp",
+ "source_requirement_index":0,
+ "target_node_id":"ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"vfw_data_cp",
+ "source_requirement_index":1,
+ "target_node_id":"sfc_data_network_vx3pc1oahn0k0pa5q722yafee",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"virtualLink",
+ "source_requirement_index":2,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":3,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"m600_tunnel_cp_imwfk5l48ljz0g9knc6d68hv5",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "template_name":"m600_tunnel_cp",
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"00-11-00-22-33-00"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"gei-0/4/0/13"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"191.167.100.5"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"virtualLink",
+ "source_requirement_index":0,
+ "target_node_id":"ext_datanet_net_qtqzlx5dsthzs883hxjn6hyhd",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"virtualbinding",
+ "source_requirement_index":1,
+ "target_node_id":"m6000_s_7qtzo5nuocyfmebc6kp9raq18",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":2,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
+ "type_name":"tosca.nodes.nfv.ext.VL.Vmware",
+ "template_name":"ext_mnet_net",
+ "properties":{
+ "name":{
+ "type_name":"string",
+ "value":"vlan_4008_mng_net"
+ },
+ "dhcp_enabled":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "location_info":{
+ "type_name":"tosca.datatypes.nfv.ext.LocationInfo",
+ "value":{
+ "tenant":"admin",
+ "vimid":2,
+ "availability_zone":"nova"
+ }
+ },
+ "ip_version":{
+ "type_name":"integer",
+ "value":4
+ },
+ "mtu":{
+ "type_name":"integer",
+ "value":1500
+ },
+ "network_name":{
+ "type_name":"string",
+ "value":"vlan_4008_mng_net"
+ },
+ "network_type":{
+ "type_name":"string",
+ "value":"vlan"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtual_linkable",
+ "type_name":"tosca.capabilities.nfv.VirtualLinkable"
+ }
+ ]
+ },
+ {
+ "id":"m6000_data_in_eldly5txw4frny3cc349uz3nc",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "template_name":"m6000_data_in",
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"11-22-33-22-11-41"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"gei-0/4/0/7"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"1.1.1.1"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ },
+ "bond":{
+ "type_name":"string",
+ "value":"none"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"virtualbinding",
+ "source_requirement_index":0,
+ "target_node_id":"m6000_s_7qtzo5nuocyfmebc6kp9raq18",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"virtualLink",
+ "source_requirement_index":1,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":2,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"ext_datanet_net_qtqzlx5dsthzs883hxjn6hyhd",
+ "type_name":"tosca.nodes.nfv.ext.VL.Vmware",
+ "template_name":"ext_datanet_net",
+ "properties":{
+ "name":{
+ "type_name":"string",
+ "value":"vlan_4004_tunnel_net"
+ },
+ "dhcp_enabled":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "location_info":{
+ "type_name":"tosca.datatypes.nfv.ext.LocationInfo",
+ "value":{
+ "tenant":"admin",
+ "vimid":2,
+ "availability_zone":"nova"
+ }
+ },
+ "ip_version":{
+ "type_name":"integer",
+ "value":4
+ },
+ "mtu":{
+ "type_name":"integer",
+ "value":1500
+ },
+ "network_name":{
+ "type_name":"string",
+ "value":"vlan_4004_tunnel_net"
+ },
+ "network_type":{
+ "type_name":"string",
+ "value":"vlan"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtual_linkable",
+ "type_name":"tosca.capabilities.nfv.VirtualLinkable"
+ }
+ ]
+ },
+ {
+ "id":"m600_mnt_cp_l3488y2a8ilyfdn0l89ni4os7",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "template_name":"m600_mnt_cp",
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"00-11-00-22-33-11"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"gei-0/4/0/1"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"10.46.244.51"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ },
+ "bond":{
+ "type_name":"string",
+ "value":"none"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"virtualLink",
+ "source_requirement_index":0,
+ "target_node_id":"ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"virtualbinding",
+ "source_requirement_index":1,
+ "target_node_id":"m6000_s_7qtzo5nuocyfmebc6kp9raq18",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":2,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"sfc_data_network_vx3pc1oahn0k0pa5q722yafee",
+ "type_name":"tosca.nodes.nfv.ext.zte.VL",
+ "template_name":"sfc_data_network",
+ "properties":{
+ "name":{
+ "type_name":"string",
+ "value":"sfc_data_network"
+ },
+ "dhcp_enabled":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "is_predefined":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "location_info":{
+ "type_name":"tosca.datatypes.nfv.ext.LocationInfo",
+ "value":{
+ "tenant":"admin",
+ "vimid":2,
+ "availability_zone":"nova"
+ }
+ },
+ "ip_version":{
+ "type_name":"integer",
+ "value":4
+ },
+ "mtu":{
+ "type_name":"integer",
+ "value":1500
+ },
+ "network_name":{
+ "type_name":"string",
+ "value":"sfc_data_network"
+ },
+ "network_type":{
+ "type_name":"string",
+ "value":"vlan"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtual_linkable",
+ "type_name":"tosca.capabilities.nfv.VirtualLinkable"
+ }
+ ]
+ },
+ {
+ "id":"m6000_s_7qtzo5nuocyfmebc6kp9raq18",
+ "type_name":"tosca.nodes.nfv.ext.PNF",
+ "template_name":"m6000_s",
+ "properties":{
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "request_reclassification":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "pnf_type":{
+ "type_name":"string",
+ "value":"m6000s"
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "management_address":{
+ "type_name":"string",
+ "value":"111111"
+ },
+ "id":{
+ "type_name":"string",
+ "value":"m6000_s"
+ },
+ "nsh_aware":{
+ "type_name":"boolean",
+ "value":False
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtualBinding",
+ "type_name":"tosca.capabilities.nfv.VirtualBindable"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"forwarder",
+ "source_requirement_index":0,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ },
+ {
+ "id":"VNAT_cfdljtspvkp234irka59wgab0",
+ "type_name":"tosca.nodes.nfv.ext.zte.VNF.VNAT",
+ "template_name":"VNAT",
+ "properties":{
+ "is_shared":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "plugin_info":{
+ "type_name":"string",
+ "value":"vbrasplugin_1.0"
+ },
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "request_reclassification":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "name":{
+ "type_name":"string",
+ "value":"VNAT"
+ },
+ "vnf_extend_type":{
+ "type_name":"string",
+ "value":"driver"
+ },
+ "externalPluginManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4007_plugin_net"
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "cross_dc":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "vnf_type":{
+ "type_name":"string",
+ "value":"VNAT"
+ },
+ "vnfd_version":{
+ "type_name":"string",
+ "value":"1.0.0"
+ },
+ "id":{
+ "type_name":"string",
+ "value":"vcpe_vnat_zte_1"
+ },
+ "nsh_aware":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "adjust_vnf_capacity":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "vmnumber_overquota_alarm":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "csarProvider":{
+ "type_name":"string",
+ "value":"ZTE"
+ },
+ "NatIpRange":{
+ "type_name":"string",
+ "value":"192.167.0.10-192.168.0.20"
+ },
+ "csarVersion":{
+ "type_name":"string",
+ "value":"v1.0"
+ },
+ "csarType":{
+ "type_name":"string",
+ "value":"NFAR"
+ }
+ },
+ "interfaces":[
+ {
+ "name":"Standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "capabilities":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ },
+ {
+ "name":"vnat_fw_inout",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "relationships":[
+ {
+ "name":"vnat_ctrl_by_manager_cp",
+ "source_requirement_index":0,
+ "target_node_id":"ext_mnet_net_au2otee5mcy0dnpqykj487zr3",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"vnat_data_cp",
+ "source_requirement_index":1,
+ "target_node_id":"sfc_data_network_vx3pc1oahn0k0pa5q722yafee",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"virtualLink",
+ "source_requirement_index":2,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ },
+ {
+ "name":"forwarder",
+ "source_requirement_index":3,
+ "target_node_id":"path2_kgmfqr5ldqs9lj3oscrgxqefc",
+ "target_capability_name":"feature"
+ }
+ ]
+ }
+ ],
+ "groups":[
+ {
+ "id":"vnffg1_wk1aqhk6exoh5fmds2unu0uyc",
+ "type_name":"tosca.groups.nfv.VNFFG",
+ "template_name":"vnffg1",
+ "properties":{
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "connection_point":{
+ "type_name":"list",
+ "value":[
+ "m6000_data_in",
+ "m600_tunnel_cp",
+ "m6000_data_out"
+ ]
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "constituent_vnfs":{
+ "type_name":"list",
+ "value":[
+ "VFW",
+ "VNAT"
+ ]
+ },
+ "number_of_endpoints":{
+ "type_name":"integer",
+ "value":3
+ },
+ "dependent_virtual_link":{
+ "type_name":"list",
+ "value":[
+ "sfc_data_network",
+ "ext_datanet_net",
+ "ext_mnet_net"
+ ]
+ }
+ },
+ "interfaces":[
+ {
+ "name":"standard",
+ "description":"This lifecycle interface defines the essential, normative operations that TOSCA nodes may support.",
+ "type_name":"tosca.interfaces.node.lifecycle.Standard",
+ "operations":[
+ {
+ "name":"create",
+ "description":"Standard lifecycle create operation."
+ },
+ {
+ "name":"stop",
+ "description":"Standard lifecycle stop operation."
+ },
+ {
+ "name":"start",
+ "description":"Standard lifecycle start operation."
+ },
+ {
+ "name":"delete",
+ "description":"Standard lifecycle delete operation."
+ },
+ {
+ "name":"configure",
+ "description":"Standard lifecycle configure operation."
+ }
+ ]
+ }
+ ],
+ "member_node_ids":[
+ "path1_bv53fblv26hawr8dj4fxe2rsd",
+ "path2_kgmfqr5ldqs9lj3oscrgxqefc"
+ ]
+ }
+ ],
+ "substitution":{
+ "node_type_name":"tosca.nodes.nfv.NS.VCPE_NS"
+ },
+ "inputs":{
+ "externalDataNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4004_tunnel_net"
+ },
+ "sfc_data_network":{
+ "type_name":"string",
+ "value":"sfc_data_network"
+ },
+ "NatIpRange":{
+ "type_name":"string",
+ "value":"192.167.0.10-192.168.0.20"
+ },
+ "externalManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4008_mng_net"
+ },
+ "externalPluginManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4007_plugin_net"
+ }
+ }
+ },
+ "model":{
+ "metadata":{
+ "vendor":"ZTE",
+ "name":"VCPE_NS",
+ "csarVersion":"v1.0",
+ "csarType":"NSAR",
+ "csarProvider":"ZTE",
+ "version":1,
+ "invariant_id":"vcpe_ns_sff_1",
+ "id":"VCPE_NS",
+ "description":"vcpe_ns"
+ },
+ "node_templates":[
+ {
+ "name":"path2",
+ "type_name":"tosca.nodes.nfv.ext.FP",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "symmetric":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "policy":{
+ "type_name":"tosca.datatypes.nfv.ext.FPPolicy",
+ "value":{
+ "type":"ACL",
+ "criteria":{
+ "dest_port_range":"1-100",
+ "ip_protocol":"tcp",
+ "source_ip_range":[
+ "119.1.1.1-119.1.1.10"
+ ],
+ "dest_ip_range":[
+ {"get_input":"NatIpRange"}
+ ],
+ "dscp":0,
+ "source_port_range":"1-100"
+ }
+ }
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ed0288a10>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"forwarder",
+ "target_node_template_name":"m6000_data_out"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"m600_tunnel_cp"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"VNAT",
+ "target_capability_name":"vnat_fw_inout"
+ }
+ ]
+ },
+ {
+ "name":"path1",
+ "type_name":"tosca.nodes.nfv.ext.FP",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "symmetric":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "policy":{
+ "type_name":"tosca.datatypes.nfv.ext.FPPolicy",
+ "value":{
+ "type":"ACL",
+ "criteria":{
+ "dest_port_range":"1-100",
+ "ip_protocol":"tcp",
+ "source_ip_range":[
+ "1-100"
+ ],
+ "dest_ip_range":[
+ "1-100"
+ ],
+ "dscp":4,
+ "source_port_range":"1-100"
+ }
+ }
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec81df090>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"forwarder",
+ "target_node_template_name":"m6000_data_in"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"m600_tunnel_cp"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"VFW",
+ "target_capability_name":"vfw_fw_inout"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"VNAT",
+ "target_capability_name":"vnat_fw_inout"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"m600_tunnel_cp"
+ },
+ {
+ "name":"forwarder",
+ "target_node_template_name":"m6000_data_out"
+ }
+ ]
+ },
+ {
+ "name":"m6000_data_out",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"11-22-33-22-11-44"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"xgei-0/4/1/5"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"176.1.1.2"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec82c6610>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"virtualbinding",
+ "target_node_template_name":"m6000_s",
+ "target_capability_name":"virtualBinding"
+ },
+ {
+ "name":"virtualLink",
+ "target_node_type_name":"tosca.nodes.Root"
+ },
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ },
+ {
+ "name":"VFW",
+ "type_name":"tosca.nodes.nfv.ext.zte.VNF.VFW",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "is_shared":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "plugin_info":{
+ "type_name":"string",
+ "value":"vbrasplugin_1.0"
+ },
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "request_reclassification":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "vnf_extend_type":{
+ "type_name":"string",
+ "value":"driver"
+ },
+ "name":{
+ "type_name":"string",
+ "value":"VFW"
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "cross_dc":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "vnf_type":{
+ "type_name":"string",
+ "value":"VFW"
+ },
+ "vnfd_version":{
+ "type_name":"string",
+ "value":"1.0.0"
+ },
+ "id":{
+ "type_name":"string",
+ "value":"vcpe_vfw_zte_1_0"
+ },
+ "nsh_aware":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "adjust_vnf_capacity":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "vmnumber_overquota_alarm":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "csarProvider":{
+ "type_name":"string",
+ "value":"ZTE"
+ },
+ "csarVersion":{
+ "type_name":"string",
+ "value":"v1.0"
+ },
+ "externalPluginManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4007_plugin_net"
+ },
+ "csarType":{
+ "type_name":"string",
+ "value":"NFAR"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec8281950>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ },
+ {
+ "name":"vfw_fw_inout",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"vfw_ctrl_by_manager_cp",
+ "target_node_template_name":"ext_mnet_net",
+ "target_capability_name":"virtual_linkable"
+ },
+ {
+ "name":"vfw_data_cp",
+ "target_node_template_name":"sfc_data_network",
+ "target_capability_name":"virtual_linkable"
+ },
+ {
+ "name":"virtualLink",
+ "target_node_type_name":"tosca.nodes.Root"
+ },
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ },
+ {
+ "name":"m600_tunnel_cp",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"00-11-00-22-33-00"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"gei-0/4/0/13"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"191.167.100.5"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x1ae39d0>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"virtualLink",
+ "target_node_template_name":"ext_datanet_net",
+ "target_capability_name":"virtual_linkable"
+ },
+ {
+ "name":"virtualbinding",
+ "target_node_template_name":"m6000_s",
+ "target_capability_name":"virtualBinding"
+ },
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ },
+ {
+ "name":"ext_mnet_net",
+ "type_name":"tosca.nodes.nfv.ext.VL.Vmware",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "name":{
+ "type_name":"string",
+ "value":"vlan_4008_mng_net"
+ },
+ "dhcp_enabled":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "location_info":{
+ "type_name":"tosca.datatypes.nfv.ext.LocationInfo",
+ "value":{
+ "tenant":"admin",
+ "vimid":2,
+ "availability_zone":"nova"
+ }
+ },
+ "ip_version":{
+ "type_name":"integer",
+ "value":4
+ },
+ "mtu":{
+ "type_name":"integer",
+ "value":1500
+ },
+ "network_name":{
+ "type_name":"string",
+ "value":"vlan_4008_mng_net"
+ },
+ "network_type":{
+ "type_name":"string",
+ "value":"vlan"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ed00f89d0>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtual_linkable",
+ "type_name":"tosca.capabilities.nfv.VirtualLinkable"
+ }
+ ]
+ },
+ {
+ "name":"m6000_data_in",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"11-22-33-22-11-41"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"gei-0/4/0/7"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"1.1.1.1"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ },
+ "bond":{
+ "type_name":"string",
+ "value":"none"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x1745710>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"virtualbinding",
+ "target_node_template_name":"m6000_s",
+ "target_capability_name":"virtualBinding"
+ },
+ {
+ "name":"virtualLink",
+ "target_node_type_name":"tosca.nodes.Root"
+ },
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ },
+ {
+ "name":"ext_datanet_net",
+ "type_name":"tosca.nodes.nfv.ext.VL.Vmware",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "name":{
+ "type_name":"string",
+ "value":"vlan_4004_tunnel_net"
+ },
+ "dhcp_enabled":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "location_info":{
+ "type_name":"tosca.datatypes.nfv.ext.LocationInfo",
+ "value":{
+ "tenant":"admin",
+ "vimid":2,
+ "availability_zone":"nova"
+ }
+ },
+ "ip_version":{
+ "type_name":"integer",
+ "value":4
+ },
+ "mtu":{
+ "type_name":"integer",
+ "value":1500
+ },
+ "network_name":{
+ "type_name":"string",
+ "value":"vlan_4004_tunnel_net"
+ },
+ "network_type":{
+ "type_name":"string",
+ "value":"vlan"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8eac063990>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtual_linkable",
+ "type_name":"tosca.capabilities.nfv.VirtualLinkable"
+ }
+ ]
+ },
+ {
+ "name":"m600_mnt_cp",
+ "type_name":"tosca.nodes.nfv.ext.zte.CP",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "direction":{
+ "type_name":"string",
+ "value":"bidirectional"
+ },
+ "vnic_type":{
+ "type_name":"string",
+ "value":"normal"
+ },
+ "bandwidth":{
+ "type_name":"integer",
+ "value":0
+ },
+ "mac_address":{
+ "type_name":"string",
+ "value":"00-11-00-22-33-11"
+ },
+ "interface_name":{
+ "type_name":"string",
+ "value":"gei-0/4/0/1"
+ },
+ "ip_address":{
+ "type_name":"string",
+ "value":"10.46.244.51"
+ },
+ "order":{
+ "type_name":"integer",
+ "value":0
+ },
+ "sfc_encapsulation":{
+ "type_name":"string",
+ "value":"mac"
+ },
+ "bond":{
+ "type_name":"string",
+ "value":"none"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec81264d0>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"virtualLink",
+ "target_node_template_name":"ext_mnet_net",
+ "target_capability_name":"virtual_linkable"
+ },
+ {
+ "name":"virtualbinding",
+ "target_node_template_name":"m6000_s",
+ "target_capability_name":"virtualBinding"
+ },
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ },
+ {
+ "name":"sfc_data_network",
+ "type_name":"tosca.nodes.nfv.ext.zte.VL",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "name":{
+ "type_name":"string",
+ "value":"sfc_data_network"
+ },
+ "dhcp_enabled":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "is_predefined":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "location_info":{
+ "type_name":"tosca.datatypes.nfv.ext.LocationInfo",
+ "value":{
+ "tenant":"admin",
+ "vimid":2,
+ "availability_zone":"nova"
+ }
+ },
+ "ip_version":{
+ "type_name":"integer",
+ "value":4
+ },
+ "mtu":{
+ "type_name":"integer",
+ "value":1500
+ },
+ "network_name":{
+ "type_name":"string",
+ "value":"sfc_data_network"
+ },
+ "network_type":{
+ "type_name":"string",
+ "value":"vlan"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec813c6d0>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtual_linkable",
+ "type_name":"tosca.capabilities.nfv.VirtualLinkable"
+ }
+ ]
+ },
+ {
+ "name":"m6000_s",
+ "type_name":"tosca.nodes.nfv.ext.PNF",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "request_reclassification":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "pnf_type":{
+ "type_name":"string",
+ "value":"m6000s"
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "management_address":{
+ "type_name":"string",
+ "value":"111111"
+ },
+ "id":{
+ "type_name":"string",
+ "value":"m6000_s"
+ },
+ "nsh_aware":{
+ "type_name":"boolean",
+ "value":False
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec8132490>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"virtualBinding",
+ "type_name":"tosca.capabilities.nfv.VirtualBindable"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ },
+ {
+ "name":"VNAT",
+ "type_name":"tosca.nodes.nfv.ext.zte.VNF.VNAT",
+ "default_instances":1,
+ "min_instances":0,
+ "properties":{
+ "is_shared":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "plugin_info":{
+ "type_name":"string",
+ "value":"vbrasplugin_1.0"
+ },
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "request_reclassification":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "name":{
+ "type_name":"string",
+ "value":"VNAT"
+ },
+ "vnf_extend_type":{
+ "type_name":"string",
+ "value":"driver"
+ },
+ "externalPluginManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4007_plugin_net"
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "cross_dc":{
+ "type_name":"boolean",
+ "value":False
+ },
+ "vnf_type":{
+ "type_name":"string",
+ "value":"VNAT"
+ },
+ "vnfd_version":{
+ "type_name":"string",
+ "value":"1.0.0"
+ },
+ "id":{
+ "type_name":"string",
+ "value":"vcpe_vnat_zte_1"
+ },
+ "nsh_aware":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "adjust_vnf_capacity":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "vmnumber_overquota_alarm":{
+ "type_name":"boolean",
+ "value":True
+ },
+ "csarProvider":{
+ "type_name":"string",
+ "value":"ZTE"
+ },
+ "NatIpRange":{
+ "type_name":"string",
+ "value":"192.167.0.10-192.168.0.20"
+ },
+ "csarVersion":{
+ "type_name":"string",
+ "value":"v1.0"
+ },
+ "csarType":{
+ "type_name":"string",
+ "value":"NFAR"
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x1bba810>"
+ ],
+ "capability_templates":[
+ {
+ "name":"feature",
+ "type_name":"tosca.capabilities.Node"
+ },
+ {
+ "name":"forwarder",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ },
+ {
+ "name":"vnat_fw_inout",
+ "type_name":"tosca.capabilities.nfv.Forwarder"
+ }
+ ],
+ "requirement_templates":[
+ {
+ "name":"vnat_ctrl_by_manager_cp",
+ "target_node_template_name":"ext_mnet_net",
+ "target_capability_name":"virtual_linkable"
+ },
+ {
+ "name":"vnat_data_cp",
+ "target_node_template_name":"sfc_data_network",
+ "target_capability_name":"virtual_linkable"
+ },
+ {
+ "name":"virtualLink",
+ "target_node_type_name":"tosca.nodes.Root"
+ },
+ {
+ "name":"forwarder",
+ "target_node_type_name":"tosca.nodes.Root"
+ }
+ ]
+ }
+ ],
+ "group_templates":[
+ {
+ "name":"vnffg1",
+ "type_name":"tosca.groups.nfv.VNFFG",
+ "properties":{
+ "vendor":{
+ "type_name":"string",
+ "value":"zte"
+ },
+ "connection_point":{
+ "type_name":"list",
+ "value":[
+ "m6000_data_in",
+ "m600_tunnel_cp",
+ "m6000_data_out"
+ ]
+ },
+ "version":{
+ "type_name":"string",
+ "value":"1.0"
+ },
+ "constituent_vnfs":{
+ "type_name":"list",
+ "value":[
+ "VFW",
+ "VNAT"
+ ]
+ },
+ "number_of_endpoints":{
+ "type_name":"integer",
+ "value":3
+ },
+ "dependent_virtual_link":{
+ "type_name":"list",
+ "value":[
+ "sfc_data_network",
+ "ext_datanet_net",
+ "ext_mnet_net"
+ ]
+ }
+ },
+ "interface_templates":[
+ "<aria.modeling.model_elements.InterfaceTemplate object at 0x7f8ec811cd10>"
+ ],
+ "member_node_template_names":[
+ "path1",
+ "path2"
+ ]
+ }
+ ],
+ "substitution_template":{
+ "node_type_name":"tosca.nodes.nfv.NS.VCPE_NS"
+ },
+ "inputs":{
+ "externalDataNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4004_tunnel_net"
+ },
+ "sfc_data_network":{
+ "type_name":"string",
+ "value":"sfc_data_network"
+ },
+ "NatIpRange":{
+ "type_name":"string",
+ "value":"192.167.0.10-192.168.0.20"
+ },
+ "externalManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4008_mng_net"
+ },
+ "externalPluginManageNetworkName":{
+ "type_name":"string",
+ "value":"vlan_4007_plugin_net"
+ }
+ }
+ }
+ }
+ )
+ print convert_nsd_model(src_json)
+
+
+
+
diff --git a/lcm/lcm/pub/utils/values.py b/lcm/lcm/pub/utils/values.py
new file mode 100644
index 00000000..0cd09ac2
--- /dev/null
+++ b/lcm/lcm/pub/utils/values.py
@@ -0,0 +1,24 @@
+# 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.
+
+def ignore_case_get(args, key, def_val=""):
+ if not key:
+ return def_val
+ if key in args:
+ return args[key]
+ for old_key in args:
+ if old_key.upper() == key.upper():
+ return args[old_key]
+ return def_val
+
diff --git a/lcm/lcm/samples/__init__.py b/lcm/lcm/samples/__init__.py
new file mode 100644
index 00000000..c7b6818e
--- /dev/null
+++ b/lcm/lcm/samples/__init__.py
@@ -0,0 +1,13 @@
+# 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.
diff --git a/lcm/lcm/samples/tests.py b/lcm/lcm/samples/tests.py
new file mode 100644
index 00000000..d2673d4b
--- /dev/null
+++ b/lcm/lcm/samples/tests.py
@@ -0,0 +1,32 @@
+# 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.
+
+import unittest
+import json
+from django.test import Client
+from rest_framework import status
+
+
+class SampleViewTest(unittest.TestCase):
+ def setUp(self):
+ self.client = Client()
+
+ def tearDown(self):
+ pass
+
+ def test_sample(self):
+ response = self.client.get("/samples/")
+ self.assertEqual(status.HTTP_200_OK, response.status_code, response.content)
+ resp_data = json.loads(response.content)
+ self.assertEqual({"status": "active"}, resp_data)
diff --git a/lcm/lcm/samples/urls.py b/lcm/lcm/samples/urls.py
new file mode 100644
index 00000000..af912644
--- /dev/null
+++ b/lcm/lcm/samples/urls.py
@@ -0,0 +1,19 @@
+# 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.
+
+from django.conf.urls import url
+from lcm.samples import views
+
+urlpatterns = [
+ url(r'^samples/$', views.SampleList.as_view()), ]
diff --git a/lcm/lcm/samples/views.py b/lcm/lcm/samples/views.py
new file mode 100644
index 00000000..828b1824
--- /dev/null
+++ b/lcm/lcm/samples/views.py
@@ -0,0 +1,29 @@
+# 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.
+
+import logging
+
+from rest_framework.views import APIView
+from rest_framework.response import Response
+
+logger = logging.getLogger(__name__)
+
+
+class SampleList(APIView):
+ """
+ List all samples.
+ """
+ def get(self, request, format=None):
+ logger.debug("get")
+ return Response({"status": "active"})
diff --git a/lcm/lcm/settings.py b/lcm/lcm/settings.py
new file mode 100644
index 00000000..631ada8b
--- /dev/null
+++ b/lcm/lcm/settings.py
@@ -0,0 +1,144 @@
+# 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.
+
+import os
+import sys
+
+import redisco
+
+from lcm.pub.config.config import REDIS_HOST, REDIS_PORT, REDIS_PASSWD
+from lcm.pub.config.config import DB_NAME, DB_IP, DB_USER, DB_PASSWD, DB_PORT
+
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = '3o-wney!99y)^h3v)0$j16l9=fdjxcb+a8g+q3tfbahcnu2b0o'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'rest_framework',
+ 'lcm.pub.database',
+ 'lcm.samples'
+]
+
+MIDDLEWARE_CLASSES = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'lcm.urls'
+
+WSGI_APPLICATION = 'lcm.wsgi.application'
+
+REST_FRAMEWORK = {
+ 'DEFAULT_RENDERER_CLASSES': (
+ 'rest_framework.renderers.JSONRenderer',
+ ),
+
+ 'DEFAULT_PARSER_CLASSES': (
+ 'rest_framework.parsers.JSONParser',
+ 'rest_framework.parsers.MultiPartParser',
+ # 'rest_framework.parsers.FormParser',
+ # 'rest_framework.parsers.FileUploadParser',
+ )
+}
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql',
+ 'NAME': DB_NAME,
+ 'HOST': DB_IP,
+ 'PORT': DB_PORT,
+ 'USER': DB_USER,
+ 'PASSWORD': DB_PASSWD,
+ },
+}
+
+redisco.connection_setup(host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWD, db=0)
+# CACHE_BACKEND = 'redis_cache.cache://%s@%s:%s' % (REDIS_PASSWD, REDIS_HOST, REDIS_PORT)
+
+TIME_ZONE = 'UTC'
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.6/howto/static-files/
+
+STATIC_URL = '/static/'
+
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': True,
+ 'formatters': {
+ 'standard': {
+ 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
+ },
+ },
+ 'filters': {
+ },
+ 'handlers': {
+ 'lcm_handler': {
+ 'level': 'DEBUG',
+ 'class': 'logging.handlers.RotatingFileHandler',
+ 'filename': os.path.join(BASE_DIR, 'logs/runtime_lcm.log'),
+ 'formatter': 'standard',
+ 'maxBytes': 1024 * 1024 * 50,
+ 'backupCount': 5,
+ },
+ },
+
+ 'loggers': {
+ 'lcm': {
+ 'handlers': ['lcm_handler'],
+ 'level': 'DEBUG',
+ 'propagate': False
+ },
+ }
+}
+
+if 'test' in sys.argv:
+ from lcm.pub.config import config
+ config.REG_TO_MSB_WHEN_START = False
+ DATABASES = {}
+ DATABASES['default'] = {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': ':memory:',
+ }
+ REST_FRAMEWORK = {}
+ import platform
+
+ if platform.system() == 'Linux':
+ TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'
+ TEST_OUTPUT_VERBOSE = True
+ TEST_OUTPUT_DESCRIPTIONS = True
+ TEST_OUTPUT_DIR = 'test-reports'
diff --git a/lcm/lcm/urls.py b/lcm/lcm/urls.py
new file mode 100644
index 00000000..152a787e
--- /dev/null
+++ b/lcm/lcm/urls.py
@@ -0,0 +1,26 @@
+# 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.
+
+from django.conf.urls import include, url
+from lcm.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
+
+urlpatterns = [
+ url(r'^', include('lcm.samples.urls')),
+]
+
+# regist to MSB when startup
+if REG_TO_MSB_WHEN_START:
+ import json
+ from lcm.pub.utils.restcall import req_by_msb
+ req_by_msb(REG_TO_MSB_REG_URL, "POST", json.JSONEncoder().encode(REG_TO_MSB_REG_PARAM))
diff --git a/lcm/lcm/wsgi.py b/lcm/lcm/wsgi.py
new file mode 100644
index 00000000..90b2e131
--- /dev/null
+++ b/lcm/lcm/wsgi.py
@@ -0,0 +1,22 @@
+# 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.
+
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lcm.settings")
+
+application = get_wsgi_application()
diff --git a/lcm/logs/empty.txt b/lcm/logs/empty.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lcm/logs/empty.txt
diff --git a/lcm/manage.py b/lcm/manage.py
new file mode 100644
index 00000000..a1cbee89
--- /dev/null
+++ b/lcm/manage.py
@@ -0,0 +1,22 @@
+# 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.
+
+import os
+import sys
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lcm.settings")
+
+if __name__ == "__main__":
+ from django.core.management import execute_from_command_line
+ execute_from_command_line(sys.argv)
diff --git a/lcm/pom.xml b/lcm/pom.xml
new file mode 100644
index 00000000..56041dcd
--- /dev/null
+++ b/lcm/pom.xml
@@ -0,0 +1,51 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.gvnfm</groupId>
+ <artifactId>nfvo-root</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.openo.gvnfm</groupId>
+ <artifactId>gvnfm-lcm</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>gvnfm-lcm</name>
+ <description>gvnfm lcm</description>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>assembly.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/lcm/requirements.txt b/lcm/requirements.txt
new file mode 100644
index 00000000..c98aff71
--- /dev/null
+++ b/lcm/requirements.txt
@@ -0,0 +1,21 @@
+# rest framework
+Django==1.9.6
+djangorestframework==3.3.3
+
+# for access MySQL
+MySQL-python==1.2.5
+
+# redis cache
+redis==2.10.5
+
+# for access redis cache
+redisco==0.1.4
+django-redis-cache==0.13.1
+
+# for call rest api
+httplib2==0.9.2
+
+# for unit test
+coverage==4.2
+mock==2.0.0
+unittest_xml_reporting==1.12.0
diff --git a/lcm/run.sh b/lcm/run.sh
new file mode 100644
index 00000000..eb8a6f46
--- /dev/null
+++ b/lcm/run.sh
@@ -0,0 +1,15 @@
+#!/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.
+nohup python manage.py runserver 127.0.0.1:8801 > /dev/null &
diff --git a/lcm/stop.sh b/lcm/stop.sh
new file mode 100644
index 00000000..6f9ff21f
--- /dev/null
+++ b/lcm/stop.sh
@@ -0,0 +1,15 @@
+#!/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.
+ps auxww | grep 'manage.py runserver 127.0.0.1:8801' | awk '{print $2}' | xargs kill -9
diff --git a/lcm/tox.ini b/lcm/tox.ini
new file mode 100644
index 00000000..baf2214a
--- /dev/null
+++ b/lcm/tox.ini
@@ -0,0 +1,10 @@
+[tox]
+envlist = py27
+skipsdist = true
+
+[tox:jenkins]
+downloadcache = ~/cache/pip
+
+[testenv]
+deps = -r{toxinidir}/requirements.txt
+commands = coverage run --branch manage.py test lcm