summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinhuili <lxinhui@vmware.com>2017-02-21 18:38:25 -0800
committerxinhuili <lxinhui@vmware.com>2017-02-21 19:24:35 -0800
commit79ab09be1ad73061f28d6a40ac680f55b7595cd6 (patch)
tree3d7cee2654a3b5aef0b631383bfaa054ea4548fe
parent2e37e33fef3a547276ff532685f3c1050874f3cd (diff)
Create code base for vmware vio driver
This patch is to create code base for vio driver. Issue-ids: MULTIVIM-37 Change-Id: I81a9a5b178ad4a177e4635d5e7caee831dc1dde2 Signed-off-by: xinhuili <lxinhui@vmware.com>
-rw-r--r--vio/__init__.py13
-rw-r--r--vio/__init__.pycbin0 -> 115 bytes
-rw-r--r--vio/pub/__init__.py13
-rw-r--r--vio/pub/__init__.pycbin0 -> 119 bytes
-rw-r--r--vio/pub/config/__init__.py13
-rw-r--r--vio/pub/config/__init__.pycbin0 -> 126 bytes
-rw-r--r--vio/pub/config/config.py50
-rw-r--r--vio/pub/config/config.pycbin0 -> 1063 bytes
-rw-r--r--vio/pub/database/__init__.py13
-rw-r--r--vio/pub/database/__init__.pycbin0 -> 128 bytes
-rw-r--r--vio/pub/database/models.py23
-rw-r--r--vio/pub/database/models.pycbin0 -> 829 bytes
-rw-r--r--vio/pub/exceptions.py20
-rw-r--r--vio/pub/exceptions.pycbin0 -> 531 bytes
-rw-r--r--vio/pub/msapi/__init__.py13
-rw-r--r--vio/pub/msapi/__init__.pycbin0 -> 125 bytes
-rw-r--r--vio/pub/msapi/extsys.py39
-rw-r--r--vio/pub/msapi/extsys.pycbin0 -> 1229 bytes
-rw-r--r--vio/pub/utils/__init__.py13
-rw-r--r--vio/pub/utils/__init__.pycbin0 -> 125 bytes
-rw-r--r--vio/pub/utils/enumutil.py17
-rw-r--r--vio/pub/utils/fileutil.py52
-rw-r--r--vio/pub/utils/idutil.py20
-rw-r--r--vio/pub/utils/restcall.py95
-rw-r--r--vio/pub/utils/restcall.pycbin0 -> 3439 bytes
-rw-r--r--vio/pub/utils/share_lock.py80
-rw-r--r--vio/pub/utils/syscomm.py19
-rw-r--r--vio/pub/utils/timeutil.py19
-rw-r--r--vio/pub/utils/toscautil.py2606
-rw-r--r--vio/pub/utils/values.py25
-rw-r--r--vio/pub/vim/__init__.py13
-rw-r--r--vio/pub/vim/__init__.pycbin0 -> 123 bytes
-rw-r--r--vio/pub/vim/const.py25
-rw-r--r--vio/pub/vim/drivers/__init__.py0
-rw-r--r--vio/pub/vim/drivers/__init__.pycbin0 -> 131 bytes
-rw-r--r--vio/pub/vim/drivers/base.py22
-rw-r--r--vio/pub/vim/drivers/base.pycbin0 -> 611 bytes
-rw-r--r--vio/pub/vim/drivers/openstacksdk/__init__.py16
-rw-r--r--vio/pub/vim/drivers/openstacksdk/__init__.pycbin0 -> 265 bytes
-rw-r--r--vio/pub/vim/drivers/openstacksdk/keystone_v3.py39
-rw-r--r--vio/pub/vim/drivers/openstacksdk/keystone_v3.pycbin0 -> 1501 bytes
-rw-r--r--vio/pub/vim/drivers/openstacksdk/sdk.py124
-rw-r--r--vio/pub/vim/drivers/openstacksdk/sdk.pycbin0 -> 3086 bytes
-rw-r--r--vio/pub/vim/drivers/vimdriver.py25
-rw-r--r--vio/pub/vim/drivers/vimdriver.pycbin0 -> 689 bytes
-rw-r--r--vio/pub/vim/swagger.json1067
-rw-r--r--vio/pub/vim/urls.py31
-rw-r--r--vio/pub/vim/urls.pycbin0 -> 920 bytes
-rw-r--r--vio/pub/vim/views.py110
-rw-r--r--vio/pub/vim/views.pycbin0 -> 3625 bytes
-rw-r--r--vio/pub/vim/vimadaptor.py117
-rw-r--r--vio/pub/vim/vimapi/__init__.py0
-rw-r--r--vio/pub/vim/vimapi/__init__.pycbin0 -> 130 bytes
-rw-r--r--vio/pub/vim/vimapi/baseclient.py85
-rw-r--r--vio/pub/vim/vimapi/baseclient.pycbin0 -> 3048 bytes
-rw-r--r--vio/pub/vim/vimapi/compute/OperatorInstance.py46
-rw-r--r--vio/pub/vim/vimapi/compute/__init__.py0
-rw-r--r--vio/pub/vim/vimapi/glance/OperateImage.py52
-rw-r--r--vio/pub/vim/vimapi/glance/OperateImage.pycbin0 -> 1769 bytes
-rw-r--r--vio/pub/vim/vimapi/glance/__init__.py0
-rw-r--r--vio/pub/vim/vimapi/glance/__init__.pycbin0 -> 137 bytes
-rw-r--r--vio/pub/vim/vimapi/keystone/OperateTenant.py38
-rw-r--r--vio/pub/vim/vimapi/keystone/OperateTenant.pycbin0 -> 1036 bytes
-rw-r--r--vio/pub/vim/vimapi/keystone/__init__.py0
-rw-r--r--vio/pub/vim/vimapi/keystone/__init__.pycbin0 -> 139 bytes
-rw-r--r--vio/pub/vim/vimapi/keystone/auth.py27
-rw-r--r--vio/pub/vim/vimapi/neutron/__init__.py0
-rw-r--r--vio/samples/__init__.py13
-rw-r--r--vio/samples/__init__.pycbin0 -> 123 bytes
-rw-r--r--vio/samples/tests.py32
-rw-r--r--vio/samples/urls.py19
-rw-r--r--vio/samples/urls.pycbin0 -> 320 bytes
-rw-r--r--vio/samples/views.py29
-rw-r--r--vio/samples/views.pycbin0 -> 806 bytes
-rw-r--r--vio/settings.py143
-rw-r--r--vio/settings.pycbin0 -> 3359 bytes
-rw-r--r--vio/urls.py27
-rw-r--r--vio/urls.pycbin0 -> 627 bytes
-rw-r--r--vio/wsgi.py22
-rw-r--r--vio/wsgi.pycbin0 -> 328 bytes
80 files changed, 5265 insertions, 0 deletions
diff --git a/vio/__init__.py b/vio/__init__.py
new file mode 100644
index 0000000..05135e7
--- /dev/null
+++ b/vio/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2016 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/vio/__init__.pyc b/vio/__init__.pyc
new file mode 100644
index 0000000..8df9d95
--- /dev/null
+++ b/vio/__init__.pyc
Binary files differ
diff --git a/vio/pub/__init__.py b/vio/pub/__init__.py
new file mode 100644
index 0000000..4404c8b
--- /dev/null
+++ b/vio/pub/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017 VMware 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/vio/pub/__init__.pyc b/vio/pub/__init__.pyc
new file mode 100644
index 0000000..3817a70
--- /dev/null
+++ b/vio/pub/__init__.pyc
Binary files differ
diff --git a/vio/pub/config/__init__.py b/vio/pub/config/__init__.py
new file mode 100644
index 0000000..4404c8b
--- /dev/null
+++ b/vio/pub/config/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017 VMware 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/vio/pub/config/__init__.pyc b/vio/pub/config/__init__.pyc
new file mode 100644
index 0000000..6359646
--- /dev/null
+++ b/vio/pub/config/__init__.pyc
Binary files differ
diff --git a/vio/pub/config/config.py b/vio/pub/config/config.py
new file mode 100644
index 0000000..307e4e7
--- /dev/null
+++ b/vio/pub/config/config.py
@@ -0,0 +1,50 @@
+# Copyright 2017 VMware 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 = '172.17.0.2'
+MSB_SERVICE_PORT = '80'
+
+# [IMAGE LOCAL PATH]
+ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+IMAGE_ROOT_PATH = os.path.join(ROOT_PATH, "/VmNfvo/VnfProduct")
+
+# [REDIS]
+REDIS_HOST = '127.0.0.1'
+REDIS_PORT = '6379'
+REDIS_PASSWD = ''
+
+# [mysql]
+DB_IP = '172.17.0.4'
+DB_PORT = 3306
+DB_NAME = 'inventory'
+DB_USER = 'inventory'
+DB_PASSWD = 'inventory'
+
+# [register]
+REG_TO_MSB_WHEN_START = True
+REG_TO_MSB_REG_URL = "/openoapi/microservices/v1/services"
+REG_TO_MSB_REG_PARAM = {
+ "serviceName": "multivim-vio",
+ "version": "v1",
+ "url": "/openoapi/multivim-vio/v1",
+ "protocol": "REST",
+ "visualRange": "1",
+ "nodes": [{
+ "ip": "172.17.0.4",
+ "port": "9004",
+ "ttl": 0
+ }]
+}
diff --git a/vio/pub/config/config.pyc b/vio/pub/config/config.pyc
new file mode 100644
index 0000000..8688805
--- /dev/null
+++ b/vio/pub/config/config.pyc
Binary files differ
diff --git a/vio/pub/database/__init__.py b/vio/pub/database/__init__.py
new file mode 100644
index 0000000..4404c8b
--- /dev/null
+++ b/vio/pub/database/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017 VMware 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/vio/pub/database/__init__.pyc b/vio/pub/database/__init__.pyc
new file mode 100644
index 0000000..343595a
--- /dev/null
+++ b/vio/pub/database/__init__.pyc
Binary files differ
diff --git a/vio/pub/database/models.py b/vio/pub/database/models.py
new file mode 100644
index 0000000..d9795fe
--- /dev/null
+++ b/vio/pub/database/models.py
@@ -0,0 +1,23 @@
+# Copyright 2016 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 VimInstModel(models.Model):
+ class Meta:
+ db_table = 'vim_inst_type_mapping'
+
+ vimid = models.CharField(db_column='VIMID', primary_key=True, max_length=200)
+ vimtype = models.CharField(db_column='VIMTYPE', max_length=200)
+ viminst_url = models.CharField(db_column='VIMINSTURL', max_length=200) \ No newline at end of file
diff --git a/vio/pub/database/models.pyc b/vio/pub/database/models.pyc
new file mode 100644
index 0000000..a8fb076
--- /dev/null
+++ b/vio/pub/database/models.pyc
Binary files differ
diff --git a/vio/pub/exceptions.py b/vio/pub/exceptions.py
new file mode 100644
index 0000000..8a15b1a
--- /dev/null
+++ b/vio/pub/exceptions.py
@@ -0,0 +1,20 @@
+# Copyright 2017 VMware 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 VimDriverVioException(Exception):
+ def __init__(self, message='', http_code=''):
+ self.message = message
+ self.http_code = http_code
+
diff --git a/vio/pub/exceptions.pyc b/vio/pub/exceptions.pyc
new file mode 100644
index 0000000..9d2fb0a
--- /dev/null
+++ b/vio/pub/exceptions.pyc
Binary files differ
diff --git a/vio/pub/msapi/__init__.py b/vio/pub/msapi/__init__.py
new file mode 100644
index 0000000..54147e8
--- /dev/null
+++ b/vio/pub/msapi/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017 VMware 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/vio/pub/msapi/__init__.pyc b/vio/pub/msapi/__init__.pyc
new file mode 100644
index 0000000..64518ef
--- /dev/null
+++ b/vio/pub/msapi/__init__.pyc
Binary files differ
diff --git a/vio/pub/msapi/extsys.py b/vio/pub/msapi/extsys.py
new file mode 100644
index 0000000..eadb965
--- /dev/null
+++ b/vio/pub/msapi/extsys.py
@@ -0,0 +1,39 @@
+# Copyright 2017 VMware 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
+import logging
+
+from vio.pub.exceptions import VimDriverVioException
+from vio.pub.utils.restcall import req_by_msb
+
+logger = logging.getLogger(__name__)
+
+
+def get_vims():
+ ret = req_by_msb("/openoapi/extsys/v1/vims", "GET")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise VimDriverVioException("Failed to query vims from extsys.")
+ return json.JSONDecoder().decode(ret[1])
+
+
+def get_vim_by_id(vim_id):
+ ret = req_by_msb("/openoapi/extsys/v1/vims/%s" % vim_id, "GET")
+ if ret[0] != 0:
+ logger.error("Status code is %s, detail is %s.", ret[2], ret[1])
+ raise VimDriverVioException("Failed to query vim(%s) from extsys." % vim_id)
+ return json.JSONDecoder().decode(ret[1])
+
+
diff --git a/vio/pub/msapi/extsys.pyc b/vio/pub/msapi/extsys.pyc
new file mode 100644
index 0000000..fd50bd2
--- /dev/null
+++ b/vio/pub/msapi/extsys.pyc
Binary files differ
diff --git a/vio/pub/utils/__init__.py b/vio/pub/utils/__init__.py
new file mode 100644
index 0000000..05135e7
--- /dev/null
+++ b/vio/pub/utils/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2016 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/vio/pub/utils/__init__.pyc b/vio/pub/utils/__init__.pyc
new file mode 100644
index 0000000..fa8fbe8
--- /dev/null
+++ b/vio/pub/utils/__init__.pyc
Binary files differ
diff --git a/vio/pub/utils/enumutil.py b/vio/pub/utils/enumutil.py
new file mode 100644
index 0000000..a701e19
--- /dev/null
+++ b/vio/pub/utils/enumutil.py
@@ -0,0 +1,17 @@
+# Copyright 2017 VMware 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/vio/pub/utils/fileutil.py b/vio/pub/utils/fileutil.py
new file mode 100644
index 0000000..70a219d
--- /dev/null
+++ b/vio/pub/utils/fileutil.py
@@ -0,0 +1,52 @@
+# Copyright 2017 VMware 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/vio/pub/utils/idutil.py b/vio/pub/utils/idutil.py
new file mode 100644
index 0000000..4b02a81
--- /dev/null
+++ b/vio/pub/utils/idutil.py
@@ -0,0 +1,20 @@
+# Copyright 2017 VMware 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/vio/pub/utils/restcall.py b/vio/pub/utils/restcall.py
new file mode 100644
index 0000000..6ad9955
--- /dev/null
+++ b/vio/pub/utils/restcall.py
@@ -0,0 +1,95 @@
+# Copyright 2017 VMware 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 vio.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/vio/pub/utils/restcall.pyc b/vio/pub/utils/restcall.pyc
new file mode 100644
index 0000000..cf077be
--- /dev/null
+++ b/vio/pub/utils/restcall.pyc
Binary files differ
diff --git a/vio/pub/utils/share_lock.py b/vio/pub/utils/share_lock.py
new file mode 100644
index 0000000..ffdcdc4
--- /dev/null
+++ b/vio/pub/utils/share_lock.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright 2017 VMware 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 vio.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/vio/pub/utils/syscomm.py b/vio/pub/utils/syscomm.py
new file mode 100644
index 0000000..14289d9
--- /dev/null
+++ b/vio/pub/utils/syscomm.py
@@ -0,0 +1,19 @@
+# Copyright 2016 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/vio/pub/utils/timeutil.py b/vio/pub/utils/timeutil.py
new file mode 100644
index 0000000..b703a3c
--- /dev/null
+++ b/vio/pub/utils/timeutil.py
@@ -0,0 +1,19 @@
+# Copyright 2016 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/vio/pub/utils/toscautil.py b/vio/pub/utils/toscautil.py
new file mode 100644
index 0000000..0d9065d
--- /dev/null
+++ b/vio/pub/utils/toscautil.py
@@ -0,0 +1,2606 @@
+# Copyright 2016 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/vio/pub/utils/values.py b/vio/pub/utils/values.py
new file mode 100644
index 0000000..d380421
--- /dev/null
+++ b/vio/pub/utils/values.py
@@ -0,0 +1,25 @@
+# Copyright 2016 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/vio/pub/vim/__init__.py b/vio/pub/vim/__init__.py
new file mode 100644
index 0000000..5580cc3
--- /dev/null
+++ b/vio/pub/vim/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2016 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/vio/pub/vim/__init__.pyc b/vio/pub/vim/__init__.pyc
new file mode 100644
index 0000000..74dde2d
--- /dev/null
+++ b/vio/pub/vim/__init__.pyc
Binary files differ
diff --git a/vio/pub/vim/const.py b/vio/pub/vim/const.py
new file mode 100644
index 0000000..d151fb4
--- /dev/null
+++ b/vio/pub/vim/const.py
@@ -0,0 +1,25 @@
+# Copyright 2016 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.
+
+
+VIM_OPENSTACK = "openstack"
+RES_TYPE_KEY = "res_type"
+RES_TYPE_NEW = 1
+RES_TYPE_EXIST = 0
+SHARED_NET = 1
+SUPPORT_VLAN_TRANSPARENT = 1
+DEFAULT_MTU = 1500
+IPV4 = 4
+IPV6 = 6
+ENABLE_DHCP = 1
diff --git a/vio/pub/vim/drivers/__init__.py b/vio/pub/vim/drivers/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/pub/vim/drivers/__init__.py
diff --git a/vio/pub/vim/drivers/__init__.pyc b/vio/pub/vim/drivers/__init__.pyc
new file mode 100644
index 0000000..c62f8eb
--- /dev/null
+++ b/vio/pub/vim/drivers/__init__.pyc
Binary files differ
diff --git a/vio/pub/vim/drivers/base.py b/vio/pub/vim/drivers/base.py
new file mode 100644
index 0000000..a1c68a6
--- /dev/null
+++ b/vio/pub/vim/drivers/base.py
@@ -0,0 +1,22 @@
+# Copyright (c) 2017 VMware, Inc.
+#
+# 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.
+
+import copy
+
+
+
+class DriverBase(object):
+ '''Base class for all drivers.'''
+
+ def __init__(self, params):
+ self.conn_params = copy.deepcopy(params)
+
diff --git a/vio/pub/vim/drivers/base.pyc b/vio/pub/vim/drivers/base.pyc
new file mode 100644
index 0000000..b8ba13c
--- /dev/null
+++ b/vio/pub/vim/drivers/base.pyc
Binary files differ
diff --git a/vio/pub/vim/drivers/openstacksdk/__init__.py b/vio/pub/vim/drivers/openstacksdk/__init__.py
new file mode 100644
index 0000000..073a03d
--- /dev/null
+++ b/vio/pub/vim/drivers/openstacksdk/__init__.py
@@ -0,0 +1,16 @@
+# 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 vio.pub.vim.drivers.openstacksdk import keystone_v3
+
+
+identity = keystone_v3.KeystoneClient
diff --git a/vio/pub/vim/drivers/openstacksdk/__init__.pyc b/vio/pub/vim/drivers/openstacksdk/__init__.pyc
new file mode 100644
index 0000000..d0030da
--- /dev/null
+++ b/vio/pub/vim/drivers/openstacksdk/__init__.pyc
Binary files differ
diff --git a/vio/pub/vim/drivers/openstacksdk/keystone_v3.py b/vio/pub/vim/drivers/openstacksdk/keystone_v3.py
new file mode 100644
index 0000000..2ca57e4
--- /dev/null
+++ b/vio/pub/vim/drivers/openstacksdk/keystone_v3.py
@@ -0,0 +1,39 @@
+# 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 oslo_config import cfg
+import logging
+
+from vio.pub.vim.drivers import base
+from vio.pub.vim.drivers.openstacksdk import sdk
+
+LOG = logging.getLogger(__name__)
+CONF = cfg.CONF
+
+
+class KeystoneClient(base.DriverBase):
+ '''Keystone V3 driver.'''
+
+ def __init__(self, params):
+ super(KeystoneClient, self).__init__(params)
+ self.conn = sdk.create_connection(params)
+ self.session = self.conn.session
+
+ @sdk.translate_exception
+ def project_list(self):
+ projects = self.conn.identity.projects()
+ return projects
+
+ @sdk.translate_exception
+ def trust_list(self, **query):
+ trusts = [t for t in self.conn.identity.trusts(**query)]
+ return trusts
diff --git a/vio/pub/vim/drivers/openstacksdk/keystone_v3.pyc b/vio/pub/vim/drivers/openstacksdk/keystone_v3.pyc
new file mode 100644
index 0000000..4b279fb
--- /dev/null
+++ b/vio/pub/vim/drivers/openstacksdk/keystone_v3.pyc
Binary files differ
diff --git a/vio/pub/vim/drivers/openstacksdk/sdk.py b/vio/pub/vim/drivers/openstacksdk/sdk.py
new file mode 100644
index 0000000..1dbed47
--- /dev/null
+++ b/vio/pub/vim/drivers/openstacksdk/sdk.py
@@ -0,0 +1,124 @@
+# 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.
+
+'''
+SDK Client
+'''
+import functools
+import logging
+
+from openstack import connection
+from openstack import exceptions as sdk_exc
+from openstack import profile
+from requests import exceptions as req_exc
+
+
+USER_AGENT = 'vimdriver-vio'
+exc = sdk_exc
+LOG = logging.getLogger(__name__)
+
+
+def parse_exception(ex):
+ '''Parse exception code and yield useful information.'''
+ code = 500
+
+ if isinstance(ex, sdk_exc.HttpException):
+ # some exceptions don't contain status_code
+ if ex.http_status is not None:
+ code = ex.http_status
+ message = ex.message
+ data = {}
+ if ex.details is None:
+ data = ex.response.json()
+ else:
+ try:
+ data = jsonutils.loads(ex.details)
+ except Exception:
+ # Some exceptions don't have details record or
+ # are not in JSON format
+ pass
+
+ # try dig more into the exception record
+ # usually 'data' has two types of format :
+ # type1: {"forbidden": {"message": "error message", "code": 403}
+ # type2: {"code": 404, "error": { "message": "not found"}}
+ if data:
+ code = data.get('code', code)
+ message = data.get('message', message)
+ error = data.get('error', None)
+ if error:
+ code = data.get('code', code)
+ message = data['error'].get('message', message)
+ else:
+ for value in data.values():
+ code = value.get('code', code)
+ message = value.get('message', message)
+
+ elif isinstance(ex, sdk_exc.SDKException):
+ # Besides HttpException there are some other exceptions like
+ # ResourceTimeout can be raised from SDK, handle them here.
+ message = ex.message
+ elif isinstance(ex, req_exc.RequestException):
+ # Exceptions that are not captured by SDK
+ code = ex.errno
+ message = six.text_type(ex)
+ else:
+ # This could be a generic exception or something we don't understand
+ message = six.text_type(ex)
+
+ raise senlin_exc.InternalError(code=code, message=message)
+
+
+def translate_exception(func):
+ """Decorator for exception translation."""
+
+ @functools.wraps(func)
+ def invoke_with_catch(driver, *args, **kwargs):
+ try:
+ return func(driver, *args, **kwargs)
+ except Exception as ex:
+ LOG.exception(ex)
+ raise parse_exception(ex)
+
+ return invoke_with_catch
+
+
+def create_connection(params=None):
+ if params is None:
+ params = {}
+
+ auth_plugin = 'password'
+
+ prof = profile.Profile()
+ prof.set_version('identity', 'v3')
+ prof.set_version('image', 'v1')
+
+ try:
+ conn = connection.Connection(profile=prof, verify=False, user_agent=USER_AGENT,
+ auth_plugin=auth_plugin, **params)
+ except Exception as ex:
+ raise parse_exception(ex)
+
+ return conn
+
+
+def authenticate(**kwargs):
+ '''Authenticate using openstack sdk based on user credential'''
+
+ conn = create_connection(kwargs)
+ access_info = {
+ 'token': conn.session.get_token(),
+ 'user_id': conn.session.get_user_id(),
+ 'project_id': conn.session.get_project_id()
+ }
+
+ return access_info
diff --git a/vio/pub/vim/drivers/openstacksdk/sdk.pyc b/vio/pub/vim/drivers/openstacksdk/sdk.pyc
new file mode 100644
index 0000000..3daec03
--- /dev/null
+++ b/vio/pub/vim/drivers/openstacksdk/sdk.pyc
Binary files differ
diff --git a/vio/pub/vim/drivers/vimdriver.py b/vio/pub/vim/drivers/vimdriver.py
new file mode 100644
index 0000000..770a017
--- /dev/null
+++ b/vio/pub/vim/drivers/vimdriver.py
@@ -0,0 +1,25 @@
+# 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 copy
+
+
+from vio.pub.vim.drivers import openstacksdk
+
+
+
+class VimDriver(object):
+ '''Generic driver class'''
+
+ def __init__(self):
+
+ self.identity = openstacksdk.keystone_v3.KeystoneClient
diff --git a/vio/pub/vim/drivers/vimdriver.pyc b/vio/pub/vim/drivers/vimdriver.pyc
new file mode 100644
index 0000000..69ecf31
--- /dev/null
+++ b/vio/pub/vim/drivers/vimdriver.pyc
Binary files differ
diff --git a/vio/pub/vim/swagger.json b/vio/pub/vim/swagger.json
new file mode 100644
index 0000000..59140e6
--- /dev/null
+++ b/vio/pub/vim/swagger.json
@@ -0,0 +1,1067 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "VimDriver vio Service rest API"
+ },
+ "basePath": "/openoapi/multivim-vio/v1",
+ "tags": [
+ {
+ "name": "vim Resource"
+ }
+ ],
+ "paths": {
+ "/{vimid}/images": {
+ "post": {
+ "tags": [
+ "image Resource"
+ ],
+ "summary": "Create a image resource",
+ "description": "Create a image resource",
+ "operationId": "CreateImage",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "body",
+ "name": "body",
+ "description": "The request params to create a VNF instance",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/CreateVnfRequest"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "description": "A VNF Instance identifier was created successfully.",
+ "schema": {
+ "$ref": "#/definitions/CreateVnfResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Query multiple VNF instances",
+ "description": "Query multiple VNF instances",
+ "operationId": "QueryMultipleVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [],
+ "responses": {
+ "200": {
+ "description": "The request has succeeded.",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/VnfInstanceInfo"
+ }
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_instances/{vnfInstanceId}": {
+ "delete": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Delete a VNF instance resource",
+ "description": "Delete a VNF instance resource",
+ "operationId": "DeleteVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "The VNF instance resource and the associated VNF identifier were deleted successfully."
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ },
+ "get": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Query a VNF instance",
+ "description": "Query a VNF instance",
+ "operationId": "QuerySingleVnfs",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The request has succeeded.",
+ "schema": {
+ "$ref": "#/definitions/VnfInstanceInfo"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_instances/{vnfInstanceId}/instantiate": {
+ "post": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Instantiate a VNF",
+ "description": "Instantiate a VNF",
+ "operationId": "InstantiateVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "body",
+ "description": "The request params to instantiate a VNF",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/InstantiateVnfRequest"
+ }
+ }
+ ],
+ "responses": {
+ "202": {
+ "description": "The request is accepted for processing, but the processing has not been completed.",
+ "schema": {
+ "$ref": "#/definitions/VnfLcOpIdResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_instances/{vnfInstanceId}/terminate": {
+ "post": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Terminate a VNF",
+ "description": "Terminate a VNF",
+ "operationId": "TerminateVnf",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "vnfInstanceId",
+ "description": "Identifier of the VNF instance.",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "body",
+ "description": "The request params to terminate a VNF",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/TerminateVnfRequest"
+ }
+ }
+ ],
+ "responses": {
+ "202": {
+ "description": "The request is accepted for processing, but the processing has not been completed.",
+ "schema": {
+ "$ref": "#/definitions/VnfLcOpIdResponse"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF instance resource does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ },
+ "/vnf_lc_ops/{vnfLcOpId}&responseId={responseId}": {
+ "get": {
+ "tags": [
+ "lcm Resource"
+ ],
+ "summary": "Get VNF operational status",
+ "description": "VNF operational status",
+ "operationId": "QuerySingleVnfLcOp",
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "parameters": [
+ {
+ "name": "vnfLcOpId",
+ "in": "path",
+ "description": "Identifier of a VNF lifecycle operation occurrence",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "name": "responseId",
+ "in": "path",
+ "description": "Response Identifier",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "The request has succeeded.",
+ "schema": {
+ "$ref": "#/definitions/VnfLcOpOcc"
+ }
+ },
+ "401": {
+ "description": "Unauthorized."
+ },
+ "404": {
+ "description": "The VNF lifecycle operation occurrence does not exist."
+ },
+ "500": {
+ "description": "Failed to process the request",
+ "schema": {
+ "$ref": "#/definitions/Error"
+ }
+ }
+ }
+ }
+ }
+ },
+ "definitions": {
+ "CreateVnfRequest": {
+ "type": "object",
+ "required": [
+ "vnfdId",
+ "vnfInstanceName"
+ ],
+ "properties": {
+ "vnfdId": {
+ "type": "string",
+ "description": "Identifier that identifies the VNFD which defines the VNF instance to be created."
+ },
+ "vnfInstanceName": {
+ "type": "string",
+ "description": "Human-readable name of the VNF instance to be created."
+ },
+ "vnfInstanceDescription": {
+ "type": "string",
+ "description": "Human-readable description of the VNF instance to be created."
+ }
+ }
+ },
+ "CreateVnfResponse": {
+ "type": "object",
+ "required": [
+ "vnfInstanceId"
+ ],
+ "properties": {
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "VNF instance identifier just created."
+ }
+ }
+ },
+ "InstantiateVnfRequest": {
+ "type": "object",
+ "required": [
+ "flavourId"
+ ],
+ "properties": {
+ "flavourId": {
+ "type": "string",
+ "description": "Identifier of the VNF deployment flavour to be instantiated."
+ },
+ "instantiationLevelId": {
+ "type": "string",
+ "description": "Identifier of the instantiation level of the deployment flavour to be instantiated. If not present, the default instantiation level as declared in the VNFD is instantiated."
+ },
+ "extVirtualLinks": {
+ "items": {
+ "$ref": "#/definitions/ExtVirtualLinkData"
+ },
+ "description": "Information about external VLs to connect the VNF to."
+ },
+ "localizationLanguage": {
+ "type": "string",
+ "description": "Localization language of the VNF to be instantiated can be declared in the VNFD. The value shall comply with the format defined in IETF RFC 5646 [6]. "
+ },
+ "additionalParams": {
+ "type": "object",
+ "description": "Additional input parameters for the instantiation process, specific to the VNF being instantiated."
+ }
+ }
+ },
+ "TerminateVnfRequest": {
+ "type": "object",
+ "required": [
+ "terminationType"
+ ],
+ "properties": {
+ "terminationType": {
+ "type": "string",
+ "description": "Indicates whether forceful or graceful termination is requested.",
+ "enum": [
+ "FORCEFUL",
+ "GRACEFUL"
+ ]
+ },
+ "gracefulTerminationTimeout": {
+ "type": "integer",
+ "format": "int32",
+ "minimum": "1",
+ "description": "This attribute is only applicable in case of graceful termination. It defines the time to wait for the VNF to be taken out of service before shutting down the VNF and releasing the resources. The unit is seconds. If not given and the \"terminationType\" attribute is set to \"GRACEFUL\", it is expected that the VNFM waits for the successful taking out of service of the VNF, no matter how long it takes, before shutting down the VNF and releasing the resources."
+ }
+ }
+ },
+ "VnfLcOpIdResponse": {
+ "type": "object",
+ "description": "VNF lifecycle operation occurrence identifier response",
+ "required": [
+ "vnfLcOpId"
+ ],
+ "properties": {
+ "vnfLcOpId": {
+ "type": "string",
+ "description": "Identifier of a VNF lifecycle operation occurrence"
+ }
+ }
+ },
+ "ExtVirtualLinkData": {
+ "type": "object",
+ "required": [
+ "resourceId",
+ "extCps"
+ ],
+ "properties": {
+ "extVirtualLinkId": {
+ "type": "string",
+ "description": "Identifier of the VL instance."
+ },
+ "vim": {
+ "$ref": "#/definitions/VimInfo",
+ "description": "Information about the VIM that manages this resource. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable."
+ },
+ "resourceId": {
+ "type": "string",
+ "description": "The network UUID of VIM"
+ },
+ "extCps": {
+ "type": "array",
+ "description": "External CPs of the VNF to be connected to this external VL.",
+ "items": {
+ "$ref": "#/definitions/VnfExtCpData"
+ }
+ }
+ }
+ },
+ "VimInfo": {
+ "type": "object",
+ "required": [
+ "vimInfoId",
+ "vimId",
+ "interfaceInfo",
+ "accessInfo",
+ "interfaceEndpoint"
+ ],
+ "properties": {
+ "vimInfoId": {
+ "type": "string",
+ "description": "The identifier of this VimInfo instance, for the purpose of referencing it from other information elements."
+ },
+ "vimId": {
+ "type": "string",
+ "description": "The identifier of the VIM."
+ },
+ "interfaceInfo": {
+ "$ref": "#/definitions/InterfaceInfo",
+ "description": "Information about the interface to the VIM, including VIM provider type, API version, and protocol type."
+ },
+ "accessInfo": {
+ "$ref": "#/definitions/AccessInfo",
+ "description": "Authentication credentials for accessing the VIM. Examples may include those to support different authentication schemes, e.g., OAuth, Token, etc. "
+ },
+ "interfaceEndpoint": {
+ "type": "string",
+ "description": "Information about the interface endpoint. An example is a URL."
+ }
+ }
+ },
+ "InterfaceInfo": {
+ "type": "object",
+ "required": [
+ "vimType",
+ "apiVersion",
+ "protocolType"
+ ],
+ "properties": {
+ "vimType": {
+ "type": "string",
+ "description": "The type of the VIM."
+ },
+ "apiVersion": {
+ "type": "string",
+ "description": "The Version of the api of the VIM."
+ },
+ "protocolType": {
+ "type": "string",
+ "enum": [
+ "http",
+ "https"
+ ]
+ }
+ }
+ },
+ "AccessInfo": {
+ "type": "object",
+ "required": [
+ "tenant",
+ "username",
+ "password"
+ ],
+ "properties": {
+ "tenant": {
+ "type": "string",
+ "description": "Tenant Name of tenant"
+ },
+ "username": {
+ "type": "string",
+ "description": "Username for login"
+ },
+ "password": {
+ "type": "string",
+ "description": "Password of login user"
+ }
+ }
+ },
+ "VnfExtCpData": {
+ "type": "object",
+ "required": [
+ "cpdId"
+ ],
+ "properties": {
+ "cpdId": {
+ "type": "string",
+ "description": "The identifier of the CPD in the VNFD."
+ },
+ "addresses": {
+ "type": "array",
+ "description": "List of (fixed) network addresses that need to be configured on the CP. This attribute shall be present if fixed addresses need to be configured.",
+ "items": {
+ "$ref": "#/definitions/NetworkAddress"
+ }
+ },
+ "numDynamicAddresses": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Number of network addresses to be assigned dynamically. This attribute shall be present if dynamic addresses need to be configured."
+ }
+ }
+ },
+ "NetworkAddress": {
+ "type": "object",
+ "required": [
+ "addressType"
+ ],
+ "properties": {
+ "addressType": {
+ "type": "string",
+ "description": "Describes the type of the address to be assigned to the CP instantiated from the parent CPD.",
+ "enum": [
+ "MAC",
+ "IP"
+ ]
+ },
+ "l2AddressData": {
+ "type": "string",
+ "description": "Provides the information on the MAC addresses to be assigned to the CP(s) instantiated from the parent CPD. Shall be present when the addressType is MAC address."
+ },
+ "l3AddressData": {
+ "$ref": "#/definitions/L3AddressData",
+ "description": "Provides the information on the IP addresses to be assigned to the CP instantiated from the parent CPD. Shall be present when the addressType is IP address."
+ }
+ }
+ },
+ "L3AddressData": {
+ "type": "object",
+ "required": [
+ "iPAddressType",
+ "iPAddress"
+ ],
+ "properties": {
+ "iPAddressType": {
+ "type": "string",
+ "description": "IP address type",
+ "enum": [
+ "IPv4",
+ "IPv6"
+ ]
+ },
+ "iPAddress": {
+ "type": "string",
+ "description": "IP address"
+ }
+ }
+ },
+ "VnfInstanceInfo": {
+ "type": "object",
+ "required": [
+ "vnfInstanceId",
+ "vnfInstanceName",
+ "vnfInstanceDescription",
+ "onboardedVnfPkgInfoId",
+ "vnfdId",
+ "vnfdVersion",
+ "vnfSoftwareVersion",
+ "vnfProvider",
+ "vnfProductName",
+ "instantiationState"
+ ],
+ "properties": {
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "VNF instance identifier."
+ },
+ "vnfInstanceName": {
+ "type": "string",
+ "description": "VNF instance name."
+ },
+ "vnfInstanceDescription": {
+ "type": "string",
+ "description": "Human-readable description of the VNF instance."
+ },
+ "onboardedVnfPkgInfoId": {
+ "type": "string",
+ "description": "Identifier of information held by the NFVO about the specific VNF Package on which the VNF is based. This identifier was allocated by the NFVO."
+ },
+ "vnfdId": {
+ "type": "string",
+ "description": "Identifier of the VNFD on which the VNF instance is based."
+ },
+ "vnfdVersion": {
+ "type": "string",
+ "description": "Identifies the version of the VNFD. The value is copied from the VNFD."
+ },
+ "vnfSoftwareVersion": {
+ "type": "string",
+ "description": "Software version of the VNF. The value is copied from the VNFD."
+ },
+ "vnfProvider": {
+ "type": "string",
+ "description": "Name of the person or company providing the VNF. The value is copied from the VNFD."
+ },
+ "vnfProductName": {
+ "type": "string",
+ "description": "Name to identify the VNF Product. Such as VNF Application Type. The value is copied from the VNFD."
+ },
+ "instantiationState": {
+ "type": "string",
+ "description": "The instantiation state of the VNF.",
+ "enum": [
+ "NOT_INSTANTIATED",
+ "INSTANTIATED"
+ ]
+ },
+ "vnfConfigurableProperties": {
+ "type": "object",
+ "description": "Current values of the configurable properties of the VNF instance. Configurable properties as declared in the VNFD."
+ },
+ "metadata": {
+ "type": "object",
+ "description": "Additional metadata describing the VNF instance. This attribute can be modified with the Modify VNF information operation."
+ },
+ "extensions": {
+ "type": "object",
+ "description": "VNF-specific attributes. This attribute can be modified with the Modify VNF information operation."
+ },
+ "instantiatedVnfInfo": {
+ "$ref": "#/definitions/InstantiatedVnfInfo",
+ "description": "Information specific to an instantiated VNF instance. This attribute shall be present if the instantiateState attribute value is INSTANTIATED."
+ }
+ }
+ },
+ "InstantiatedVnfInfo": {
+ "type": "object",
+ "required": [
+ "flavourId",
+ "vnfState"
+ ],
+ "properties": {
+ "flavourId": {
+ "type": "string",
+ "description": "Identifier of the VNF deployment flavour to be instantiated."
+ },
+ "vnfState": {
+ "type": "string",
+ "description": "State of the VNF instance",
+ "enum": [
+ "STARTED",
+ "STOPPED"
+ ]
+ },
+ "scaleStatus": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ScaleInfo"
+ },
+ "description": "Scale status of the VNF, one entry per aspect. Represents for every scaling aspect how \"big\" the VNF has been scaled w.r.t. that aspect. This attribute shall be present if the VNF supports scaling."
+ },
+ "extCpInfo": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/CpInfo"
+ },
+ "description": "Information about the external CPs exposed by the VNF instance."
+ },
+ "extVirtualLink": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/ExtVirtualLinkInfo"
+ },
+ "description": "Information about the external VLs the VNF instance is connected to."
+ },
+ "monitoringParameters": {
+ "type": "object",
+ "description": "Active monitoring parameters."
+ },
+ "localizationLanguage": {
+ "type": "string",
+ "description": "Localization language of the VNF to be instantiated."
+ },
+ "vimInfo": {
+ "type": "array",
+ "description": "Information about VIM(s) managing resources for the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable.",
+ "items": {
+ "$ref": "#/definitions/VimInfo"
+ }
+ },
+ "vnfcResourceInfo": {
+ "type": "array",
+ "description": "Information about the virtualised compute and storage resource(s) used by the VNFCs of the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable.",
+ "items": {
+ "$ref": "#/definitions/VnfcResourceInfo"
+ }
+ },
+ "virtualLinkResourceInfo": {
+ "type": "array",
+ "description": "Information about the virtualised network resource(s) used by the VLs of the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable. ",
+ "items": {
+ "$ref": "#/definitions/VirtualLinkResourceInfo"
+ }
+ },
+ "virtualStorageResourceInfo": {
+ "type": "array",
+ "description": "Information about the virtualised storage resource(s) used as storage for the VNF instance. This attribute shall be supported and present if VNF-related resource management in direct mode is applicable.",
+ "items": {
+ "$ref": "#/definitions/VirtualStorageResourceInfo"
+ }
+ }
+ }
+ },
+ "ScaleInfo": {
+ "type": "object",
+ "required": [
+ "aspectId",
+ "scaleLevel"
+ ],
+ "properties": {
+ "aspectId": {
+ "type": "string",
+ "description": "Identifier of the scaling aspect."
+ },
+ "scaleLevel": {
+ "type": "integer",
+ "format": "int32",
+ "description": "Indicates the scale level. The minimum value shall be 0 and the maximum value shall be <= maxScaleLevel as described in the VNFD."
+ }
+ }
+ },
+ "CpInfo": {
+ "type": "object",
+ "required": [
+ "cpInstanceId",
+ "cpdId"
+ ],
+ "properties": {
+ "cpInstanceId": {
+ "type": "string",
+ "description": "Identifier of the CP instance."
+ },
+ "cpdId": {
+ "type": "string",
+ "description": "Identifier of the CPD, in the VNFD."
+ },
+ "addresses": {
+ "type": "array",
+ "description": "List of network addresses that have been configured on the CP.",
+ "items": {
+ "$ref": "#/definitions/NetworkAddress"
+ }
+ }
+ }
+ },
+ "ExtVirtualLinkInfo": {
+ "type": "object",
+ "required": [
+ "extVirtualLinkId",
+ "resourceHandle"
+ ],
+ "properties": {
+ "extVirtualLinkId": {
+ "type": "string",
+ "description": "Identifier of the external VL."
+ },
+ "resourceHandle": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Identifier of the resource realizing this VL."
+ },
+ "linkPorts": {
+ "type": "array",
+ "description": "Link ports of this VL.",
+ "items": {
+ "$ref": "#/definitions/VnfLinkPort"
+ }
+ }
+ }
+ },
+ "ResourceHandle": {
+ "type": "object",
+ "required": [
+ "resourceId"
+ ],
+ "properties": {
+ "vimId": {
+ "type": "string",
+ "description": "Identifier of the VimInfo information element defining the VIM who manages the resource. This attribute shall be present if VNF-related resource management in direct mode is applicable. The value refers to a vimInfo item in the VnfInstance."
+ },
+ "resourceProviderId": {
+ "type": "string",
+ "description": "Identifier of the entity responsible for the management of the resource. This attribute shall be present when VNF-related resource management in indirect mode is applicable. "
+ },
+ "resourceId": {
+ "type": "string",
+ "description": "Identifier of the resource in the scope of the VIM or the resource provider."
+ }
+ }
+ },
+ "VnfcResourceInfo": {
+ "type": "object",
+ "required": [
+ "vnfcInstanceId",
+ "vduId",
+ "computeResource",
+ "storageResourceIds"
+ ],
+ "properties": {
+ "vnfcInstanceId": {
+ "type": "string",
+ "description": "Identifier of this VNFC instance."
+ },
+ "vduId": {
+ "type": "string",
+ "description": "Reference to the applicable VDU information element in the VNFD."
+ },
+ "computeResource": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Reference to the VirtualCompute resource."
+ },
+ "storageResourceIds": {
+ "type": "array",
+ "description": "Reference(s) to the VirtualStorage resource(s).",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "VirtualStorageResourceInfo": {
+ "type": "object",
+ "required": [
+ "virtualStorageInstanceId",
+ "virtualStorageDescId",
+ "storageResource"
+ ],
+ "properties": {
+ "virtualStorageInstanceId": {
+ "type": "string",
+ "description": "Identifier of this virtual storage resource instance."
+ },
+ "virtualStorageDescId": {
+ "type": "string",
+ "description": "Identifier of the VirtualStorageDesc in the VNFD."
+ },
+ "storageResource": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Reference to the VirtualStorage resource."
+ }
+ }
+ },
+ "VirtualLinkResourceInfo": {
+ "type": "object",
+ "required": [
+ "virtualLinkInstanceId",
+ "virtualLinkDescId",
+ "networkResource"
+ ],
+ "properties": {
+ "virtualLinkInstanceId": {
+ "type": "string",
+ "description": "Identifier of this VL instance."
+ },
+ "virtualLinkDescId": {
+ "type": "string",
+ "description": "Identifier of the Virtual Link Descriptor (VLD) in the VNFD."
+ },
+ "networkResource": {
+ "$ref": "#/definitions/ResourceHandle",
+ "description": "Reference to the VirtualNetwork resource."
+ }
+ }
+ },
+ "VnfLcOpOcc": {
+ "type": "object",
+ "description": "VNF lifecycle operation response",
+ "required": [
+ "vnfLcOpId",
+ "vnfInstanceId",
+ "lcmOperationType",
+ "startTime",
+ "responseDescriptor"
+ ],
+ "properties": {
+ "vnfLcOpId": {
+ "type": "string",
+ "description": "Identifier of a VNF lifecycle operation occurrence"
+ },
+ "vnfInstanceId": {
+ "type": "string",
+ "description": "Identifier of the VNF instance to which the operation applies"
+ },
+ "lcmOperationType": {
+ "type": "string",
+ "description": "Type of the actual LCM operation represented by this lcm operation occurrence.",
+ "enum": [
+ "INSTANTIATE",
+ "SCALE",
+ "SCALE_TO_LEVEL",
+ "CHANGE_FLAVOUR",
+ "TERMINATE",
+ "HEAL",
+ "OPERATE"
+ ]
+ },
+ "startTime": {
+ "type": "string",
+ "description": "Date-time of the start of the operation. Representation: String formatted according to RFC 3339 [13]."
+ },
+ "responseDescriptor": {
+ "type": "#/definitions/VnfLcOpResponseDescriptor",
+ "description": "Including:responseId,progress,statusstatusDescription,errorCode,responseHistoryList"
+ }
+ }
+ },
+ "VnfLcOpResponseDescriptor": {
+ "type": "object",
+ "description": "VNF lifecycle operation response",
+ "required": [
+ "responseId",
+ "progress",
+ "lcmOperationStatus",
+ "statusDescription",
+ "responseHistoryList"
+ ],
+ "properties": {
+ "responseId": {
+ "type": "integer",
+ "description": "Response Identifier."
+ },
+ "progress": {
+ "type": "integer",
+ "description": "progress (1-100)."
+ },
+ "lcmOperationStatus": {
+ "type": "string",
+ "description": "Vnf lifecycle operation Status.",
+ "enum": [
+ "STARTING",
+ "PROCESSING",
+ "COMPLETED",
+ "FAILED"
+ ]
+ },
+ "statusDescription": {
+ "type": "string",
+ "description": "Status Description of a VNF lifecycle operation occurrence"
+ },
+ "errorCode": {
+ "type": "integer",
+ "description": "Error code."
+ },
+ "responseHistoryList": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/VnfLcOpDetail"
+ }
+ }
+ }
+ },
+ "VnfLcOpDetail": {
+ "type": "object",
+ "description": "The Detail of VNF lifecycle operation",
+ "required": [
+ "responseId",
+ "progress",
+ "lcmOperationStatus",
+ "statusDescription"
+ ],
+ "properties": {
+ "responseId": {
+ "type": "integer",
+ "description": "Response Identifier."
+ },
+ "progress": {
+ "type": "integer",
+ "description": "progress (1-100)."
+ },
+ "lcmOperationStatus": {
+ "type": "string",
+ "description": "Vnf lifecycle operation Status.",
+ "enum": [
+ "STARTING",
+ "PROCESSING",
+ "COMPLETED",
+ "FAILED"
+ ]
+ },
+ "statusDescription": {
+ "type": "string",
+ "description": "Status Description of a VNF lifecycle operation occurrence"
+ },
+ "errorCode": {
+ "type": "integer",
+ "description": "Error code."
+ }
+ }
+ },
+ "Error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/vio/pub/vim/urls.py b/vio/pub/vim/urls.py
new file mode 100644
index 0000000..b47ffe9
--- /dev/null
+++ b/vio/pub/vim/urls.py
@@ -0,0 +1,31 @@
+# Copyright 2016 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 patterns, url
+from rest_framework.urlpatterns import format_suffix_patterns
+
+from vio.pub.vim.views import SwaggerJsonView
+from vio.pub.vim.views import CreateListImagesView
+from vio.pub.vim.views import GetDeleteImageView
+from vio.pub.vim.views import ListTenantsView
+
+urlpatterns = patterns('',
+ url(r'^openoapi/multivim-vio/v1/(?P<vimid>[0-9a-zA-Z_-]+)/images$', CreateListImagesView.as_view()),
+ url(r'^openoapi/multivim-vio/v1/(?P<vimid>[0-9a-zA-Z_-]+)/images/(?P<image_id>[0-9a-zA-Z_-]+)$',
+ GetDeleteImageView.as_view()),
+ url(r'^openoapi/multivim-vio/v1/swagger.json$', SwaggerJsonView.as_view()),
+
+ url(r'^openoapi/multivim-vio/v1/(?P<vimid>[0-9a-zA-Z_-]+)/tenants$', ListTenantsView.as_view()),
+ )
+
+urlpatterns = format_suffix_patterns(urlpatterns)
diff --git a/vio/pub/vim/urls.pyc b/vio/pub/vim/urls.pyc
new file mode 100644
index 0000000..24ccd98
--- /dev/null
+++ b/vio/pub/vim/urls.pyc
Binary files differ
diff --git a/vio/pub/vim/views.py b/vio/pub/vim/views.py
new file mode 100644
index 0000000..f4dddd9
--- /dev/null
+++ b/vio/pub/vim/views.py
@@ -0,0 +1,110 @@
+# Copyright 2016 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
+import logging
+import os
+from rest_framework import status
+from rest_framework.response import Response
+from rest_framework.views import APIView
+
+from vio.pub.msapi import extsys
+from vio.pub.vim.vimapi.glance import OperateImage
+from vio.pub.vim.vimapi.keystone import OperateTenant
+
+
+logger = logging.getLogger(__name__)
+
+
+class ListTenantsView(APIView):
+ def get(self, request, vimid):
+ vim_info = extsys.get_vim_by_id(vimid)
+
+ data = {}
+ data['vimid'] = vim_info['vimId']
+ data['vimName'] = vim_info['name']
+ data['username'] = vim_info['userName']
+ data['password'] = vim_info['password']
+ data['url'] = vim_info['url']
+ data['project_name'] = vim_info['tenant']
+
+ tenant_instance = OperateTenant.OperateTenant()
+ projects = tenant_instance.get_projects(data)
+
+ rsp = {}
+ rsp['vimid'] = vim_info['vimId']
+ rsp['vimName'] = vim_info['name']
+ rsp['tenants'] = []
+
+ for project in projects:
+ tenant = {}
+ tenant['id'] = project['id']
+ tenant['name'] = project['name']
+ rsp['tenants'].append(tenant)
+ return Response(data=rsp, status=status.HTTP_200_OK)
+
+
+class CreateListImagesView(APIView):
+ def post(self, request):
+ data = {
+ 'imageName' : request.data['imageName'],
+ 'imagePath' : request.data['imagePath'],
+ 'imageType' : request.data['imageType'],
+ 'containerFormat' : request.data['containerFormat']
+ }
+ rsp = OperateImage.create_image(data)
+ return Response(data=rsp, status=status.HTTP_200_OK)
+
+ def get(self, request):
+ data = {
+ 'imageName' : request.data['imageName'],
+ 'imagePath' : request.data['imagePath'],
+ 'imageType' : request.data['imageType'],
+ 'containerFormat' : request.data['containerFormat']
+ }
+ rsp = OperateImage.list_images(data)
+ return Response(data=rsp, status=status.HTTP_200_OK)
+
+class GetDeleteImageView(APIView):
+ def post(self, request):
+ data = {
+ 'imageName' : request.data['imageName'],
+ 'imagePath' : request.data['imagePath'],
+ 'imageType' : request.data['imageType'],
+ 'containerFormat' : request.data['containerFormat']
+ }
+ rsp = OperateImage.delete_image(data)
+ return Response(data=rsp, status=status.HTTP_200_OK)
+
+ def get(self, request):
+ data = {
+ 'imageName' : request.data['imageName'],
+ 'imagePath' : request.data['imagePath'],
+ 'imageType' : request.data['imageType'],
+ 'containerFormat' : request.data['containerFormat']
+ }
+ rsp = OperateImage.get_image(data)
+ return Response(data=rsp, status=status.HTTP_200_OK)
+
+class SwaggerJsonView(APIView):
+ def get(self, request):
+ json_file = os.path.join(os.path.dirname(__file__), 'swagger.json')
+ f = open(json_file)
+ json_data = json.JSONDecoder().decode(f.read())
+ f.close()
+ return Response(json_data)
+
+
+
diff --git a/vio/pub/vim/views.pyc b/vio/pub/vim/views.pyc
new file mode 100644
index 0000000..beb2dfc
--- /dev/null
+++ b/vio/pub/vim/views.pyc
Binary files differ
diff --git a/vio/pub/vim/vimadaptor.py b/vio/pub/vim/vimadaptor.py
new file mode 100644
index 0000000..1af3e05
--- /dev/null
+++ b/vio/pub/vim/vimadaptor.py
@@ -0,0 +1,117 @@
+# Copyright 2016 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
+import sys
+import traceback
+
+from requests import RequestException
+
+from vio.pub.utils.syscomm import fun_name
+from vio.pub.vim import const
+from vio.pub.exceptions import VimDriverVioException
+
+logger = logging.getLogger(__name__)
+
+
+class VimAdaptor:
+ def __init__(self, connectInfo):
+ logger.info("[VimAdaptor]connectInfo=%s" % connectInfo)
+ self.apiImpl, self.authInfo = None, [1, "No auth info"]
+ self.create_api(connectInfo)
+ self.force_login(connectInfo)
+
+ def create_api(self, connectInfo):
+ vimtype = connectInfo['vimtype'] if 'vimtype' in connectInfo else None
+ logger.info("call %s, vimtype=%s" % (fun_name(), vimtype))
+ if vimtype == const.VIM_OPENSTACK:
+ from vio.pub.nfvi.vim.api.openstack.api import OpenstackApi
+ self.apiImpl = OpenstackApi()
+ else:
+ self.authInfo = [1, "Unsupported vimtype(%s)" % vimtype]
+
+ def api_call(self, funname, fun, *args):
+ logger.info("call %s%s" % (funname, str(args)))
+ ret = None
+ try:
+ ret = fun(self.authInfo[1], *args) if self.authInfo[0] == 0 else self.authInfo
+ except VimException as e:
+ ret = [1, e.message]
+ except RequestException as e:
+ logger.error("request=%s, url=%s" % (e.request.headers._store, e.request.url))
+ logger.error(traceback.format_exc())
+ ret = [1, e.message if e.message else str(sys.exc_info())]
+ except Exception as ex:
+ logger.error(traceback.format_exc())
+ ret = [1, ex.message if ex.message else str(sys.exc_info())]
+ except:
+ logger.error(traceback.format_exc())
+ ret = [1, str(sys.exc_info())]
+ logger.info("[%s]ret=%s" % (funname, ret))
+ return ret
+
+ def force_login(self, connectInfo):
+ if self.apiImpl:
+ logger.info("call %s(%s)" % (fun_name(), connectInfo))
+ try:
+ self.authInfo = self.apiImpl.login(connectInfo)
+ except VimException as e:
+ self.authInfo = [1, e.message]
+ except Exception as ex:
+ logger.error(traceback.format_exc())
+ logger.error(str(sys.exc_info()))
+ self.authInfo = [1, ex.message if ex.message else str(sys.exc_info())]
+ except:
+ logger.error(traceback.format_exc())
+ self.authInfo = [1, str(sys.exc_info())]
+ logger.info("self.authInfo=%s" % self.authInfo)
+
+ def query_net(self, net_id):
+ return self.api_call(fun_name(), self.apiImpl.query_net, net_id)
+
+ def query_nets(self):
+ return self.api_call(fun_name(), self.apiImpl.query_nets)
+
+ def query_subnet(self, subnet_id):
+ return self.api_call(fun_name(), self.apiImpl.query_subnet, subnet_id)
+
+ def query_port(self, port_id):
+ return self.api_call(fun_name(), self.apiImpl.query_port, port_id)
+
+ def create_image(self, data):
+ return self.api_call(fun_name(), self.apiImpl.create_image, data)
+
+ def get_image(self, image_id):
+ return self.api_call(fun_name(), self.apiImpl.get_image, image_id)
+
+ def get_images(self):
+ return self.api_call(fun_name(), self.apiImpl.get_images)
+
+ def delete_image(self, image_id):
+ return self.api_call(fun_name(), self.apiImpl.delete_image, image_id)
+
+ def create_network(self, data):
+ return self.api_call(fun_name(), self.apiImpl.create_network, data)
+
+ def delete_network(self, network_id):
+ return self.api_call(fun_name(), self.apiImpl.delete_network, network_id)
+
+ def delete_subnet(self, subnet_id):
+ return self.api_call(fun_name(), self.apiImpl.delete_subnet, subnet_id)
+
+ def create_port(self, data):
+ return self.api_call(fun_name(), self.apiImpl.create_port, data)
+
+ def delete_port(self, port_id):
+ return self.api_call(fun_name(), self.apiImpl.delete_port, port_id)
diff --git a/vio/pub/vim/vimapi/__init__.py b/vio/pub/vim/vimapi/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/pub/vim/vimapi/__init__.py
diff --git a/vio/pub/vim/vimapi/__init__.pyc b/vio/pub/vim/vimapi/__init__.pyc
new file mode 100644
index 0000000..d7d4d7e
--- /dev/null
+++ b/vio/pub/vim/vimapi/__init__.pyc
Binary files differ
diff --git a/vio/pub/vim/vimapi/baseclient.py b/vio/pub/vim/vimapi/baseclient.py
new file mode 100644
index 0000000..902e887
--- /dev/null
+++ b/vio/pub/vim/vimapi/baseclient.py
@@ -0,0 +1,85 @@
+# 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 copy
+
+import logging
+
+from vio.pub.vim.drivers import vimdriver as driver_base
+
+LOG = logging.getLogger(__name__)
+
+
+class baseclient(object):
+
+
+ def __init__(self, **kwargs):
+
+ # initialize clients
+ self._computeclient = None
+ self._networkclient = None
+ self._orchestrationclient = None
+ self._identityclient = None
+
+
+ def identity(self, data):
+ '''Construct compute client based on object.
+
+ :param obj: Object for which the client is created. It is expected to
+ be None when retrieving an existing client. When creating
+ a client, it contains the user and project to be used.
+ '''
+
+ if self._identityclient is not None:
+ return self._identityclient
+ self._identityclient = driver_base.VimDriver().identity(data)
+ return self._identityclient
+
+ def compute(self, data):
+ '''Construct compute client based on object.
+
+ :param obj: Object for which the client is created. It is expected to
+ be None when retrieving an existing client. When creating
+ a client, it contains the user and project to be used.
+ '''
+
+ if self._computeclient is not None:
+ return self._computeclient
+ self._computeclient = driver_base.VimDriver().compute(data)
+ return self._computeclient
+
+ def network(self, obj):
+ """Construct network client based on object.
+
+ :param obj: Object for which the client is created. It is expected to
+ be None when retrieving an existing client. When creating
+ a client, it contains the user and project to be used.
+ """
+ if self._networkclient is not None:
+ return self._networkclient
+ params = self._build_conn_params(obj.user, obj.project)
+ self._networkclient = driver_base.VimDriver().network(params)
+ return self._networkclient
+
+ def orchestration(self, obj):
+ """Construct orchestration client based on object.
+
+ :param obj: Object for which the client is created. It is expected to
+ be None when retrieving an existing client. When creating
+ a client, it contains the user and project to be used.
+ """
+ if self._orchestrationclient is not None:
+ return self._orchestrationclient
+ params = self._build_conn_params(obj.user, obj.project)
+ oc = driver_base.VimDriver().orchestration(params)
+ self._orchestrationclient = oc
+ return oc
diff --git a/vio/pub/vim/vimapi/baseclient.pyc b/vio/pub/vim/vimapi/baseclient.pyc
new file mode 100644
index 0000000..6baced3
--- /dev/null
+++ b/vio/pub/vim/vimapi/baseclient.pyc
Binary files differ
diff --git a/vio/pub/vim/vimapi/compute/OperatorInstance.py b/vio/pub/vim/vimapi/compute/OperatorInstance.py
new file mode 100644
index 0000000..c1c0a80
--- /dev/null
+++ b/vio/pub/vim/vimapi/compute/OperatorInstance.py
@@ -0,0 +1,46 @@
+# Copyright 2016 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 vio.pub.msapi import extsys
+from vio.pub.vim.vimapi.baseclient import baseclient
+
+logger = logging.getLogger(__name__)
+
+
+class OperatorInstance(baseclient):
+ def __init__(self, data):
+ self._novaclient = None
+
+ def create_image(self, data):
+ pass
+
+ def list_images(self, data):
+ pass
+
+ def delete_image(self, data):
+ pass
+
+ def get_image(self, data):
+ kwargs = {}
+ image = self.compute(obj).image_find(name_or_id)
+
+ # wait for new version of openstacksdk to fix this
+ kwargs.pop(self.IMAGE)
+ kwargs['imageRef'] = image.id
+
+
diff --git a/vio/pub/vim/vimapi/compute/__init__.py b/vio/pub/vim/vimapi/compute/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/pub/vim/vimapi/compute/__init__.py
diff --git a/vio/pub/vim/vimapi/glance/OperateImage.py b/vio/pub/vim/vimapi/glance/OperateImage.py
new file mode 100644
index 0000000..34787b3
--- /dev/null
+++ b/vio/pub/vim/vimapi/glance/OperateImage.py
@@ -0,0 +1,52 @@
+# Copyright 2016 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 vio.pub.msapi import extsys
+
+logger = logging.getLogger(__name__)
+
+
+class OperatorImage(object):
+ def __init__(self, data):
+ self.ns_model_data = data["ns_model_data"]
+ self.fp_inst_id = data["fpinstid"]
+ self.flow_classifiers_model = get_fp_model_by_fp_inst_id(data["ns_model_data"], self.fp_inst_id)["properties"][
+ "policy"]
+ self.sdnControllerId = ""
+ self.url = ""
+ self.dscp = ""
+ self.ip_proto = ""
+ self.source_port_range = ""
+ self.dest_port_range = ""
+ self.source_ip_range = ""
+ self.dest_ip_range = ""
+ self.flow_classfier_id = ""
+
+
+ def create_image(self, data):
+ pass
+
+ def list_images(self, data):
+ pass
+
+ def delete_image(self, data):
+ pass
+
+ def get_image(self, data):
+ pass
+
diff --git a/vio/pub/vim/vimapi/glance/OperateImage.pyc b/vio/pub/vim/vimapi/glance/OperateImage.pyc
new file mode 100644
index 0000000..9de7e08
--- /dev/null
+++ b/vio/pub/vim/vimapi/glance/OperateImage.pyc
Binary files differ
diff --git a/vio/pub/vim/vimapi/glance/__init__.py b/vio/pub/vim/vimapi/glance/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/pub/vim/vimapi/glance/__init__.py
diff --git a/vio/pub/vim/vimapi/glance/__init__.pyc b/vio/pub/vim/vimapi/glance/__init__.pyc
new file mode 100644
index 0000000..9c9d4f6
--- /dev/null
+++ b/vio/pub/vim/vimapi/glance/__init__.pyc
Binary files differ
diff --git a/vio/pub/vim/vimapi/keystone/OperateTenant.py b/vio/pub/vim/vimapi/keystone/OperateTenant.py
new file mode 100644
index 0000000..31e1752
--- /dev/null
+++ b/vio/pub/vim/vimapi/keystone/OperateTenant.py
@@ -0,0 +1,38 @@
+# Copyright 2016 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 vio.pub.msapi import extsys
+from vio.pub.vim.vimapi.baseclient import baseclient
+
+logger = logging.getLogger(__name__)
+
+
+
+class OperateTenant(baseclient):
+
+ def get_projects(self, data):
+ param = {}
+ param['username'] = data['username']
+ param['user_domain_name'] = 'default'
+ param['project_domain_name'] = 'default'
+ param['password'] = data['password']
+ param['auth_url'] = data['url']
+ param['project_name'] = data['project_name']
+ projects = self.identity(param).project_list()
+ return projects
+
diff --git a/vio/pub/vim/vimapi/keystone/OperateTenant.pyc b/vio/pub/vim/vimapi/keystone/OperateTenant.pyc
new file mode 100644
index 0000000..9196c81
--- /dev/null
+++ b/vio/pub/vim/vimapi/keystone/OperateTenant.pyc
Binary files differ
diff --git a/vio/pub/vim/vimapi/keystone/__init__.py b/vio/pub/vim/vimapi/keystone/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/pub/vim/vimapi/keystone/__init__.py
diff --git a/vio/pub/vim/vimapi/keystone/__init__.pyc b/vio/pub/vim/vimapi/keystone/__init__.pyc
new file mode 100644
index 0000000..8077715
--- /dev/null
+++ b/vio/pub/vim/vimapi/keystone/__init__.pyc
Binary files differ
diff --git a/vio/pub/vim/vimapi/keystone/auth.py b/vio/pub/vim/vimapi/keystone/auth.py
new file mode 100644
index 0000000..86f03c2
--- /dev/null
+++ b/vio/pub/vim/vimapi/keystone/auth.py
@@ -0,0 +1,27 @@
+# Copyright 2016 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 vio.pub.msapi import extsys
+from vio.pub.vim.drivers import base
+
+logger = logging.getLogger(__name__)
+
+def login(data):
+
+ print data
+
diff --git a/vio/pub/vim/vimapi/neutron/__init__.py b/vio/pub/vim/vimapi/neutron/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/vio/pub/vim/vimapi/neutron/__init__.py
diff --git a/vio/samples/__init__.py b/vio/samples/__init__.py
new file mode 100644
index 0000000..54147e8
--- /dev/null
+++ b/vio/samples/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017 VMware 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/vio/samples/__init__.pyc b/vio/samples/__init__.pyc
new file mode 100644
index 0000000..7329b4c
--- /dev/null
+++ b/vio/samples/__init__.pyc
Binary files differ
diff --git a/vio/samples/tests.py b/vio/samples/tests.py
new file mode 100644
index 0000000..79301f1
--- /dev/null
+++ b/vio/samples/tests.py
@@ -0,0 +1,32 @@
+# Copyright 2016 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/vio/samples/urls.py b/vio/samples/urls.py
new file mode 100644
index 0000000..92ad162
--- /dev/null
+++ b/vio/samples/urls.py
@@ -0,0 +1,19 @@
+# Copyright 2016 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 vio.samples import views
+
+urlpatterns = [
+ url(r'^samples/$', views.SampleList.as_view()), ]
diff --git a/vio/samples/urls.pyc b/vio/samples/urls.pyc
new file mode 100644
index 0000000..931994b
--- /dev/null
+++ b/vio/samples/urls.pyc
Binary files differ
diff --git a/vio/samples/views.py b/vio/samples/views.py
new file mode 100644
index 0000000..f70090f
--- /dev/null
+++ b/vio/samples/views.py
@@ -0,0 +1,29 @@
+# Copyright 2016 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/vio/samples/views.pyc b/vio/samples/views.pyc
new file mode 100644
index 0000000..0dd719e
--- /dev/null
+++ b/vio/samples/views.pyc
Binary files differ
diff --git a/vio/settings.py b/vio/settings.py
new file mode 100644
index 0000000..ff15a95
--- /dev/null
+++ b/vio/settings.py
@@ -0,0 +1,143 @@
+# Copyright 2016 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 vio.pub.config.config import REDIS_HOST, REDIS_PORT, REDIS_PASSWD
+from vio.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',
+ 'vio.pub.database'
+]
+
+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 = 'vio.urls'
+
+WSGI_APPLICATION = 'vio.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': {
+ 'vio_handler': {
+ 'level': 'DEBUG',
+ 'class': 'logging.handlers.RotatingFileHandler',
+ 'filename': os.path.join(BASE_DIR, 'logs/runtime_vio.log'),
+ 'formatter': 'standard',
+ 'maxBytes': 1024 * 1024 * 50,
+ 'backupCount': 5,
+ },
+ },
+
+ 'loggers': {
+ 'vio': {
+ 'handlers': ['vio_handler'],
+ 'level': 'DEBUG',
+ 'propagate': False
+ },
+ }
+}
+
+if 'test' in sys.argv:
+ from vio.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/vio/settings.pyc b/vio/settings.pyc
new file mode 100644
index 0000000..55d242d
--- /dev/null
+++ b/vio/settings.pyc
Binary files differ
diff --git a/vio/urls.py b/vio/urls.py
new file mode 100644
index 0000000..25acc75
--- /dev/null
+++ b/vio/urls.py
@@ -0,0 +1,27 @@
+# Copyright 2016 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 vio.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
+
+urlpatterns = [
+ url(r'^', include('vio.samples.urls')),
+ url(r'^', include('vio.pub.vim.urls')),
+]
+
+# regist to MSB when startup
+if REG_TO_MSB_WHEN_START:
+ import json
+ from vio.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/vio/urls.pyc b/vio/urls.pyc
new file mode 100644
index 0000000..8f8eddb
--- /dev/null
+++ b/vio/urls.pyc
Binary files differ
diff --git a/vio/wsgi.py b/vio/wsgi.py
new file mode 100644
index 0000000..139bcf8
--- /dev/null
+++ b/vio/wsgi.py
@@ -0,0 +1,22 @@
+# Copyright 2016 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", "vio.settings")
+
+application = get_wsgi_application()
diff --git a/vio/wsgi.pyc b/vio/wsgi.pyc
new file mode 100644
index 0000000..66412ed
--- /dev/null
+++ b/vio/wsgi.pyc
Binary files differ