create base package 'osm_ro_plugin' for plugin 48/8848/7
authortierno <alfonso.tiernosepulveda@telefonica.com>
Mon, 4 May 2020 11:44:15 +0000 (11:44 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 17 Jun 2020 10:08:24 +0000 (10:08 +0000)
contains base packabe, dummy and failing connectors

All plugins will require this package instead of osm_ro
In that way plugin development is more independent
from main project, and it can be re-used in other projects.
For example openvim can use these SDN plugins without importing osm_ro

Change-Id: I9b598fdca269f04391e731cd07bb244f3918635d
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
97 files changed:
Dockerfile-local
RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision/wimconn_arista.py
RO-SDN-arista_cloudvision/requirements.txt
RO-SDN-arista_cloudvision/setup.py
RO-SDN-arista_cloudvision/stdeb.cfg
RO-SDN-dpb/osm_rosdn_dpb/wimconn_dpb.py
RO-SDN-dpb/requirements.txt
RO-SDN-dpb/setup.py
RO-SDN-dpb/stdeb.cfg
RO-SDN-dynpac/osm_rosdn_dynpac/wimconn_dynpac.py
RO-SDN-dynpac/requirements.txt
RO-SDN-dynpac/setup.py
RO-SDN-dynpac/stdeb.cfg
RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/floodlight_of.py
RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/sdnconn_floodlightof.py
RO-SDN-floodlight_openflow/requirements.txt
RO-SDN-floodlight_openflow/setup.py
RO-SDN-floodlight_openflow/stdeb.cfg
RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py
RO-SDN-ietfl2vpn/requirements.txt
RO-SDN-ietfl2vpn/setup.py
RO-SDN-ietfl2vpn/stdeb.cfg
RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py
RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_assist_juniper_contrail.py
RO-SDN-juniper_contrail/requirements.txt
RO-SDN-juniper_contrail/setup.py
RO-SDN-juniper_contrail/stdeb.cfg
RO-SDN-odl_openflow/osm_rosdn_odlof/odl_of.py
RO-SDN-odl_openflow/osm_rosdn_odlof/sdnconn_odlof.py
RO-SDN-odl_openflow/requirements.txt
RO-SDN-odl_openflow/setup.py
RO-SDN-odl_openflow/stdeb.cfg
RO-SDN-onos_openflow/osm_rosdn_onosof/onos_of.py
RO-SDN-onos_openflow/osm_rosdn_onosof/sdnconn_onosof.py
RO-SDN-onos_openflow/requirements.txt
RO-SDN-onos_openflow/setup.py
RO-SDN-onos_openflow/stdeb.cfg
RO-SDN-onos_vpls/osm_rosdn_onos_vpls/sdn_assist_onos_vpls.py
RO-SDN-onos_vpls/requirements.txt
RO-SDN-onos_vpls/setup.py
RO-SDN-onos_vpls/stdeb.cfg
RO-VIM-aws/osm_rovim_aws/vimconn_aws.py
RO-VIM-aws/requirements.txt
RO-VIM-aws/setup.py
RO-VIM-aws/stdeb.cfg
RO-VIM-azure/osm_rovim_azure/vimconn_azure.py
RO-VIM-azure/requirements.txt
RO-VIM-azure/setup.py
RO-VIM-azure/stdeb.cfg
RO-VIM-fos/osm_rovim_fos/vimconn_fos.py
RO-VIM-fos/requirements.txt
RO-VIM-fos/setup.py
RO-VIM-fos/stdeb.cfg
RO-VIM-opennebula/osm_rovim_opennebula/vimconn_opennebula.py
RO-VIM-opennebula/requirements.txt
RO-VIM-opennebula/setup.py
RO-VIM-opennebula/stdeb.cfg
RO-VIM-openstack/osm_rovim_openstack/tests/test_vimconn_openstack.py
RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py
RO-VIM-openstack/requirements.txt
RO-VIM-openstack/setup.py
RO-VIM-openstack/stdeb.cfg
RO-VIM-openvim/osm_rovim_openvim/vimconn_openvim.py
RO-VIM-openvim/requirements.txt
RO-VIM-openvim/setup.py
RO-VIM-openvim/stdeb.cfg
RO-VIM-vmware/osm_rovim_vmware/tests/test_vimconn_vmware.py
RO-VIM-vmware/osm_rovim_vmware/vimconn_vmware.py
RO-VIM-vmware/requirements.txt
RO-VIM-vmware/setup.py
RO-VIM-vmware/stdeb.cfg
RO-client/stdeb.cfg
RO-plugin/Makefile [new file with mode: 0644]
RO-plugin/osm_ro_plugin/openflow_conn.py [new file with mode: 0644]
RO-plugin/osm_ro_plugin/sdn_dummy.py [new file with mode: 0644]
RO-plugin/osm_ro_plugin/sdn_failing.py [new file with mode: 0644]
RO-plugin/osm_ro_plugin/sdnconn.py [new file with mode: 0644]
RO-plugin/osm_ro_plugin/vim_dummy.py [new file with mode: 0644]
RO-plugin/osm_ro_plugin/vimconn.py [new file with mode: 0644]
RO-plugin/requirements.txt [new file with mode: 0644]
RO-plugin/setup.py [new file with mode: 0644]
RO-plugin/stdeb.cfg [new file with mode: 0644]
RO-plugin/tox.ini [new file with mode: 0644]
RO/osm_ro/nfvo.py
RO/osm_ro/vim_dummy.py [deleted file]
RO/osm_ro/vim_thread.py
RO/osm_ro/vimconn.py [deleted file]
RO/osm_ro/vmwarecli.py
RO/osm_ro/wim/failing_connector.py [deleted file]
RO/osm_ro/wim/openflow_conn.py [deleted file]
RO/osm_ro/wim/sdnconn.py [deleted file]
RO/osm_ro/wim/wan_link_actions.py
RO/osm_ro/wim/wim_thread.py
RO/osm_ro/wim/wimconn_dummy.py [deleted file]
RO/stdeb.cfg
devops-stages/stage-build.sh
test-docker/test-gen-devops.sh

index d8c8432..97d804a 100644 (file)
@@ -48,6 +48,7 @@ COPY . /root/RO
 
 RUN /root/RO/RO/osm_ro/scripts/install-osm-im.sh --develop && \
     mkdir -p /var/log/osm && \
 
 RUN /root/RO/RO/osm_ro/scripts/install-osm-im.sh --develop && \
     mkdir -p /var/log/osm && \
+    python3 -m pip install -e /root/RO/RO-plugin && \
     python3 -m pip install -e /root/RO/RO && \
     python3 -m pip install -e /root/RO/RO-client && \
     python3 -m pip install -e /root/RO/RO-VIM-vmware && \
     python3 -m pip install -e /root/RO/RO && \
     python3 -m pip install -e /root/RO/RO-client && \
     python3 -m pip install -e /root/RO/RO-VIM-vmware && \
index 37f4c58..ca8e58f 100644 (file)
@@ -26,7 +26,7 @@
 #
 # This work has been performed in the context of Arista Telefonica OSM PoC.
 ##
 #
 # This work has been performed in the context of Arista Telefonica OSM PoC.
 ##
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
 import re
 import socket
 # Required by compare function
 import re
 import socket
 # Required by compare function
index cd1edfe..a4ac97e 100644 (file)
@@ -16,5 +16,4 @@
 requests
 uuid
 cvprac
 requests
 uuid
 cvprac
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index ab8385b..33bd29f 100644 (file)
@@ -36,18 +36,20 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='oscarluis.peral@atos.net',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='Oscar Luis Peral',
+    maintainer_email='oscarluis.peral@atos.net',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     packages=[_name],
     include_package_data=True,
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     packages=[_name],
     include_package_data=True,
-    install_requires=["requests",
-                      "uuid",
-                      "cvprac",
-                      "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"],
+    install_requires=[
+        "requests",
+        "uuid",
+        "cvprac",
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
+    ],
     setup_requires=['setuptools-version-command'],
     entry_points={
         'osm_rosdn.plugins': ['rosdn_arista_cloudvision = osm_rosdn_arista_cloudvision.'
     setup_requires=['setuptools-version-command'],
     entry_points={
         'osm_rosdn.plugins': ['rosdn_arista_cloudvision = osm_rosdn_arista_cloudvision.'
index 0c718e4..d1ff8c6 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
+Depends3: python3-requests, python3-osm-ro-plugin, python3-pip
 
 
index 31072c3..27f739f 100755 (executable)
@@ -31,7 +31,7 @@ import paramiko
 import requests
 import struct
 import sys
 import requests
 import struct
 import sys
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
 
 
 class DpbSshInterface():
 
 
 class DpbSshInterface():
index 16035fc..354756f 100644 (file)
@@ -15,5 +15,6 @@
 
 paramiko
 requests
 
 paramiko
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
+
 
 
index 6e1f9a7..2d869f9 100644 (file)
@@ -36,16 +36,20 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     packages=[_name],
     include_package_data=True,
     dependency_links=["git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro"],
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     packages=[_name],
     include_package_data=True,
     dependency_links=["git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro"],
-    install_requires=["paramiko", "requests", "osm-ro"],
+    install_requires=[
+        "paramiko",
+        "requests",
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin",
+    ],
     setup_requires=['setuptools-version-command'],
     entry_points={
         'osm_rosdn.plugins': ['rosdn_dpb = osm_rosdn_dpb.wimconn_dpb:DpbConnector'],
     setup_requires=['setuptools-version-command'],
     entry_points={
         'osm_rosdn.plugins': ['rosdn_dpb = osm_rosdn_dpb.wimconn_dpb:DpbConnector'],
index 8c82164..c2228df 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-paramiko, python3-requests, python3-osm-ro
+Depends3: python3-paramiko, python3-requests, python3-osm-ro-plugin
 
 
index b32856b..c99627c 100644 (file)
@@ -26,7 +26,7 @@ import json
 import logging
 from enum import Enum
 
 import logging
 from enum import Enum
 
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
 
 
 class SdnError(Enum):
 
 
 class SdnError(Enum):
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index af69a0d..a1c7c71 100644 (file)
@@ -36,9 +36,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -46,7 +46,7 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests",
     include_package_data=True,
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..dea4d92 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
+Depends3: python3-requests, python3-osm-ro-plugin
 
 
index a274000..d4c7e3f 100644 (file)
@@ -34,7 +34,7 @@ __date__ = "$28-oct-2014 12:07:15$"
 import json
 import requests
 import logging
 import json
 import requests
 import logging
-from osm_ro.wim.openflow_conn import OpenflowConn, OpenflowConnUnexpectedResponse, OpenflowConnConnectionException
+from osm_ro_plugin.openflow_conn import OpenflowConn, OpenflowConnUnexpectedResponse, OpenflowConnConnectionException
 
 
 class OfConnFloodLight(OpenflowConn):
 
 
 class OfConnFloodLight(OpenflowConn):
index 6d90fe9..3303a4d 100644 (file)
@@ -20,7 +20,7 @@
 """
 
 import logging
 """
 
 import logging
-from osm_ro.wim.openflow_conn import SdnConnectorOpenFlow
+from osm_ro_plugin.openflow_conn import SdnConnectorOpenFlow
 from .floodlight_of import OfConnFloodLight
 
 
 from .floodlight_of import OfConnFloodLight
 
 
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index d5b9848..faf1ce7 100644 (file)
@@ -46,7 +46,7 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests",
     include_package_data=True,
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..f5f8e83 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
-
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
+Depends3: python3-requests, python3-osm-ro-plugin
index 26680b5..9b67fc1 100644 (file)
@@ -33,7 +33,7 @@ the Layer 2 service.
 import requests
 import uuid
 import logging
 import requests
 import uuid
 import logging
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
 """CHeck layer where we move it"""
 
 
 """CHeck layer where we move it"""
 
 
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 9db91ef..70be60b 100644 (file)
@@ -36,9 +36,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -47,7 +47,7 @@ setup(
     dependency_links=["git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro"],
     install_requires=[
         "requests",
     dependency_links=["git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro"],
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..dea4d92 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
+Depends3: python3-requests, python3-osm-ro-plugin
 
 
index c99452b..c8cca22 100644 (file)
@@ -17,7 +17,7 @@
 import logging
 import json
 
 import logging
 import json
 
-from osm_ro.wim.sdnconn import SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorError
 from osm_rosdn_juniper_contrail.rest_lib import ContrailHttp
 from osm_rosdn_juniper_contrail.rest_lib import NotFound
 # from osm_rosdn_juniper_contrail.rest_lib import DuplicateFound
 from osm_rosdn_juniper_contrail.rest_lib import ContrailHttp
 from osm_rosdn_juniper_contrail.rest_lib import NotFound
 # from osm_rosdn_juniper_contrail.rest_lib import DuplicateFound
index 0bbe734..43bfb87 100644 (file)
@@ -21,7 +21,7 @@ import logging
 import yaml
 import random
 
 import yaml
 import random
 
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
 # from osm_rosdn_juniper_contrail.rest_lib import ContrailHttp
 # from osm_rosdn_juniper_contrail.rest_lib import NotFound
 from osm_rosdn_juniper_contrail.rest_lib import DuplicateFound
 # from osm_rosdn_juniper_contrail.rest_lib import ContrailHttp
 # from osm_rosdn_juniper_contrail.rest_lib import NotFound
 from osm_rosdn_juniper_contrail.rest_lib import DuplicateFound
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 40f04d1..fef5905 100644 (file)
@@ -47,7 +47,7 @@ setup(
     #dependency_links=["git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro"],
     install_requires=[
         "requests",
     #dependency_links=["git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro"],
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..dea4d92 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
+Depends3: python3-requests, python3-osm-ro-plugin
 
 
index 1cfd0a4..329cb66 100644 (file)
@@ -32,7 +32,7 @@ import json
 import requests
 import base64
 import logging
 import requests
 import base64
 import logging
-from osm_ro.wim.openflow_conn import OpenflowConn, OpenflowConnException, OpenflowConnConnectionException, \
+from osm_ro_plugin.openflow_conn import OpenflowConn, OpenflowConnException, OpenflowConnConnectionException, \
     OpenflowConnUnexpectedResponse, OpenflowConnAuthException, OpenflowConnNotFoundException, \
     OpenflowConnConflictException, OpenflowConnNotSupportedException, OpenflowConnNotImplemented
 
     OpenflowConnUnexpectedResponse, OpenflowConnAuthException, OpenflowConnNotFoundException, \
     OpenflowConnConflictException, OpenflowConnNotSupportedException, OpenflowConnNotImplemented
 
index 2850be4..190372a 100644 (file)
@@ -20,7 +20,7 @@
 """
 
 import logging
 """
 
 import logging
-from osm_ro.wim.openflow_conn import SdnConnectorOpenFlow
+from osm_ro_plugin.openflow_conn import SdnConnectorOpenFlow
 from .odl_of import OfConnOdl
 
 
 from .odl_of import OfConnOdl
 
 
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index cdebc41..32ebde1 100644 (file)
@@ -46,7 +46,7 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests",
     include_package_data=True,
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..f5f8e83 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
-
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
+Depends3: python3-requests, python3-osm-ro-plugin
index 139f7a0..fb09327 100644 (file)
@@ -36,7 +36,7 @@ import json
 import requests
 import base64
 import logging
 import requests
 import base64
 import logging
-from osm_ro.wim.openflow_conn import OpenflowConn, OpenflowConnException, OpenflowConnConnectionException, \
+from osm_ro_plugin.openflow_conn import OpenflowConn, OpenflowConnException, OpenflowConnConnectionException, \
     OpenflowConnUnexpectedResponse, OpenflowConnAuthException, OpenflowConnNotFoundException, \
     OpenflowConnConflictException, OpenflowConnNotSupportedException, OpenflowConnNotImplemented
 
     OpenflowConnUnexpectedResponse, OpenflowConnAuthException, OpenflowConnNotFoundException, \
     OpenflowConnConflictException, OpenflowConnNotSupportedException, OpenflowConnNotImplemented
 
index e33994a..c5e081a 100644 (file)
@@ -20,7 +20,7 @@
 """
 
 import logging
 """
 
 import logging
-from osm_ro.wim.openflow_conn import SdnConnectorOpenFlow
+from osm_ro_plugin.openflow_conn import SdnConnectorOpenFlow
 from .onos_of import OfConnOnos
 
 
 from .onos_of import OfConnOnos
 
 
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 96e6b62..66427b2 100644 (file)
@@ -46,7 +46,7 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests",
     include_package_data=True,
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..f5f8e83 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
-
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
+Depends3: python3-requests, python3-osm-ro-plugin
index eb14f55..200e4b0 100644 (file)
@@ -27,7 +27,7 @@ import copy
 import requests
 from requests.auth import HTTPBasicAuth
 
 import requests
 from requests.auth import HTTPBasicAuth
 
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
 
 
 class OnosVpls(SdnConnectorBase):
 
 
 class OnosVpls(SdnConnectorBase):
index a6f6d65..3736678 100644 (file)
@@ -14,5 +14,4 @@
 ##
 
 requests
 ##
 
 requests
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
-
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index b015e67..562954b 100644 (file)
@@ -36,9 +36,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@list.etsi.org',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@list.etsi.org',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -46,7 +46,7 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests",
     include_package_data=True,
     install_requires=[
         "requests",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
index 0c718e4..dea4d92 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-osm-ro
+Depends3: python3-requests, python3-osm-ro-plugin
 
 
index 28dc4e9..fa24568 100644 (file)
@@ -28,7 +28,7 @@ AWS-connector implements all the methods to interact with AWS using the BOTO cli
 __author__ = "Saboor Ahmad"
 __date__ = "10-Apr-2017"
 
 __author__ = "Saboor Ahmad"
 __date__ = "10-Apr-2017"
 
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 import yaml
 import logging
 import netaddr
 import yaml
 import logging
 import netaddr
@@ -39,7 +39,7 @@ import boto.ec2
 import boto.vpc
 
 
 import boto.vpc
 
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
                  config={}, persistent_info={}):
         """ Params: uuid - id asigned to this VIM
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
                  config={}, persistent_info={}):
         """ Params: uuid - id asigned to this VIM
@@ -59,7 +59,7 @@ class vimconnector(vimconn.vimconnector):
                     empty dict. Useful to store login/tokens information for speed up communication
         """
 
                     empty dict. Useful to store login/tokens information for speed up communication
         """
 
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
                                       config, persistent_info)
 
         self.persistent_info = persistent_info
                                       config, persistent_info)
 
         self.persistent_info = persistent_info
@@ -67,15 +67,15 @@ class vimconnector(vimconn.vimconnector):
         if user:
             self.a_creds['aws_access_key_id'] = user
         else:
         if user:
             self.a_creds['aws_access_key_id'] = user
         else:
-            raise vimconn.vimconnAuthException("Username is not specified")
+            raise vimconn.VimConnAuthException("Username is not specified")
         if passwd:
             self.a_creds['aws_secret_access_key'] = passwd
         else:
         if passwd:
             self.a_creds['aws_secret_access_key'] = passwd
         else:
-            raise vimconn.vimconnAuthException("Password is not specified")
+            raise vimconn.VimConnAuthException("Password is not specified")
         if 'region_name' in config:
             self.region = config.get('region_name')
         else:
         if 'region_name' in config:
             self.region = config.get('region_name')
         else:
-            raise vimconn.vimconnException("AWS region_name is not specified at config")
+            raise vimconn.VimConnException("AWS region_name is not specified at config")
 
         self.vpc_data = {}
         self.subnet_data = {}
 
         self.vpc_data = {}
         self.subnet_data = {}
@@ -113,9 +113,9 @@ class vimconnector(vimconn.vimconnector):
                         self.flavor_info = yaml.load(flavor_data, Loader=yaml.Loader)
                 except yaml.YAMLError as e:
                     self.flavor_info = None
                         self.flavor_info = yaml.load(flavor_data, Loader=yaml.Loader)
                 except yaml.YAMLError as e:
                     self.flavor_info = None
-                    raise vimconn.vimconnException("Bad format at file '{}': {}".format(flavor_data[1:], e))
+                    raise vimconn.VimConnException("Bad format at file '{}': {}".format(flavor_data[1:], e))
                 except IOError as e:
                 except IOError as e:
-                    raise vimconn.vimconnException("Error reading file '{}': {}".format(flavor_data[1:], e))
+                    raise vimconn.VimConnException("Error reading file '{}': {}".format(flavor_data[1:], e))
             elif isinstance(flavor_data, dict):
                 self.flavor_info = flavor_data
 
             elif isinstance(flavor_data, dict):
                 self.flavor_info = flavor_data
 
@@ -134,7 +134,7 @@ class vimconnector(vimconn.vimconnector):
         elif index == 'region':
             self.region = value
         else:
         elif index == 'region':
             self.region = value
         else:
-            vimconn.vimconnector.__setitem__(self, index, value)
+            vimconn.VimConnector.__setitem__(self, index, value)
 
     def _reload_connection(self):
         """Returns: sets boto.EC2 and boto.VPC connection to work with AWS services
 
     def _reload_connection(self):
         """Returns: sets boto.EC2 and boto.VPC connection to work with AWS services
@@ -157,7 +157,7 @@ class vimconnector(vimconn.vimconnector):
 
         self.conn = None
         self.conn_vpc = None
 
         self.conn = None
         self.conn_vpc = None
-        raise vimconn.vimconnConnectionException(type(e).__name__ + ": " + str(e))
+        raise vimconn.VimConnConnectionException(type(e).__name__ + ": " + str(e))
 
     def get_availability_zones_list(self):
         """Obtain AvailabilityZones from AWS
 
     def get_availability_zones_list(self):
         """Obtain AvailabilityZones from AWS
@@ -251,7 +251,7 @@ class vimconnector(vimconn.vimconnector):
 
         if availability_zones != 2 and availability_zones != 3:
             self.logger.debug("Number of AZs should be 2 or 3")
 
         if availability_zones != 2 and availability_zones != 3:
             self.logger.debug("Number of AZs should be 2 or 3")
-            raise vimconn.vimconnNotSupportedException("Number of AZs should be 2 or 3")
+            raise vimconn.VimConnNotSupportedException("Number of AZs should be 2 or 3")
 
         netmasks = ('255.255.252.0', '255.255.254.0', '255.255.255.0', '255.255.255.128')
         ip = netaddr.IPNetwork(cidr)
 
         netmasks = ('255.255.252.0', '255.255.254.0', '255.255.255.0', '255.255.255.128')
         ip = netaddr.IPNetwork(cidr)
@@ -259,7 +259,7 @@ class vimconnector(vimconn.vimconnector):
 
         if str(mask) not in netmasks:
             self.logger.debug("Netmask " + str(mask) + " not found")
 
         if str(mask) not in netmasks:
             self.logger.debug("Netmask " + str(mask) + " not found")
-            raise vimconn.vimconnNotFoundException("Netmask " + str(mask) + " not found")
+            raise vimconn.VimConnNotFoundException("Netmask " + str(mask) + " not found")
 
         if availability_zones == 2:
             for n, netmask in enumerate(netmasks):
 
         if availability_zones == 2:
             for n, netmask in enumerate(netmasks):
@@ -459,7 +459,7 @@ class vimconnector(vimconn.vimconnector):
             if flavor_id in self.flavor_info:
                 return self.flavor_info[flavor_id]
             else:
             if flavor_id in self.flavor_info:
                 return self.flavor_info[flavor_id]
             else:
-                raise vimconn.vimconnNotFoundException("Cannot find flavor with this flavor ID/Name")
+                raise vimconn.VimConnNotFoundException("Cannot find flavor with this flavor ID/Name")
         except Exception as e:
             self.format_vimconn_exception(e)
 
         except Exception as e:
             self.format_vimconn_exception(e)
 
@@ -492,7 +492,7 @@ class vimconnector(vimconn.vimconnector):
                             flavor = (key, values)
             if flavor:
                 return flavor[0]
                             flavor = (key, values)
             if flavor:
                 return flavor[0]
-            raise vimconn.vimconnNotFoundException("Cannot find flavor with this flavor ID/Name")
+            raise vimconn.VimConnNotFoundException("Cannot find flavor with this flavor ID/Name")
         except Exception as e:
             self.format_vimconn_exception(e)
 
         except Exception as e:
             self.format_vimconn_exception(e)
 
index 3cbc851..689089e 100644 (file)
@@ -17,4 +17,4 @@ PyYAML
 requests
 netaddr
 boto
 requests
 netaddr
 boto
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index b8f3703..12de705 100644 (file)
@@ -36,9 +36,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -46,10 +46,10 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests", "netaddr", "PyYAML", "boto",
     include_package_data=True,
     install_requires=[
         "requests", "netaddr", "PyYAML", "boto",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_aws = osm_rovim_aws.vimconn_aws'],
+        'osm_rovim.plugins': ['rovim_aws = osm_rovim_aws.vimconn_aws:vimconnector'],
     },
 )
     },
 )
index 2193709..eece4e1 100644 (file)
@@ -15,4 +15,4 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-boto, python3-requests, python3-netaddr, python3-yaml, python3-osm-ro
+Depends3: python3-boto, python3-requests, python3-netaddr, python3-yaml, python3-osm-ro-plugin
index fc36638..dc40817 100755 (executable)
@@ -14,7 +14,7 @@
 ##
 
 import base64
 ##
 
 import base64
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 import logging
 import netaddr
 import re
 import logging
 import netaddr
 import re
@@ -41,7 +41,7 @@ if getenv('OSMRO_PDB_DEBUG'):
     pdb.set_trace()
 
 
     pdb.set_trace()
 
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
 
     # Translate azure provisioning state to OSM provision state
     # The first three ones are the transitional status once a user initiated action has been requested
 
     # Translate azure provisioning state to OSM provision state
     # The first three ones are the transitional status once a user initiated action has been requested
@@ -85,7 +85,7 @@ class vimconnector(vimconn.vimconnector):
             "^Standard_B" will select a serie B maybe for test environment
         """
 
             "^Standard_B" will select a serie B maybe for test environment
         """
 
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
                                       config, persistent_info)
 
         # Variable that indicates if client must be reloaded or initialized
                                       config, persistent_info)
 
         # Variable that indicates if client must be reloaded or initialized
@@ -112,19 +112,19 @@ class vimconnector(vimconn.vimconnector):
             self._config["subscription_id"] = config.get('subscription_id')
             # self.logger.debug('Setting subscription to: %s', self.config["subscription_id"])
         else:
             self._config["subscription_id"] = config.get('subscription_id')
             # self.logger.debug('Setting subscription to: %s', self.config["subscription_id"])
         else:
-            raise vimconn.vimconnException('Subscription not specified')
+            raise vimconn.VimConnException('Subscription not specified')
 
         # REGION
         if 'region_name' in config:
             self.region = config.get('region_name')
         else:
 
         # REGION
         if 'region_name' in config:
             self.region = config.get('region_name')
         else:
-            raise vimconn.vimconnException('Azure region_name is not specified at config')
+            raise vimconn.VimConnException('Azure region_name is not specified at config')
 
         # RESOURCE_GROUP
         if 'resource_group' in config:
             self.resource_group = config.get('resource_group')
         else:
 
         # RESOURCE_GROUP
         if 'resource_group' in config:
             self.resource_group = config.get('resource_group')
         else:
-            raise vimconn.vimconnException('Azure resource_group is not specified at config')
+            raise vimconn.VimConnException('Azure resource_group is not specified at config')
 
         # VNET_NAME
         if 'vnet_name' in config:
 
         # VNET_NAME
         if 'vnet_name' in config:
@@ -168,7 +168,7 @@ class vimconnector(vimconn.vimconnector):
             resource = str(resource_id.split('/')[-1])
             return resource
         except Exception as e:
             resource = str(resource_id.split('/')[-1])
             return resource
         except Exception as e:
-            raise vimconn.vimconnException("Unable to get resource name from resource_id '{}' Error: '{}'".
+            raise vimconn.VimConnException("Unable to get resource name from resource_id '{}' Error: '{}'".
                                            format(resource_id, e))
 
     def _get_location_from_resource_group(self, resource_group_name):
                                            format(resource_id, e))
 
     def _get_location_from_resource_group(self, resource_group_name):
@@ -176,7 +176,7 @@ class vimconnector(vimconn.vimconnector):
             location = self.conn.resource_groups.get(resource_group_name).location
             return location
         except Exception as e:
             location = self.conn.resource_groups.get(resource_group_name).location
             return location
         except Exception as e:
-            raise vimconn.vimconnNotFoundException("Location '{}' not found".format(resource_group_name))
+            raise vimconn.VimConnNotFoundException("Location '{}' not found".format(resource_group_name))
 
     def _get_resource_group_name_from_resource_id(self, resource_id):
 
 
     def _get_resource_group_name_from_resource_id(self, resource_id):
 
@@ -184,7 +184,7 @@ class vimconnector(vimconn.vimconnector):
             rg = str(resource_id.split('/')[4])
             return rg
         except Exception as e:
             rg = str(resource_id.split('/')[4])
             return rg
         except Exception as e:
-            raise vimconn.vimconnException("Unable to get resource group from invalid resource_id format '{}'".
+            raise vimconn.VimConnException("Unable to get resource group from invalid resource_id format '{}'".
                                            format(resource_id))
 
     def _get_net_name_from_resource_id(self, resource_id):
                                            format(resource_id))
 
     def _get_net_name_from_resource_id(self, resource_id):
@@ -193,7 +193,7 @@ class vimconnector(vimconn.vimconnector):
             net_name = str(resource_id.split('/')[8])
             return net_name
         except Exception as e:
             net_name = str(resource_id.split('/')[8])
             return net_name
         except Exception as e:
-            raise vimconn.vimconnException("Unable to get azure net_name from invalid resource_id format '{}'".
+            raise vimconn.VimConnException("Unable to get azure net_name from invalid resource_id format '{}'".
                                            format(resource_id))
 
     def _check_subnets_for_vm(self, net_list):
                                            format(resource_id))
 
     def _check_subnets_for_vm(self, net_list):
@@ -208,16 +208,16 @@ class vimconnector(vimconn.vimconnector):
         """
         Transforms a generic or azure exception to a vimcommException
         """
         """
         Transforms a generic or azure exception to a vimcommException
         """
-        if isinstance(e, vimconn.vimconnException):
+        if isinstance(e, vimconn.VimConnException):
             raise
         elif isinstance(e, AuthenticationError):
             raise
         elif isinstance(e, AuthenticationError):
-            raise vimconn.vimconnAuthException(type(e).__name__ + ': ' + str(e))
+            raise vimconn.VimConnAuthException(type(e).__name__ + ': ' + str(e))
         elif isinstance(e, ConnectionError):
         elif isinstance(e, ConnectionError):
-            raise vimconn.vimconnConnectionException(type(e).__name__ + ': ' + str(e))
+            raise vimconn.VimConnConnectionException(type(e).__name__ + ': ' + str(e))
         else:
             # In case of generic error recreate client
             self.reload_client = True
         else:
             # In case of generic error recreate client
             self.reload_client = True
-            raise vimconn.vimconnException(type(e).__name__ + ': ' + str(e))
+            raise vimconn.VimConnException(type(e).__name__ + ': ' + str(e))
 
     def _check_or_create_resource_group(self):
         """
 
     def _check_or_create_resource_group(self):
         """
@@ -314,7 +314,7 @@ class vimconnector(vimconn.vimconnector):
                     self.logger.debug('dinamically obtained ip_profile: %s', ip_range)
                     break
             else:
                     self.logger.debug('dinamically obtained ip_profile: %s', ip_range)
                     break
             else:
-                raise vimconn.vimconnException("Cannot find a non-used subnet range in {}".
+                raise vimconn.VimConnException("Cannot find a non-used subnet range in {}".
                                                format(self.vnet_address_space))
         else:
             ip_profile = {"subnet_address": ip_profile['subnet_address']}
                                                format(self.vnet_address_space))
         else:
             ip_profile = {"subnet_address": ip_profile['subnet_address']}
@@ -416,25 +416,25 @@ class vimconnector(vimconn.vimconnector):
         """
         It is not allowed to create new flavors in Azure, must always use an existing one
         """
         """
         It is not allowed to create new flavors in Azure, must always use an existing one
         """
-        raise vimconn.vimconnAuthException("It is not possible to create new flavors in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to create new flavors in AZURE")
 
     def new_tenant(self, tenant_name, tenant_description):
         """
         It is not allowed to create new tenants in azure
         """
 
     def new_tenant(self, tenant_name, tenant_description):
         """
         It is not allowed to create new tenants in azure
         """
-        raise vimconn.vimconnAuthException("It is not possible to create a TENANT in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to create a TENANT in AZURE")
 
     def new_image(self, image_dict):
         """
         It is not allowed to create new images in Azure, must always use an existing one
         """
 
     def new_image(self, image_dict):
         """
         It is not allowed to create new images in Azure, must always use an existing one
         """
-        raise vimconn.vimconnAuthException("It is not possible to create new images in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to create new images in AZURE")
 
     def get_image_id_from_path(self, path):
         """Get the image id from image path in the VIM database.
            Returns the image_id or raises a vimconnNotFoundException
         """
 
     def get_image_id_from_path(self, path):
         """Get the image id from image path in the VIM database.
            Returns the image_id or raises a vimconnNotFoundException
         """
-        raise vimconn.vimconnAuthException("It is not possible to obtain image from path in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to obtain image from path in AZURE")
 
     def get_image_list(self, filter_dict={}):
         """Obtain tenant images from VIM
 
     def get_image_list(self, filter_dict={}):
         """Obtain tenant images from VIM
@@ -472,10 +472,10 @@ class vimconnector(vimconn.vimconnector):
                             else:
                                 image_list = self._get_sku_image_list(publisher, offer, sku)
                 else:
                             else:
                                 image_list = self._get_sku_image_list(publisher, offer, sku)
                 else:
-                    raise vimconn.vimconnAuthException(
+                    raise vimconn.VimConnAuthException(
                         "List images in Azure must include name param with at least publisher")
             else:
                         "List images in Azure must include name param with at least publisher")
             else:
-                raise vimconn.vimconnAuthException("List images in Azure must include name param with at"
+                raise vimconn.VimConnAuthException("List images in Azure must include name param with at"
                                                    " least publisher")
 
             return image_list
                                                    " least publisher")
 
             return image_list
@@ -608,7 +608,7 @@ class vimconnector(vimconn.vimconnector):
 
         # At least one network must be provided
         if not net_list:
 
         # At least one network must be provided
         if not net_list:
-            raise vimconn.vimconnException("At least one net must be provided to create a new VM")
+            raise vimconn.VimConnException("At least one net must be provided to create a new VM")
 
         # image_id are several fields of the image_id
         image_reference = self._get_image_reference(image_id)
 
         # image_id are several fields of the image_id
         image_reference = self._get_image_reference(image_id)
@@ -778,7 +778,7 @@ class vimconnector(vimconn.vimconnector):
             else:
                 return availability_zone_list[availability_zone_index]
         else:
             else:
                 return availability_zone_list[availability_zone_index]
         else:
-            raise vimconn.vimconnConflictException("No enough availability zones at VIM for this deployment")
+            raise vimconn.VimConnConflictException("No enough availability zones at VIM for this deployment")
 
     def _get_azure_availability_zones(self):
         return self.AZURE_ZONES
 
     def _get_azure_availability_zones(self):
         return self.AZURE_ZONES
@@ -838,9 +838,9 @@ class vimconnector(vimconn.vimconnector):
                         created_items[data_disk.id] = True
 
                     else:
                         created_items[data_disk.id] = True
 
                     else:
-                        raise vimconn.vimconnNotFoundException("Invalid image_id: %s ", image_id)
+                        raise vimconn.VimConnNotFoundException("Invalid image_id: %s ", image_id)
                 else:
                 else:
-                    raise vimconn.vimconnNotFoundException("Invalid image_id: %s ", image_id)
+                    raise vimconn.VimConnNotFoundException("Invalid image_id: %s ", image_id)
 
         # Attach the disk created
         virtual_machine.storage_profile.data_disks.append({
 
         # Attach the disk created
         virtual_machine.storage_profile.data_disks.append({
@@ -887,7 +887,7 @@ class vimconnector(vimconn.vimconnector):
                 'version': version
             }
         except Exception as e:
                 'version': version
             }
         except Exception as e:
-            raise vimconn.vimconnException(
+            raise vimconn.VimConnException(
                 "Unable to get image_reference from invalid image_id format: '{}'".format(image_id))
 
     # Azure VM names can not have some special characters
                 "Unable to get image_reference from invalid image_id format: '{}'".format(image_id))
 
     # Azure VM names can not have some special characters
@@ -938,7 +938,7 @@ class vimconnector(vimconn.vimconnector):
 
             if listedFilteredSizes:
                 return listedFilteredSizes[0]['name']
 
             if listedFilteredSizes:
                 return listedFilteredSizes[0]['name']
-            raise vimconn.vimconnNotFoundException("Cannot find any flavor matching '{}'".format(str(flavor_dict)))
+            raise vimconn.VimConnNotFoundException("Cannot find any flavor matching '{}'".format(str(flavor_dict)))
 
         except Exception as e:
             self._format_vimconn_exception(e)
 
         except Exception as e:
             self._format_vimconn_exception(e)
@@ -967,7 +967,7 @@ class vimconnector(vimconn.vimconnector):
             self._reload_connection()
             return True
         except Exception as e:
             self._reload_connection()
             return True
         except Exception as e:
-            raise vimconn.vimconnException("Connectivity issue with Azure API: {}".format(e))
+            raise vimconn.VimConnException("Connectivity issue with Azure API: {}".format(e))
 
     def get_network(self, net_id):
 
 
     def get_network(self, net_id):
 
@@ -979,7 +979,7 @@ class vimconnector(vimconn.vimconnector):
         network_list = self.get_network_list(filter_dict)
 
         if not network_list:
         network_list = self.get_network_list(filter_dict)
 
         if not network_list:
-            raise vimconn.vimconnNotFoundException("network '{}' not found".format(net_id))
+            raise vimconn.VimConnNotFoundException("network '{}' not found".format(net_id))
         else:
             return network_list[0]
 
         else:
             return network_list[0]
 
@@ -992,7 +992,7 @@ class vimconnector(vimconn.vimconnector):
         filter_dict = {'name': res_name}
         network_list = self.get_network_list(filter_dict)
         if not network_list:
         filter_dict = {'name': res_name}
         network_list = self.get_network_list(filter_dict)
         if not network_list:
-            raise vimconn.vimconnNotFoundException("network '{}' not found".format(net_id))
+            raise vimconn.VimConnNotFoundException("network '{}' not found".format(net_id))
 
         try:
             # Subnet API fails (CloudError: Azure Error: ResourceNotFound)
 
         try:
             # Subnet API fails (CloudError: Azure Error: ResourceNotFound)
@@ -1003,7 +1003,7 @@ class vimconnector(vimconn.vimconnector):
 
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
 
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
-                raise vimconn.vimconnNotFoundException("network '{}' not found".format(net_id))
+                raise vimconn.VimConnNotFoundException("network '{}' not found".format(net_id))
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
@@ -1084,7 +1084,7 @@ class vimconnector(vimconn.vimconnector):
 
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
 
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
-                raise vimconn.vimconnNotFoundException("No vm instance found '{}'".format(vm_id))
+                raise vimconn.VimConnNotFoundException("No vm instance found '{}'".format(vm_id))
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
@@ -1171,20 +1171,20 @@ class vimconnector(vimconn.vimconnector):
             return None
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
             return None
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
-                raise vimconn.vimconnNotFoundException("No vm found '{}'".format(vm_id))
+                raise vimconn.VimConnNotFoundException("No vm found '{}'".format(vm_id))
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
             self._format_vimconn_exception(e)
 
     def delete_flavor(self, flavor_id):
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
             self._format_vimconn_exception(e)
 
     def delete_flavor(self, flavor_id):
-        raise vimconn.vimconnAuthException("It is not possible to delete a FLAVOR in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to delete a FLAVOR in AZURE")
 
     def delete_tenant(self, tenant_id,):
 
     def delete_tenant(self, tenant_id,):
-        raise vimconn.vimconnAuthException("It is not possible to delete a TENANT in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to delete a TENANT in AZURE")
 
     def delete_image(self, image_id):
 
     def delete_image(self, image_id):
-        raise vimconn.vimconnAuthException("It is not possible to delete a IMAGE in AZURE")
+        raise vimconn.VimConnAuthException("It is not possible to delete a IMAGE in AZURE")
 
     def get_vminstance(self, vm_id):
         """
 
     def get_vminstance(self, vm_id):
         """
@@ -1197,7 +1197,7 @@ class vimconnector(vimconn.vimconnector):
             vm = self.conn_compute.virtual_machines.get(self.resource_group, resName)
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
             vm = self.conn_compute.virtual_machines.get(self.resource_group, resName)
         except CloudError as e:
             if e.error.error and "notfound" in e.error.error.lower():
-                raise vimconn.vimconnNotFoundException("No vminstance found '{}'".format(vm_id))
+                raise vimconn.VimConnNotFoundException("No vminstance found '{}'".format(vm_id))
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
             else:
                 self._format_vimconn_exception(e)
         except Exception as e:
@@ -1222,7 +1222,7 @@ class vimconnector(vimconn.vimconnector):
             }
             return flavor
         else:
             }
             return flavor
         else:
-            raise vimconn.vimconnNotFoundException("flavor '{}' not found".format(flavor_id))
+            raise vimconn.VimConnNotFoundException("flavor '{}' not found".format(flavor_id))
 
     def get_tenant_list(self, filter_dict={}):
         """ Obtains the list of tenants
 
     def get_tenant_list(self, filter_dict={}):
         """ Obtains the list of tenants
@@ -1290,7 +1290,7 @@ class vimconnector(vimconn.vimconnector):
                         "status": "VIM_ERROR",
                         "error_msg": str(e)
                     }
                         "status": "VIM_ERROR",
                         "error_msg": str(e)
                     }
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("VimConnNotFoundException %s when searching subnet", e)
                 out_nets[net_id] = {
                     "status": "DELETED",
                 self.logger.error("VimConnNotFoundException %s when searching subnet", e)
                 out_nets[net_id] = {
                     "status": "DELETED",
index d025c96..88e2fca 100644 (file)
@@ -17,4 +17,4 @@ PyYAML
 requests
 netaddr
 azure==4.0.0
 requests
 netaddr
 azure==4.0.0
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 9548357..9debdd0 100644 (file)
@@ -49,10 +49,10 @@ setup(
         "netaddr",
         "PyYAML",
         "azure==4.0.0",
         "netaddr",
         "PyYAML",
         "azure==4.0.0",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_azure = osm_rovim_azure.vimconn_azure'],
+        'osm_rovim.plugins': ['rovim_azure = osm_rovim_azure.vimconn_azure:vimconnector'],
     },
 )
     },
 )
index 968c55e..04cf304 100644 (file)
@@ -15,5 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro, python3-pip
+Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro-plugin, python3-pip
 
 
index 903fa78..a7018f3 100644 (file)
@@ -37,7 +37,7 @@ __date__ ="$2-june-2020 10:35:12$"
 import uuid
 import socket
 import struct
 import uuid
 import socket
 import struct
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 import json
 from functools import partial
 from fog05 import FIMAPI
 import json
 from functools import partial
 from fog05 import FIMAPI
@@ -45,7 +45,7 @@ from fog05 import fimapi
 from fog05_sdk.interfaces.FDU import FDU
 
 
 from fog05_sdk.interfaces.FDU import FDU
 
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
                  config={}, persistent_info={}):
         """Constructor of VIM
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
                  config={}, persistent_info={}):
         """Constructor of VIM
@@ -66,7 +66,7 @@ class vimconnector(vimconn.vimconnector):
             check against the VIM
         """
 
             check against the VIM
         """
 
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
                                       config, persistent_info)
 
         self.logger.debug('vimconn_fos init with config: {}'.format(config))
                                       config, persistent_info)
 
         self.logger.debug('vimconn_fos init with config: {}'.format(config))
@@ -99,15 +99,15 @@ class vimconnector(vimconn.vimconnector):
 
     def check_vim_connectivity(self):
         """Checks VIM can be reached and user credentials are ok.
 
     def check_vim_connectivity(self):
         """Checks VIM can be reached and user credentials are ok.
-        Returns None if success or raised vimconnConnectionException, vimconnAuthException, ...
+        Returns None if success or raised VimConnConnectionException, VimConnAuthException, ...
         """
         try:
             self.fos_api.node.list()
             return None
         except fimapi.FIMAuthExcetpion as fae:
         """
         try:
             self.fos_api.node.list()
             return None
         except fimapi.FIMAuthExcetpion as fae:
-            raise vimconn.vimconnAuthException("Unable to authenticate to the VIM. Error {}".format(fae))
+            raise vimconn.VimConnAuthException("Unable to authenticate to the VIM. Error {}".format(fae))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
 
     def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
         """Adds a tenant network to VIM
 
     def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
         """Adds a tenant network to VIM
@@ -130,7 +130,7 @@ class vimconnector(vimconn.vimconnector):
         """
         self.logger.debug('new_network: {}'.format(locals()))
         if net_type in ['data','ptp']:
         """
         self.logger.debug('new_network: {}'.format(locals()))
         if net_type in ['data','ptp']:
-            raise vimconn.vimconnNotImplemented('{} type of network not supported'.format(net_type))
+            raise vimconn.VimConnNotImplemented('{} type of network not supported'.format(net_type))
 
         net_uuid = '{}'.format(uuid.uuid4())
         desc = {
 
         net_uuid = '{}'.format(uuid.uuid4())
         desc = {
@@ -153,15 +153,15 @@ class vimconnector(vimconn.vimconnector):
                 ip.update({'gateway':ip_profile.get('gateway_address', None)})
                 desc.update({'ip_configuration':ip_info})
             else:
                 ip.update({'gateway':ip_profile.get('gateway_address', None)})
                 desc.update({'ip_configuration':ip_info})
             else:
-                raise vimconn.vimconnNotImplemented('IPV6 network is not implemented at VIM')
+                raise vimconn.VimConnNotImplemented('IPV6 network is not implemented at VIM')
             desc.update({'ip_configuration':ip})
         self.logger.debug('VIM new_network args: {} - Generated Eclipse fog05 Descriptor {}'.format(locals(), desc))
         try:
             self.fos_api.network.add_network(desc)
         except fimapi.FIMAResouceExistingException as free:
             desc.update({'ip_configuration':ip})
         self.logger.debug('VIM new_network args: {} - Generated Eclipse fog05 Descriptor {}'.format(locals(), desc))
         try:
             self.fos_api.network.add_network(desc)
         except fimapi.FIMAResouceExistingException as free:
-            raise vimconn.vimconnConflictException("Network already exists at VIM. Error {}".format(free))
+            raise vimconn.VimConnConflictException("Network already exists at VIM. Error {}".format(free))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnException("Unable to create network {}. Error {}".format(net_name, e))
+            raise vimconn.VimConnException("Unable to create network {}. Error {}".format(net_name, e))
             # No way from the current rest service to get the actual error, most likely it will be an already existing error
         return net_uuid,{}
 
             # No way from the current rest service to get the actual error, most likely it will be an already existing error
         return net_uuid,{}
 
@@ -191,7 +191,7 @@ class vimconnector(vimconn.vimconnector):
         try:
             nets = self.fos_api.network.list()
         except Exception as e:
         try:
             nets = self.fos_api.network.list()
         except Exception as e:
-            raise vimconn.vimconnConnectionException("Cannot get network list from VIM, connection error. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("Cannot get network list from VIM, connection error. Error {}".format(e))
 
         filters = [
             partial(self.__name_filter, filter_name=filter_dict.get('name')),
 
         filters = [
             partial(self.__name_filter, filter_name=filter_dict.get('name')),
@@ -229,7 +229,7 @@ class vimconnector(vimconn.vimconnector):
         self.logger.debug('get_network: {}'.format(net_id))
         res = self.get_network_list(filter_dict={'id':net_id})
         if len(res) == 0:
         self.logger.debug('get_network: {}'.format(net_id))
         res = self.get_network_list(filter_dict={'id':net_id})
         if len(res) == 0:
-            raise vimconn.vimconnNotFoundException("Network {} not found at VIM".format(net_id))
+            raise vimconn.VimConnNotFoundException("Network {} not found at VIM".format(net_id))
         return res[0]
 
     def delete_network(self, net_id, created_items=None):
         return res[0]
 
     def delete_network(self, net_id, created_items=None):
@@ -240,9 +240,9 @@ class vimconnector(vimconn.vimconnector):
         try:
             self.fos_api.network.remove_network(net_id)
         except fimapi.FIMNotFoundException as fnfe:
         try:
             self.fos_api.network.remove_network(net_id)
         except fimapi.FIMNotFoundException as fnfe:
-            raise vimconn.vimconnNotFoundException("Network {} not found at VIM (already deleted?). Error {}".format(net_id, fnfe))
+            raise vimconn.VimConnNotFoundException("Network {} not found at VIM (already deleted?). Error {}".format(net_id, fnfe))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnException("Cannot delete network {} from VIM. Error {}".format(net_id, e))
+            raise vimconn.VimConnException("Cannot delete network {} from VIM. Error {}".format(net_id, e))
         return net_id
 
     def refresh_nets_status(self, net_list):
         return net_id
 
     def refresh_nets_status(self, net_list):
@@ -270,7 +270,7 @@ class vimconnector(vimconn.vimconnector):
                 r.update({
                     osm_n.get('id'):{'status':osm_n.get('status')}
                 })
                 r.update({
                     osm_n.get('id'):{'status':osm_n.get('status')}
                 })
-            except vimconn.vimconnNotFoundException:
+            except vimconn.VimConnNotFoundException:
                 r.update({
                     n:{'status':'VIM_ERROR'}
                 })
                 r.update({
                     n:{'status':'VIM_ERROR'}
                 })
@@ -285,9 +285,9 @@ class vimconnector(vimconn.vimconnector):
         try:
             r = self.fos_api.flavor.get(flavor_id)
         except Exception as e:
         try:
             r = self.fos_api.flavor.get(flavor_id)
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         if r is None:
         if r is None:
-            raise vimconn.vimconnNotFoundException("Flavor not found at VIM")
+            raise vimconn.VimConnNotFoundException("Flavor not found at VIM")
         return {'id':r.get('uuid'), 'name':r.get('name'), 'fos':r}
 
     def get_flavor_id_from_data(self, flavor_dict):
         return {'id':r.get('uuid'), 'name':r.get('name'), 'fos':r}
 
     def get_flavor_id_from_data(self, flavor_dict):
@@ -305,10 +305,10 @@ class vimconnector(vimconn.vimconnector):
         try:
             flvs = self.fos_api.flavor.list()
         except Exception as e:
         try:
             flvs = self.fos_api.flavor.list()
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         r = [x.get('uuid') for x in flvs if (x.get('cpu_min_count') == flavor_dict.get('vcpus') and x.get('ram_size_mb') == flavor_dict.get('ram') and x.get('storage_size_gb') == flavor_dict.get('disk'))]
         if len(r) == 0:
         r = [x.get('uuid') for x in flvs if (x.get('cpu_min_count') == flavor_dict.get('vcpus') and x.get('ram_size_mb') == flavor_dict.get('ram') and x.get('storage_size_gb') == flavor_dict.get('disk'))]
         if len(r) == 0:
-            raise vimconn.vimconnNotFoundException ( "No flavor found" )
+            raise vimconn.VimConnNotFoundException ( "No flavor found" )
         return r[0]
 
     def new_flavor(self, flavor_data):
         return r[0]
 
     def new_flavor(self, flavor_data):
@@ -344,9 +344,9 @@ class vimconnector(vimconn.vimconnector):
         try:
             self.fos_api.flavor.add(desc)
         except fimapi.FIMAResouceExistingException as free:
         try:
             self.fos_api.flavor.add(desc)
         except fimapi.FIMAResouceExistingException as free:
-            raise vimconn.vimconnConflictException("Flavor {} already exist at VIM. Error {}".format(flv_id, free))
+            raise vimconn.VimConnConflictException("Flavor {} already exist at VIM. Error {}".format(flv_id, free))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         return flv_id
 
     def delete_flavor(self, flavor_id):
         return flv_id
 
     def delete_flavor(self, flavor_id):
@@ -355,9 +355,9 @@ class vimconnector(vimconn.vimconnector):
         try:
             self.fos_api.flavor.remove(flavor_id)
         except fimapi.FIMNotFoundException as fnfe:
         try:
             self.fos_api.flavor.remove(flavor_id)
         except fimapi.FIMNotFoundException as fnfe:
-            raise vimconn.vimconnNotFoundException("Flavor {} not found at VIM (already deleted?). Error {}".format(flavor_id, fnfe))
+            raise vimconn.VimConnNotFoundException("Flavor {} not found at VIM (already deleted?). Error {}".format(flavor_id, fnfe))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         return flavor_id
 
     def new_image(self, image_dict):
         return flavor_id
 
     def new_image(self, image_dict):
@@ -380,9 +380,9 @@ class vimconnector(vimconn.vimconnector):
         try:
             self.fos_api.image.add(desc)
         except fimapi.FIMAResouceExistingException as free:
         try:
             self.fos_api.image.add(desc)
         except fimapi.FIMAResouceExistingException as free:
-            raise vimconn.vimconnConflictException("Image {} already exist at VIM. Error {}".format(img_id, free))
+            raise vimconn.VimConnConflictException("Image {} already exist at VIM. Error {}".format(img_id, free))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         return img_id
 
     def get_image_id_from_path(self, path):
         return img_id
 
     def get_image_id_from_path(self, path):
@@ -394,10 +394,10 @@ class vimconnector(vimconn.vimconnector):
         try:
             imgs = self.fos_api.image.list()
         except Exception as e:
         try:
             imgs = self.fos_api.image.list()
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         res = [x.get('uuid') for x in imgs if x.get('uri')==path]
         if len(res) == 0:
         res = [x.get('uuid') for x in imgs if x.get('uri')==path]
         if len(res) == 0:
-            raise vimconn.vimconnNotFoundException("Image with this path was not found")
+            raise vimconn.VimConnNotFoundException("Image with this path was not found")
         return res[0]
 
     def get_image_list(self, filter_dict={}):
         return res[0]
 
     def get_image_list(self, filter_dict={}):
@@ -416,7 +416,7 @@ class vimconnector(vimconn.vimconnector):
         try:
             fimgs = self.fos_api.image.list()
         except Exception as e:
         try:
             fimgs = self.fos_api.image.list()
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
 
         filters = [
             partial(self.__name_filter, filter_name=filter_dict.get('name')),
 
         filters = [
             partial(self.__name_filter, filter_name=filter_dict.get('name')),
@@ -443,7 +443,7 @@ class vimconnector(vimconn.vimconnector):
             }
             r.append(img_info)
         return r
             }
             r.append(img_info)
         return r
-        #raise vimconnNotImplemented( "Should have implemented this" )
+        #raise VimConnNotImplemented( "Should have implemented this" )
 
     def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
         availability_zone_index=None, availability_zone_list=None):
 
     def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
         availability_zone_index=None, availability_zone_list=None):
@@ -507,9 +507,9 @@ class vimconnector(vimconn.vimconnector):
         img = self.fos_api.image.get(image_id)
 
         if flv is None:
         img = self.fos_api.image.get(image_id)
 
         if flv is None:
-            raise vimconn.vimconnNotFoundException("Flavor {} not found at VIM".format(flavor_id))
+            raise vimconn.VimConnNotFoundException("Flavor {} not found at VIM".format(flavor_id))
         if img is None:
         if img is None:
-            raise vimconn.vimconnNotFoundException("Image {} not found at VIM".format(image_id))
+            raise vimconn.VimConnNotFoundException("Image {} not found at VIM".format(image_id))
 
         created_items = {
             'fdu_id':'',
 
         created_items = {
             'fdu_id':'',
@@ -579,6 +579,7 @@ class vimconnector(vimconn.vimconnector):
 
         self.logger.debug('Eclipse fog05 FDU Descriptor: {}'.format(fdu_desc))
 
 
         self.logger.debug('Eclipse fog05 FDU Descriptor: {}'.format(fdu_desc))
 
+
         fdu = FDU(fdu_desc)
 
         try:
         fdu = FDU(fdu_desc)
 
         try:
@@ -613,9 +614,9 @@ class vimconnector(vimconn.vimconnector):
             self.logger.debug('new_vminstance returns: {} {}'.format( instance.uuid, created_items))
             return str(instance.uuid), created_items
         except fimapi.FIMAResouceExistingException as free:
             self.logger.debug('new_vminstance returns: {} {}'.format( instance.uuid, created_items))
             return str(instance.uuid), created_items
         except fimapi.FIMAResouceExistingException as free:
-            raise vimconn.vimconnConflictException("VM already exists at VIM. Error {}".format(free))
+            raise vimconn.VimConnConflictException("VM already exists at VIM. Error {}".format(free))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnException("Error while instantiating VM {}. Error {}".format(name, e))
+            raise vimconn.VimConnException("Error while instantiating VM {}. Error {}".format(name, e))
 
     def get_vminstance(self,vm_id):
         """Returns the VM instance information from VIM"""
 
     def get_vminstance(self,vm_id):
         """Returns the VM instance information from VIM"""
@@ -624,9 +625,9 @@ class vimconnector(vimconn.vimconnector):
         try:
             instance = self.fos_api.fdu.instance_info(vm_id)
         except Exception as e:
         try:
             instance = self.fos_api.fdu.instance_info(vm_id)
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
         if instance is None:
         if instance is None:
-            raise vimconn.vimconnNotFoundException('VM with id {} not found!'.format(vm_id))
+            raise vimconn.VimConnNotFoundException('VM with id {} not found!'.format(vm_id))
         return instance.to_json()
 
     def delete_vminstance(self, vm_id, created_items=None):
         return instance.to_json()
 
     def delete_vminstance(self, vm_id, created_items=None):
@@ -663,10 +664,10 @@ class vimconnector(vimconn.vimconnector):
 
             self.fos_api.fdu.offload(fduid)
         except Exception as e:
 
             self.fos_api.fdu.offload(fduid)
         except Exception as e:
-            raise vimconn.vimconnException("Error on deletting VM with id {}. Error {}".format(vm_id,e))
+            raise vimconn.VimConnException("Error on deletting VM with id {}. Error {}".format(vm_id,e))
         return vm_id
 
         return vm_id
 
-        #raise vimconnNotImplemented( "Should have implemented this" )
+        #raise VimConnNotImplemented( "Should have implemented this" )
 
     def refresh_vms_status(self, vm_list):
         """Get the status of the virtual machines and their interfaces/ports
 
     def refresh_vms_status(self, vm_list):
         """Get the status of the virtual machines and their interfaces/ports
@@ -803,7 +804,7 @@ class vimconnector(vimconn.vimconnector):
         self.logger.debug('VIM action_vminstance with args: {}'.format(locals()))
         nid = self.fdu_node_map.get(vm_id)
         if nid is None:
         self.logger.debug('VIM action_vminstance with args: {}'.format(locals()))
         nid = self.fdu_node_map.get(vm_id)
         if nid is None:
-            raise vimconn.vimconnNotFoundException('No node for this VM')
+            raise vimconn.VimConnNotFoundException('No node for this VM')
         try:
             instance = self.fos_api.fdu.instance_info(vm_id)
             if "start" in action_dict:
         try:
             instance = self.fos_api.fdu.instance_info(vm_id)
             if "start" in action_dict:
@@ -812,22 +813,22 @@ class vimconnector(vimconn.vimconnector):
                 elif instance.get('status') == 'PAUSE':
                     self.fos_api.fdu.resume(vm_id)
                 else:
                 elif instance.get('status') == 'PAUSE':
                     self.fos_api.fdu.resume(vm_id)
                 else:
-                    raise vimconn.vimconnConflictException('Cannot start from current state: {}'.format(instance.get('status')))
+                    raise vimconn.VimConnConflictException('Cannot start from current state: {}'.format(instance.get('status')))
             elif "pause" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.pause(vm_id)
                 else:
             elif "pause" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.pause(vm_id)
                 else:
-                    raise vimconn.vimconnConflictException('Cannot pause from current state: {}'.format(instance.get('status')))
+                    raise vimconn.VimConnConflictException('Cannot pause from current state: {}'.format(instance.get('status')))
             elif "resume" in action_dict:
                 if instance.get('status') == 'PAUSE':
                     self.fos_api.fdu.resume(vm_id)
                 else:
             elif "resume" in action_dict:
                 if instance.get('status') == 'PAUSE':
                     self.fos_api.fdu.resume(vm_id)
                 else:
-                    raise vimconn.vimconnConflictException('Cannot resume from current state: {}'.format(instance.get('status')))
+                    raise vimconn.VimConnConflictException('Cannot resume from current state: {}'.format(instance.get('status')))
             elif "shutoff" in action_dict or "shutdown" or "forceOff" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.stop(vm_id)
                 else:
             elif "shutoff" in action_dict or "shutdown" or "forceOff" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.stop(vm_id)
                 else:
-                    raise vimconn.vimconnConflictException('Cannot shutoff from current state: {}'.format(instance.get('status')))
+                    raise vimconn.VimConnConflictException('Cannot shutoff from current state: {}'.format(instance.get('status')))
             elif "terminate" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.stop(vm_id)
             elif "terminate" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.stop(vm_id)
@@ -845,14 +846,14 @@ class vimconnector(vimconn.vimconnector):
                     self.fos_api.fdu.undefine(vm_id)
                     # self.fos_api.fdu.offload(vm_id)
                 else:
                     self.fos_api.fdu.undefine(vm_id)
                     # self.fos_api.fdu.offload(vm_id)
                 else:
-                    raise vimconn.vimconnConflictException('Cannot terminate from current state: {}'.format(instance.get('status')))
+                    raise vimconn.VimConnConflictException('Cannot terminate from current state: {}'.format(instance.get('status')))
             elif "rebuild" in action_dict:
             elif "rebuild" in action_dict:
-                raise vimconn.vimconnNotImplemented("Rebuild not implememnted")
+                raise vimconn.VimConnNotImplemented("Rebuild not implemented")
             elif "reboot" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.stop(vm_id)
                     self.fos_api.fdu.start(vm_id)
                 else:
             elif "reboot" in action_dict:
                 if instance.get('status') == 'RUN':
                     self.fos_api.fdu.stop(vm_id)
                     self.fos_api.fdu.start(vm_id)
                 else:
-                    raise vimconn.vimconnConflictException('Cannot reboot from current state: {}'.format(instance.get('status')))
+                    raise vimconn.VimConnConflictException('Cannot reboot from current state: {}'.format(instance.get('status')))
         except Exception as e:
         except Exception as e:
-            raise vimconn.vimconnConnectionException("VIM not reachable. Error {}".format(e))
+            raise vimconn.VimConnConnectionException("VIM not reachable. Error {}".format(e))
index 7adec69..2bded1b 100644 (file)
@@ -22,4 +22,4 @@ zenoh==0.3.0
 yaks==0.3.0.post1
 pyangbind
 sphinx
 yaks==0.3.0.post1
 pyangbind
 sphinx
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index a3beee9..9393566 100644 (file)
@@ -36,9 +36,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -54,10 +54,10 @@ setup(
         "fog05==0.2.0",
         "pyangbind",
         "sphinx",
         "fog05==0.2.0",
         "pyangbind",
         "sphinx",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_fos = osm_rovim_fos.vimconn_fos'],
+        'osm_rovim.plugins': ['rovim_fos = osm_rovim_fos.vimconn_fos:vimconnector'],
     },
 )
     },
 )
index cf4b353..bea34ad 100644 (file)
@@ -15,4 +15,4 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-pip, python3-requests, python3-netaddr, python3-yaml, python3-osm-ro
+Depends3: python3-pip, python3-requests, python3-netaddr, python3-yaml, python3-osm-ro-plugin
index d788dcb..00c9b02 100644 (file)
@@ -28,7 +28,7 @@ vimconnector implements all the methods to interact with OpenNebula using the XM
 __author__ = "Jose Maria Carmona Perez,Juan Antonio Hernando Labajo, Emilio Abraham Garrido Garcia,Alberto Florez " \
              "Pages, Andres Pozo Munoz, Santiago Perez Marin, Onlife Networks Telefonica I+D Product Innovation "
 __date__ = "$13-dec-2017 11:09:29$"
 __author__ = "Jose Maria Carmona Perez,Juan Antonio Hernando Labajo, Emilio Abraham Garrido Garcia,Alberto Florez " \
              "Pages, Andres Pozo Munoz, Santiago Perez Marin, Onlife Networks Telefonica I+D Product Innovation "
 __date__ = "$13-dec-2017 11:09:29$"
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 import requests
 import logging
 import oca
 import requests
 import logging
 import oca
@@ -37,7 +37,7 @@ import math
 import random
 import pyone
 
 import random
 import pyone
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None,
                  log_level="DEBUG", config={}, persistent_info={}):
 
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None,
                  log_level="DEBUG", config={}, persistent_info={}):
 
@@ -59,7 +59,7 @@ class vimconnector(vimconn.vimconnector):
             check against the VIM
         """
 
             check against the VIM
         """
 
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
                                       config)
 
     def _new_one_connection(self):
                                       config)
 
     def _new_one_connection(self):
@@ -95,7 +95,7 @@ class vimconnector(vimconn.vimconnector):
                                 return str(group.id)
         except Exception as e:
             self.logger.error("Create new tenant error: " + str(e))
                                 return str(group.id)
         except Exception as e:
             self.logger.error("Create new tenant error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def delete_tenant(self, tenant_id):
         """Delete a tenant from VIM. Returns the old tenant identifier"""
 
     def delete_tenant(self, tenant_id):
         """Delete a tenant from VIM. Returns the old tenant identifier"""
@@ -112,10 +112,10 @@ class vimconnector(vimconn.vimconnector):
                             self._delete_secondarygroup(user.id, group.id)
                             group.delete(client)
                     return None
                             self._delete_secondarygroup(user.id, group.id)
                             group.delete(client)
                     return None
-            raise vimconn.vimconnNotFoundException("Group {} not found".format(tenant_id))
+            raise vimconn.VimConnNotFoundException("Group {} not found".format(tenant_id))
         except Exception as e:
             self.logger.error("Delete tenant " + str(tenant_id) + " error: " + str(e))
         except Exception as e:
             self.logger.error("Delete tenant " + str(tenant_id) + " error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def _add_secondarygroup(self, id_user, id_group):
         # change secondary_group to primary_group
 
     def _add_secondarygroup(self, id_user, id_group):
         # change secondary_group to primary_group
@@ -229,7 +229,7 @@ class vimconnector(vimconn.vimconnector):
             return net_id, created_items
         except Exception as e:
             self.logger.error("Create new network error: " + str(e))
             return net_id, created_items
         except Exception as e:
             self.logger.error("Create new network error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def get_network_list(self, filter_dict={}):
         """Obtain tenant networks of VIM
 
     def get_network_list(self, filter_dict={}):
         """Obtain tenant networks of VIM
@@ -272,7 +272,7 @@ class vimconnector(vimconn.vimconnector):
             return response
         except Exception as e:
             self.logger.error("Get network list error: " + str(e))
             return response
         except Exception as e:
             self.logger.error("Get network list error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def get_network(self, net_id):
         """Obtain network details from the 'net_id' VIM network
 
     def get_network(self, net_id):
         """Obtain network details from the 'net_id' VIM network
@@ -297,10 +297,10 @@ class vimconnector(vimconn.vimconnector):
             if net:
                 return net
             else:
             if net:
                 return net
             else:
-                raise vimconn.vimconnNotFoundException("Network {} not found".format(net_id))
+                raise vimconn.VimConnNotFoundException("Network {} not found".format(net_id))
         except Exception as e:
             self.logger.error("Get network " + str(net_id) + " error): " + str(e))
         except Exception as e:
             self.logger.error("Get network " + str(net_id) + " error): " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def delete_network(self, net_id, created_items=None):
         """
 
     def delete_network(self, net_id, created_items=None):
         """
@@ -316,7 +316,7 @@ class vimconnector(vimconn.vimconnector):
             return net_id
         except Exception as e:
             self.logger.error("Delete network " + str(net_id) + "error: network not found" + str(e))
             return net_id
         except Exception as e:
             self.logger.error("Delete network " + str(net_id) + "error: network not found" + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def refresh_nets_status(self, net_list):
         """Get the status of the networks
 
     def refresh_nets_status(self, net_list):
         """Get the status of the networks
@@ -343,17 +343,17 @@ class vimconnector(vimconn.vimconnector):
                     net_vim = self.get_network(net_id)
                     net["status"] = net_vim["status"]
                     net["vim_info"] = None
                     net_vim = self.get_network(net_id)
                     net["status"] = net_vim["status"]
                     net["vim_info"] = None
-                except vimconn.vimconnNotFoundException as e:
+                except vimconn.VimConnNotFoundException as e:
                     self.logger.error("Exception getting net status: {}".format(str(e)))
                     net['status'] = "DELETED"
                     net['error_msg'] = str(e)
                     self.logger.error("Exception getting net status: {}".format(str(e)))
                     net['status'] = "DELETED"
                     net['error_msg'] = str(e)
-                except vimconn.vimconnException as e:
+                except vimconn.VimConnException as e:
                     self.logger.error(e)
                     net["status"] = "VIM_ERROR"
                     net["error_msg"] = str(e)
                 net_dict[net_id] = net
             return net_dict
                     self.logger.error(e)
                     net["status"] = "VIM_ERROR"
                     net["error_msg"] = str(e)
                 net_dict[net_id] = net
             return net_dict
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             self.logger.error(e)
             for k in net_dict:
                 net_dict[k]["status"] = "VIM_ERROR"
             self.logger.error(e)
             for k in net_dict:
                 net_dict[k]["status"] = "VIM_ERROR"
@@ -371,10 +371,10 @@ class vimconnector(vimconn.vimconnector):
             template = one.template.info(int(flavor_id))
             if template is not None:
                 return {'id': template.ID, 'name': template.NAME}
             template = one.template.info(int(flavor_id))
             if template is not None:
                 return {'id': template.ID, 'name': template.NAME}
-            raise vimconn.vimconnNotFoundException("Flavor {} not found".format(flavor_id))
+            raise vimconn.VimConnNotFoundException("Flavor {} not found".format(flavor_id))
         except Exception as e:
             self.logger.error("get flavor " + str(flavor_id) + " error: " + str(e))
         except Exception as e:
             self.logger.error("get flavor " + str(flavor_id) + " error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def new_flavor(self, flavor_data):
         """Adds a tenant flavor to VIM
 
     def new_flavor(self, flavor_data):
         """Adds a tenant flavor to VIM
@@ -424,7 +424,7 @@ class vimconnector(vimconn.vimconnector):
 
         except Exception as e:
             self.logger.error("Create new flavor error: " + str(e))
 
         except Exception as e:
             self.logger.error("Create new flavor error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def delete_flavor(self, flavor_id):
         """ Deletes a tenant flavor from VIM
 
     def delete_flavor(self, flavor_id):
         """ Deletes a tenant flavor from VIM
@@ -436,7 +436,7 @@ class vimconnector(vimconn.vimconnector):
             return flavor_id
         except Exception as e:
             self.logger.error("Error deleting flavor " + str(flavor_id) + ". Flavor not found")
             return flavor_id
         except Exception as e:
             self.logger.error("Error deleting flavor " + str(flavor_id) + ". Flavor not found")
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def get_image_list(self, filter_dict={}):
         """Obtain tenant images from VIM
 
     def get_image_list(self, filter_dict={}):
         """Obtain tenant images from VIM
@@ -468,7 +468,7 @@ class vimconnector(vimconn.vimconnector):
             return images
         except Exception as e:
             self.logger.error("Get image list error: " + str(e))
             return images
         except Exception as e:
             self.logger.error("Get image list error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
                        availability_zone_index=None, availability_zone_list=None):
 
     def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
                        availability_zone_index=None, availability_zone_list=None):
@@ -560,10 +560,10 @@ class vimconnector(vimconn.vimconnector):
             return str(vm_instance_id), None
         except pyone.OneNoExistsException as e:
             self.logger.error("Network with id " + str(e) + " not found: " + str(e))
             return str(vm_instance_id), None
         except pyone.OneNoExistsException as e:
             self.logger.error("Network with id " + str(e) + " not found: " + str(e))
-            raise vimconn.vimconnNotFoundException(e)
+            raise vimconn.VimConnNotFoundException(e)
         except Exception as e:
             self.logger.error("Create new vm instance error: " + str(e))
         except Exception as e:
             self.logger.error("Create new vm instance error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def get_vminstance(self, vm_id):
         """Returns the VM instance information from VIM"""
 
     def get_vminstance(self, vm_id):
         """Returns the VM instance information from VIM"""
@@ -573,7 +573,7 @@ class vimconnector(vimconn.vimconnector):
             return vm
         except Exception as e:
             self.logger.error("Getting vm instance error: " + str(e) + ": VM Instance not found")
             return vm
         except Exception as e:
             self.logger.error("Getting vm instance error: " + str(e) + ": VM Instance not found")
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def delete_vminstance(self, vm_id, created_items=None):
         """
 
     def delete_vminstance(self, vm_id, created_items=None):
         """
@@ -595,10 +595,10 @@ class vimconnector(vimconn.vimconnector):
 
         except pyone.OneNoExistsException as e:
             self.logger.info("The vm " + str(vm_id) + " does not exist or is already deleted")
 
         except pyone.OneNoExistsException as e:
             self.logger.info("The vm " + str(vm_id) + " does not exist or is already deleted")
-            raise vimconn.vimconnNotFoundException("The vm {} does not exist or is already deleted".format(vm_id))
+            raise vimconn.VimConnNotFoundException("The vm {} does not exist or is already deleted".format(vm_id))
         except Exception as e:
             self.logger.error("Delete vm instance " + str(vm_id) + " error: " + str(e))
         except Exception as e:
             self.logger.error("Delete vm instance " + str(vm_id) + " error: " + str(e))
-            raise vimconn.vimconnException(e)
+            raise vimconn.VimConnException(e)
 
     def refresh_vms_status(self, vm_list):
         """Get the status of the virtual machines and their interfaces/ports
 
     def refresh_vms_status(self, vm_list):
         """Get the status of the virtual machines and their interfaces/ports
index 71b09d8..d3420cf 100644 (file)
@@ -20,4 +20,4 @@ netaddr
 untangle
 pyone
 git+https://github.com/python-oca/python-oca#egg=oca
 untangle
 pyone
 git+https://github.com/python-oca/python-oca#egg=oca
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 7819282..4b3ec17 100644 (file)
@@ -37,9 +37,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -49,10 +49,10 @@ setup(
         "requests",
         "netaddr",
         "PyYAML",
         "requests",
         "netaddr",
         "PyYAML",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_opennebula = osm_rovim_opennebula.vimconn_opennebula'],
+        'osm_rovim.plugins': ['rovim_opennebula = osm_rovim_opennebula.vimconn_opennebula:vimconnector'],
     },
 )
     },
 )
index 00071bd..5392c30 100644 (file)
@@ -16,5 +16,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro, python3-pip
+Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro-plugin, python3-pip
 
 
index 5eb23f0..6bfc125 100644 (file)
@@ -30,8 +30,8 @@ import unittest
 import mock
 from neutronclient.v2_0.client import Client
 
 import mock
 from neutronclient.v2_0.client import Client
 
-from osm_ro import vimconn
-from osm_ro.vimconn_openstack import vimconnector
+from osm_ro_plugin import vimconn
+from osm_rovim_openstack.vimconn_openstack import vimconnector
 
 
 __author__ = "Igor D.C."
 
 
 __author__ = "Igor D.C."
@@ -238,7 +238,7 @@ class TestSfcOperations(unittest.TestCase):
 
     @mock.patch.object(Client, 'create_sfc_flow_classifier')
     def test_new_classification_unsupported_type(self, create_sfc_flow_classifier):
 
     @mock.patch.object(Client, 'create_sfc_flow_classifier')
     def test_new_classification_unsupported_type(self, create_sfc_flow_classifier):
-        self.assertRaises(vimconn.vimconnNotSupportedException,
+        self.assertRaises(vimconn.VimConnNotSupportedException,
                           self._test_new_classification,
                           create_sfc_flow_classifier, 'h265')
 
                           self._test_new_classification,
                           create_sfc_flow_classifier, 'h265')
 
@@ -258,11 +258,11 @@ class TestSfcOperations(unittest.TestCase):
     def test_new_sfi_bad_ingress_ports(self, create_sfc_port_pair):
         ingress_ports = ['5311c75d-d718-4369-bbda-cdcc6da60fcc',
                          'a0273f64-82c9-11e7-b08f-6328e53f0fa7']
     def test_new_sfi_bad_ingress_ports(self, create_sfc_port_pair):
         ingress_ports = ['5311c75d-d718-4369-bbda-cdcc6da60fcc',
                          'a0273f64-82c9-11e7-b08f-6328e53f0fa7']
-        self.assertRaises(vimconn.vimconnNotSupportedException,
+        self.assertRaises(vimconn.VimConnNotSupportedException,
                           self._test_new_sfi,
                           create_sfc_port_pair, True, ingress_ports=ingress_ports)
         ingress_ports = []
                           self._test_new_sfi,
                           create_sfc_port_pair, True, ingress_ports=ingress_ports)
         ingress_ports = []
-        self.assertRaises(vimconn.vimconnNotSupportedException,
+        self.assertRaises(vimconn.VimConnNotSupportedException,
                           self._test_new_sfi,
                           create_sfc_port_pair, True, ingress_ports=ingress_ports)
 
                           self._test_new_sfi,
                           create_sfc_port_pair, True, ingress_ports=ingress_ports)
 
@@ -270,11 +270,11 @@ class TestSfcOperations(unittest.TestCase):
     def test_new_sfi_bad_egress_ports(self, create_sfc_port_pair):
         egress_ports = ['230cdf1b-de37-4891-bc07-f9010cf1f967',
                         'b41228fe-82c9-11e7-9b44-17504174320b']
     def test_new_sfi_bad_egress_ports(self, create_sfc_port_pair):
         egress_ports = ['230cdf1b-de37-4891-bc07-f9010cf1f967',
                         'b41228fe-82c9-11e7-9b44-17504174320b']
-        self.assertRaises(vimconn.vimconnNotSupportedException,
+        self.assertRaises(vimconn.VimConnNotSupportedException,
                           self._test_new_sfi,
                           create_sfc_port_pair, True, egress_ports=egress_ports)
         egress_ports = []
                           self._test_new_sfi,
                           create_sfc_port_pair, True, egress_ports=egress_ports)
         egress_ports = []
-        self.assertRaises(vimconn.vimconnNotSupportedException,
+        self.assertRaises(vimconn.VimConnNotSupportedException,
                           self._test_new_sfi,
                           create_sfc_port_pair, True, egress_ports=egress_ports)
 
                           self._test_new_sfi,
                           create_sfc_port_pair, True, egress_ports=egress_ports)
 
@@ -289,7 +289,7 @@ class TestSfcOperations(unittest.TestCase):
     def test_new_sf_inconsistent_sfc_encap(self, create_sfc_port_pair_group,
                                            get_sfi):
         get_sfi.return_value = {'sfc_encap': 'nsh'}
     def test_new_sf_inconsistent_sfc_encap(self, create_sfc_port_pair_group,
                                            get_sfi):
         get_sfi.return_value = {'sfc_encap': 'nsh'}
-        self.assertRaises(vimconn.vimconnNotSupportedException,
+        self.assertRaises(vimconn.VimConnNotSupportedException,
                           self._test_new_sf, create_sfc_port_pair_group)
 
     @mock.patch.object(Client, 'create_sfc_port_chain')
                           self._test_new_sf, create_sfc_port_pair_group)
 
     @mock.patch.object(Client, 'create_sfc_port_chain')
@@ -566,7 +566,7 @@ class TestSfcOperations(unittest.TestCase):
         ]}
 
         # call the VIM connector
         ]}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnConflictException,
+        self.assertRaises(vimconn.VimConnConflictException,
                           self.vimconn.get_classification,
                           '3196bafc-82dd-11e7-a205-9bf6c14b0721')
 
                           self.vimconn.get_classification,
                           '3196bafc-82dd-11e7-a205-9bf6c14b0721')
 
@@ -580,7 +580,7 @@ class TestSfcOperations(unittest.TestCase):
         list_sfc_flow_classifiers.return_value = {'flow_classifiers': []}
 
         # call the VIM connector
         list_sfc_flow_classifiers.return_value = {'flow_classifiers': []}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnNotFoundException,
+        self.assertRaises(vimconn.VimConnNotFoundException,
                           self.vimconn.get_classification,
                           '3196bafc-82dd-11e7-a205-9bf6c14b0721')
 
                           self.vimconn.get_classification,
                           '3196bafc-82dd-11e7-a205-9bf6c14b0721')
 
@@ -644,7 +644,7 @@ class TestSfcOperations(unittest.TestCase):
         ]}
 
         # call the VIM connector
         ]}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnConflictException,
+        self.assertRaises(vimconn.VimConnConflictException,
                           self.vimconn.get_sfi,
                           'c0436d92-82db-11e7-8f9c-5fa535f1261f')
 
                           self.vimconn.get_sfi,
                           'c0436d92-82db-11e7-8f9c-5fa535f1261f')
 
@@ -658,7 +658,7 @@ class TestSfcOperations(unittest.TestCase):
         list_sfc_port_pairs.return_value = {'port_pairs': []}
 
         # call the VIM connector
         list_sfc_port_pairs.return_value = {'port_pairs': []}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnNotFoundException,
+        self.assertRaises(vimconn.VimConnNotFoundException,
                           self.vimconn.get_sfi,
                           'b22892fc-82d9-11e7-ae85-0fea6a3b3757')
 
                           self.vimconn.get_sfi,
                           'b22892fc-82d9-11e7-ae85-0fea6a3b3757')
 
@@ -715,7 +715,7 @@ class TestSfcOperations(unittest.TestCase):
         ]}
 
         # call the VIM connector
         ]}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnConflictException,
+        self.assertRaises(vimconn.VimConnConflictException,
                           self.vimconn.get_sf,
                           'b22892fc-82d9-11e7-ae85-0fea6a3b3757')
 
                           self.vimconn.get_sf,
                           'b22892fc-82d9-11e7-ae85-0fea6a3b3757')
 
@@ -729,7 +729,7 @@ class TestSfcOperations(unittest.TestCase):
         list_sfc_port_pair_groups.return_value = {'port_pair_groups': []}
 
         # call the VIM connector
         list_sfc_port_pair_groups.return_value = {'port_pair_groups': []}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnNotFoundException,
+        self.assertRaises(vimconn.VimConnNotFoundException,
                           self.vimconn.get_sf,
                           'b22892fc-82d9-11e7-ae85-0fea6a3b3757')
 
                           self.vimconn.get_sf,
                           'b22892fc-82d9-11e7-ae85-0fea6a3b3757')
 
@@ -796,7 +796,7 @@ class TestSfcOperations(unittest.TestCase):
         ]}
 
         # call the VIM connector
         ]}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnConflictException,
+        self.assertRaises(vimconn.VimConnConflictException,
                           self.vimconn.get_sfp,
                           '5d002f38-82de-11e7-a770-f303f11ce66a')
 
                           self.vimconn.get_sfp,
                           '5d002f38-82de-11e7-a770-f303f11ce66a')
 
@@ -810,7 +810,7 @@ class TestSfcOperations(unittest.TestCase):
         list_sfc_port_chains.return_value = {'port_chains': []}
 
         # call the VIM connector
         list_sfc_port_chains.return_value = {'port_chains': []}
 
         # call the VIM connector
-        self.assertRaises(vimconn.vimconnNotFoundException,
+        self.assertRaises(vimconn.VimConnNotFoundException,
                           self.vimconn.get_sfp,
                           '5d002f38-82de-11e7-a770-f303f11ce66a')
 
                           self.vimconn.get_sfp,
                           '5d002f38-82de-11e7-a770-f303f11ce66a')
 
index e392ca7..6123141 100644 (file)
@@ -32,7 +32,7 @@ to the VIM connector's SFC resources as follows:
 __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes, xFlow Research, Igor D.C., Eduardo Sousa"
 __date__  = "$22-sep-2017 23:59:59$"
 
 __author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes, xFlow Research, Igor D.C., Eduardo Sousa"
 __date__  = "$22-sep-2017 23:59:59$"
 
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 # import json
 import logging
 import netaddr
 # import json
 import logging
 import netaddr
@@ -87,7 +87,7 @@ class SafeDumper(yaml.SafeDumper):
         return super(SafeDumper, self).represent_data(data)
 
 
         return super(SafeDumper, self).represent_data(data)
 
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None,
                  log_level=None, config={}, persistent_info={}):
         '''using common constructor parameters. In this case
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None,
                  log_level=None, config={}, persistent_info={}):
         '''using common constructor parameters. In this case
@@ -96,11 +96,11 @@ class vimconnector(vimconn.vimconnector):
         '''
         api_version = config.get('APIversion')
         if api_version and api_version not in ('v3.3', 'v2.0', '2', '3'):
         '''
         api_version = config.get('APIversion')
         if api_version and api_version not in ('v3.3', 'v2.0', '2', '3'):
-            raise vimconn.vimconnException("Invalid value '{}' for config:APIversion. "
+            raise vimconn.VimConnException("Invalid value '{}' for config:APIversion. "
                                            "Allowed values are 'v3.3', 'v2.0', '2' or '3'".format(api_version))
         vim_type = config.get('vim_type')
         if vim_type and vim_type not in ('vio', 'VIO'):
                                            "Allowed values are 'v3.3', 'v2.0', '2' or '3'".format(api_version))
         vim_type = config.get('vim_type')
         if vim_type and vim_type not in ('vio', 'VIO'):
-            raise vimconn.vimconnException("Invalid value '{}' for config:vim_type."
+            raise vimconn.VimConnException("Invalid value '{}' for config:vim_type."
                             "Allowed values are 'vio' or 'VIO'".format(vim_type))
 
         if config.get('dataplane_net_vlan_range') is not None:
                             "Allowed values are 'vio' or 'VIO'".format(vim_type))
 
         if config.get('dataplane_net_vlan_range') is not None:
@@ -111,11 +111,11 @@ class vimconnector(vimconn.vimconnector):
             #validate vlan ranges provided by user
             self._validate_vlan_ranges(config.get('multisegment_vlan_range'), 'multisegment_vlan_range')
 
             #validate vlan ranges provided by user
             self._validate_vlan_ranges(config.get('multisegment_vlan_range'), 'multisegment_vlan_range')
 
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
                                       config)
 
         if self.config.get("insecure") and self.config.get("ca_cert"):
                                       config)
 
         if self.config.get("insecure") and self.config.get("ca_cert"):
-            raise vimconn.vimconnException("options insecure and ca_cert are mutually exclusive")
+            raise vimconn.VimConnException("options insecure and ca_cert are mutually exclusive")
         self.verify = True
         if self.config.get("insecure"):
             self.verify = False
         self.verify = True
         if self.config.get("insecure"):
             self.verify = False
@@ -168,7 +168,7 @@ class vimconnector(vimconn.vimconnector):
         elif index == 'user_domain_id':
             return self.config.get("user_domain_id")
         else:
         elif index == 'user_domain_id':
             return self.config.get("user_domain_id")
         else:
-            return vimconn.vimconnector.__getitem__(self, index)
+            return vimconn.VimConnector.__getitem__(self, index)
 
     def __setitem__(self, index, value):
         """Set individuals parameters and it is marked as dirty so to force connection reload.
 
     def __setitem__(self, index, value):
         """Set individuals parameters and it is marked as dirty so to force connection reload.
@@ -178,7 +178,7 @@ class vimconnector(vimconn.vimconnector):
         elif index == 'user_domain_id':
                 self.config["user_domain_id"] = value
         else:
         elif index == 'user_domain_id':
                 self.config["user_domain_id"] = value
         else:
-            vimconn.vimconnector.__setitem__(self, index, value)
+            vimconn.VimConnector.__setitem__(self, index, value)
         self.session['reload_client'] = True
 
     def serialize(self, value):
         self.session['reload_client'] = True
 
     def serialize(self, value):
@@ -401,22 +401,22 @@ class vimconnector(vimconn.vimconnector):
 
         if isinstance(exception, (neExceptions.NetworkNotFoundClient, nvExceptions.NotFound, ksExceptions.NotFound,
                                   gl1Exceptions.HTTPNotFound)):
 
         if isinstance(exception, (neExceptions.NetworkNotFoundClient, nvExceptions.NotFound, ksExceptions.NotFound,
                                   gl1Exceptions.HTTPNotFound)):
-            raise vimconn.vimconnNotFoundException(type(exception).__name__ + ": " + message_error)
+            raise vimconn.VimConnNotFoundException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (HTTPException, gl1Exceptions.HTTPException, gl1Exceptions.CommunicationError,
                                     ConnectionError, ksExceptions.ConnectionError, neExceptions.ConnectionFailed)):
         elif isinstance(exception, (HTTPException, gl1Exceptions.HTTPException, gl1Exceptions.CommunicationError,
                                     ConnectionError, ksExceptions.ConnectionError, neExceptions.ConnectionFailed)):
-            raise vimconn.vimconnConnectionException(type(exception).__name__ + ": " + message_error)
+            raise vimconn.VimConnConnectionException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (KeyError, nvExceptions.BadRequest, ksExceptions.BadRequest)):
         elif isinstance(exception, (KeyError, nvExceptions.BadRequest, ksExceptions.BadRequest)):
-            raise vimconn.vimconnException(type(exception).__name__ + ": " + message_error)
+            raise vimconn.VimConnException(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException,
                                     neExceptions.NeutronException)):
         elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException,
                                     neExceptions.NeutronException)):
-            raise vimconn.vimconnUnexpectedResponse(type(exception).__name__ + ": " + message_error)
+            raise vimconn.VimConnUnexpectedResponse(type(exception).__name__ + ": " + message_error)
         elif isinstance(exception, nvExceptions.Conflict):
         elif isinstance(exception, nvExceptions.Conflict):
-            raise vimconn.vimconnConflictException(type(exception).__name__ + ": " + message_error)
-        elif isinstance(exception, vimconn.vimconnException):
+            raise vimconn.VimConnConflictException(type(exception).__name__ + ": " + message_error)
+        elif isinstance(exception, vimconn.VimConnException):
             raise exception
         else:  # ()
             self.logger.error("General Exception " + message_error, exc_info=True)
             raise exception
         else:  # ()
             self.logger.error("General Exception " + message_error, exc_info=True)
-            raise vimconn.vimconnConnectionException(type(exception).__name__ + ": " + message_error)
+            raise vimconn.VimConnConnectionException(type(exception).__name__ + ": " + message_error)
 
     def _get_ids_from_name(self):
         """
 
     def _get_ids_from_name(self):
         """
@@ -426,7 +426,7 @@ class vimconnector(vimconn.vimconnector):
         # get tenant_id if only tenant_name is supplied
         self._reload_connection()
         if not self.my_tenant_id:
         # get tenant_id if only tenant_name is supplied
         self._reload_connection()
         if not self.my_tenant_id:
-            raise vimconn.vimconnConnectionException("Error getting tenant information from name={} id={}".
+            raise vimconn.VimConnConnectionException("Error getting tenant information from name={} id={}".
                                                      format(self.tenant_name, self.tenant_id))
         if self.config.get('security_groups') and not self.security_groups_id:
             # convert from name to id
                                                      format(self.tenant_name, self.tenant_id))
         if self.config.get('security_groups') and not self.security_groups_id:
             # convert from name to id
@@ -440,7 +440,7 @@ class vimconnector(vimconn.vimconnector):
                         break
                 else:
                     self.security_groups_id = None
                         break
                 else:
                     self.security_groups_id = None
-                    raise vimconn.vimconnConnectionException("Not found security group {} for this tenant".format(sg))
+                    raise vimconn.VimConnConnectionException("Not found security group {} for this tenant".format(sg))
 
     def check_vim_connectivity(self):
         # just get network list to check connectivity and credentials
 
     def check_vim_connectivity(self):
         # just get network list to check connectivity and credentials
@@ -541,7 +541,7 @@ class vimconnector(vimconn.vimconnector):
                     # or not declared, just ignore the checking
                     if isinstance(self.config.get('dataplane_physical_net'), (tuple, list)) and \
                             provider_physical_network not in self.config['dataplane_physical_net']:
                     # or not declared, just ignore the checking
                     if isinstance(self.config.get('dataplane_physical_net'), (tuple, list)) and \
                             provider_physical_network not in self.config['dataplane_physical_net']:
-                        raise vimconn.vimconnConflictException(
+                        raise vimconn.VimConnConflictException(
                             "Invalid parameter 'provider-network:physical-network' for network creation. '{}' is not "
                             "one of the declared list at VIM_config:dataplane_physical_net".format(
                                 provider_physical_network))
                             "Invalid parameter 'provider-network:physical-network' for network creation. '{}' is not "
                             "one of the declared list at VIM_config:dataplane_physical_net".format(
                                 provider_physical_network))
@@ -552,7 +552,7 @@ class vimconnector(vimconn.vimconnector):
                         provider_physical_network = provider_physical_network[0]
 
                 if not provider_physical_network:
                         provider_physical_network = provider_physical_network[0]
 
                 if not provider_physical_network:
-                    raise vimconn.vimconnConflictException("You must provide a 'dataplane_physical_net' at VIM_config "
+                    raise vimconn.VimConnConflictException("You must provide a 'dataplane_physical_net' at VIM_config "
                                                            "for creating underlay networks. or use the NS instantiation"
                                                            " parameter provider-network:physical-network for the VLD")
 
                                                            "for creating underlay networks. or use the NS instantiation"
                                                            " parameter provider-network:physical-network for the VLD")
 
@@ -582,7 +582,7 @@ class vimconnector(vimconn.vimconnector):
                         vlanID = self._generate_multisegment_vlanID()
                         segment2_dict["provider:segmentation_id"] = vlanID
                     # else
                         vlanID = self._generate_multisegment_vlanID()
                         segment2_dict["provider:segmentation_id"] = vlanID
                     # else
-                    #     raise vimconn.vimconnConflictException(
+                    #     raise vimconn.VimConnConflictException(
                     #         "You must provide 'multisegment_vlan_range' at config dict before creating a multisegment network")
                     segment_list.append(segment2_dict)
                     network_dict["segments"] = segment_list
                     #         "You must provide 'multisegment_vlan_range' at config dict before creating a multisegment network")
                     segment_list.append(segment2_dict)
                     network_dict["segments"] = segment_list
@@ -590,7 +590,7 @@ class vimconnector(vimconn.vimconnector):
                 # VIO Specific Changes. It needs a concrete VLAN
                 if self.vim_type == "VIO" and vlan is None:
                     if self.config.get('dataplane_net_vlan_range') is None:
                 # VIO Specific Changes. It needs a concrete VLAN
                 if self.vim_type == "VIO" and vlan is None:
                     if self.config.get('dataplane_net_vlan_range') is None:
-                        raise vimconn.vimconnConflictException(
+                        raise vimconn.VimConnConflictException(
                             "You must provide 'dataplane_net_vlan_range' in format [start_ID - end_ID] at VIM_config "
                             "for creating underlay networks")
                     network_dict["provider:segmentation_id"] = self._generate_vlanID()
                             "You must provide 'dataplane_net_vlan_range' in format [start_ID - end_ID] at VIM_config "
                             "for creating underlay networks")
                     network_dict["provider:segmentation_id"] = self._generate_vlanID()
@@ -695,9 +695,9 @@ class vimconnector(vimconn.vimconnector):
         filter_dict={"id": net_id}
         net_list = self.get_network_list(filter_dict)
         if len(net_list)==0:
         filter_dict={"id": net_id}
         net_list = self.get_network_list(filter_dict)
         if len(net_list)==0:
-            raise vimconn.vimconnNotFoundException("Network '{}' not found".format(net_id))
+            raise vimconn.VimConnNotFoundException("Network '{}' not found".format(net_id))
         elif len(net_list)>1:
         elif len(net_list)>1:
-            raise vimconn.vimconnConflictException("Found more than one network with this criteria")
+            raise vimconn.VimConnConflictException("Found more than one network with this criteria")
         net = net_list[0]
         subnets=[]
         for subnet_id in net.get("subnets", () ):
         net = net_list[0]
         subnets=[]
         for subnet_id in net.get("subnets", () ):
@@ -784,11 +784,11 @@ class vimconnector(vimconn.vimconnector):
 
                 if net_vim.get('fault'):  #TODO
                     net['error_msg'] = str(net_vim['fault'])
 
                 if net_vim.get('fault'):  #TODO
                     net['error_msg'] = str(net_vim['fault'])
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "DELETED"
                 net['error_msg'] = str(e)
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "DELETED"
                 net['error_msg'] = str(e)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "VIM_ERROR"
                 net['error_msg'] = str(e)
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "VIM_ERROR"
                 net['error_msg'] = str(e)
@@ -824,9 +824,9 @@ class vimconnector(vimconn.vimconnector):
             extended = flavor_dict.get("extended", {})
             if extended:
                 #TODO
             extended = flavor_dict.get("extended", {})
             if extended:
                 #TODO
-                raise vimconn.vimconnNotFoundException("Flavor with EPA still not implemented")
+                raise vimconn.VimConnNotFoundException("Flavor with EPA still not implemented")
                 # if len(numas) > 1:
                 # if len(numas) > 1:
-                #     raise vimconn.vimconnNotFoundException("Cannot find any flavor with more than one numa")
+                #     raise vimconn.VimConnNotFoundException("Cannot find any flavor with more than one numa")
                 # numa=numas[0]
                 # numas = extended.get("numas")
             for flavor in self.nova.flavors.list():
                 # numa=numas[0]
                 # numas = extended.get("numas")
             for flavor in self.nova.flavors.list():
@@ -842,7 +842,7 @@ class vimconnector(vimconn.vimconnector):
                     flavor_candidate_data = flavor_data
             if not exact_match and flavor_candidate_id:
                 return flavor_candidate_id
                     flavor_candidate_data = flavor_data
             if not exact_match and flavor_candidate_id:
                 return flavor_candidate_id
-            raise vimconn.vimconnNotFoundException("Cannot find any flavor matching '{}'".format(str(flavor_dict)))
+            raise vimconn.VimConnNotFoundException("Cannot find any flavor matching '{}'".format(str(flavor_dict)))
         except (nvExceptions.NotFound, nvExceptions.ClientException, ksExceptions.ClientException, ConnectionError) as e:
             self._format_exception(e)
 
         except (nvExceptions.NotFound, nvExceptions.ClientException, ksExceptions.ClientException, ConnectionError) as e:
             self._format_exception(e)
 
@@ -927,7 +927,7 @@ class vimconnector(vimconn.vimconnector):
                                     extra_specs["hw:cpu_policy"] = "dedicated"
                                 # for interface in numa.get("interfaces",() ):
                                 #     if interface["dedicated"]=="yes":
                                     extra_specs["hw:cpu_policy"] = "dedicated"
                                 # for interface in numa.get("interfaces",() ):
                                 #     if interface["dedicated"]=="yes":
-                                #         raise vimconn.vimconnException("Passthrough interfaces are not supported for the openstack connector", http_code=vimconn.HTTP_Service_Unavailable)
+                                #         raise vimconn.VimConnException("Passthrough interfaces are not supported for the openstack connector", http_code=vimconn.HTTP_Service_Unavailable)
                                 #     #TODO, add the key 'pci_passthrough:alias"="<label at config>:<number ifaces>"' when a way to connect it is available
                         elif extended.get("cpu-quota"):
                             self.process_resource_quota(extended.get("cpu-quota"), "cpu", extra_specs)
                                 #     #TODO, add the key 'pci_passthrough:alias"="<label at config>:<number ifaces>"' when a way to connect it is available
                         elif extended.get("cpu-quota"):
                             self.process_resource_quota(extended.get("cpu-quota"), "cpu", extra_specs)
@@ -1016,7 +1016,7 @@ class vimconnector(vimconn.vimconnector):
                     new_image = self.glance.images.create(name=image_dict['name'])
                 if image_dict['location'].startswith("http"):
                     # TODO there is not a method to direct download. It must be downloaded locally with requests
                     new_image = self.glance.images.create(name=image_dict['name'])
                 if image_dict['location'].startswith("http"):
                     # TODO there is not a method to direct download. It must be downloaded locally with requests
-                    raise vimconn.vimconnNotImplemented("Cannot create image from URL")
+                    raise vimconn.VimConnNotImplemented("Cannot create image from URL")
                 else: #local path
                     with open(image_dict['location']) as fimage:
                         self.glance.images.upload(new_image.id, fimage)
                 else: #local path
                     with open(image_dict['location']) as fimage:
                         self.glance.images.upload(new_image.id, fimage)
@@ -1037,7 +1037,7 @@ class vimconnector(vimconn.vimconnector):
                     continue
                 self._format_exception(e)
             except IOError as e:  #can not open the file
                     continue
                 self._format_exception(e)
             except IOError as e:  #can not open the file
-                raise vimconn.vimconnConnectionException(type(e).__name__ + ": " + str(e)+ " for " + image_dict['location'],
+                raise vimconn.VimConnConnectionException(type(e).__name__ + ": " + str(e)+ " for " + image_dict['location'],
                                                          http_code=vimconn.HTTP_Bad_Request)
 
     def delete_image(self, image_id):
                                                          http_code=vimconn.HTTP_Bad_Request)
 
     def delete_image(self, image_id):
@@ -1058,7 +1058,7 @@ class vimconnector(vimconn.vimconnector):
             for image in images:
                 if image.metadata.get("location")==path:
                     return image.id
             for image in images:
                 if image.metadata.get("location")==path:
                     return image.id
-            raise vimconn.vimconnNotFoundException("image with location '{}' not found".format( path))
+            raise vimconn.VimConnNotFoundException("image with location '{}' not found".format( path))
         except (ksExceptions.ClientException, nvExceptions.ClientException, gl1Exceptions.CommunicationError, ConnectionError) as e:
             self._format_exception(e)
 
         except (ksExceptions.ClientException, nvExceptions.ClientException, gl1Exceptions.CommunicationError, ConnectionError) as e:
             self._format_exception(e)
 
@@ -1111,7 +1111,7 @@ class vimconnector(vimconn.vimconnector):
 
         # if we exceeded the timeout rollback
         if elapsed_time >= server_timeout:
 
         # if we exceeded the timeout rollback
         if elapsed_time >= server_timeout:
-            raise vimconn.vimconnException('Timeout waiting for instance ' + vm_id + ' to get ' + status,
+            raise vimconn.VimConnException('Timeout waiting for instance ' + vm_id + ' to get ' + status,
                                            http_code=vimconn.HTTP_Request_Timeout)
 
     def _get_openstack_availablity_zones(self):
                                            http_code=vimconn.HTTP_Request_Timeout)
 
     def _get_openstack_availablity_zones(self):
@@ -1170,7 +1170,7 @@ class vimconnector(vimconn.vimconnector):
             else:
                 return availability_zone_list[availability_zone_index]
         else:
             else:
                 return availability_zone_list[availability_zone_index]
         else:
-            raise vimconn.vimconnConflictException("No enough availability zones at VIM for this deployment")
+            raise vimconn.VimConnConflictException("No enough availability zones at VIM for this deployment")
 
     def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
                        availability_zone_index=None, availability_zone_list=None):
 
     def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
                        availability_zone_index=None, availability_zone_list=None):
@@ -1347,7 +1347,7 @@ class vimconnector(vimconn.vimconnector):
                     elapsed_time += 5
                 # If we exceeded the timeout rollback
                 if elapsed_time >= volume_timeout:
                     elapsed_time += 5
                 # If we exceeded the timeout rollback
                 if elapsed_time >= volume_timeout:
-                    raise vimconn.vimconnException('Timeout creating volumes for instance ' + name,
+                    raise vimconn.VimConnException('Timeout creating volumes for instance ' + name,
                                                    http_code=vimconn.HTTP_Request_Timeout)
             # get availability Zone
             vm_av_zone = self._get_vm_availability_zone(availability_zone_index, availability_zone_list)
                                                    http_code=vimconn.HTTP_Request_Timeout)
             # get availability Zone
             vm_av_zone = self._get_vm_availability_zone(availability_zone_index, availability_zone_list)
@@ -1378,7 +1378,7 @@ class vimconnector(vimconn.vimconnector):
                     self.neutron.update_port(port_id,
                                              {"port": {"port_security_enabled": False, "security_groups": None}})
                 except Exception as e:
                     self.neutron.update_port(port_id,
                                              {"port": {"port_security_enabled": False, "security_groups": None}})
                 except Exception as e:
-                    raise vimconn.vimconnException("It was not possible to disable port security for port {}".format(
+                    raise vimconn.VimConnException("It was not possible to disable port security for port {}".format(
                         port_id))
             # print "DONE :-)", server
 
                         port_id))
             # print "DONE :-)", server
 
@@ -1409,11 +1409,11 @@ class vimconnector(vimconn.vimconnector):
                                             external_nets.append(net)
 
                                 if len(external_nets) == 0:
                                             external_nets.append(net)
 
                                 if len(external_nets) == 0:
-                                    raise vimconn.vimconnException("Cannot create floating_ip automatically since no external "
+                                    raise vimconn.VimConnException("Cannot create floating_ip automatically since no external "
                                                                    "network is present",
                                                                     http_code=vimconn.HTTP_Conflict)
                                 if len(external_nets) > 1:
                                                                    "network is present",
                                                                     http_code=vimconn.HTTP_Conflict)
                                 if len(external_nets) > 1:
-                                    raise vimconn.vimconnException("Cannot create floating_ip automatically since multiple "
+                                    raise vimconn.VimConnException("Cannot create floating_ip automatically since multiple "
                                                                    "external networks are present",
                                                                    http_code=vimconn.HTTP_Conflict)
 
                                                                    "external networks are present",
                                                                    http_code=vimconn.HTTP_Conflict)
 
@@ -1424,7 +1424,7 @@ class vimconnector(vimconn.vimconnector):
                                 new_floating_ip = self.neutron.create_floatingip(param)
                                 free_floating_ip = new_floating_ip['floatingip']['id']
                             except Exception as e:
                                 new_floating_ip = self.neutron.create_floatingip(param)
                                 free_floating_ip = new_floating_ip['floatingip']['id']
                             except Exception as e:
-                                raise vimconn.vimconnException(type(e).__name__ + ": Cannot create new floating_ip " +
+                                raise vimconn.VimConnException(type(e).__name__ + ": Cannot create new floating_ip " +
                                                                str(e), http_code=vimconn.HTTP_Conflict)
 
                         while not assigned:
                                                                str(e), http_code=vimconn.HTTP_Conflict)
 
                         while not assigned:
@@ -1441,7 +1441,7 @@ class vimconnector(vimconn.vimconnector):
                                     if time.time() - vm_start_time < server_timeout:
                                         time.sleep(5)
                                         continue
                                     if time.time() - vm_start_time < server_timeout:
                                         time.sleep(5)
                                         continue
-                                raise vimconn.vimconnException(
+                                raise vimconn.VimConnException(
                                     "Cannot create floating_ip: {} {}".format(type(e).__name__, e),
                                     http_code=vimconn.HTTP_Conflict)
 
                                     "Cannot create floating_ip: {} {}".format(type(e).__name__, e),
                                     http_code=vimconn.HTTP_Conflict)
 
@@ -1456,7 +1456,7 @@ class vimconnector(vimconn.vimconnector):
 #            error_value=-vimconn.HTTP_Not_Found
 #            error_text= "vm instance %s not found" % vm_id
 #        except TypeError as e:
 #            error_value=-vimconn.HTTP_Not_Found
 #            error_text= "vm instance %s not found" % vm_id
 #        except TypeError as e:
-#            raise vimconn.vimconnException(type(e).__name__ + ": "+  str(e), http_code=vimconn.HTTP_Bad_Request)
+#            raise vimconn.VimConnException(type(e).__name__ + ": "+  str(e), http_code=vimconn.HTTP_Bad_Request)
 
         except Exception as e:
             server_id = None
 
         except Exception as e:
             server_id = None
@@ -1507,7 +1507,7 @@ class vimconnector(vimconn.vimconnector):
             elif console_type == "spice-html5":
                 console_dict = server.get_spice_console(console_type)
             else:
             elif console_type == "spice-html5":
                 console_dict = server.get_spice_console(console_type)
             else:
-                raise vimconn.vimconnException("console type '{}' not allowed".format(console_type), http_code=vimconn.HTTP_Bad_Request)
+                raise vimconn.VimConnException("console type '{}' not allowed".format(console_type), http_code=vimconn.HTTP_Bad_Request)
 
             console_dict1 = console_dict.get("console")
             if console_dict1:
 
             console_dict1 = console_dict.get("console")
             if console_dict1:
@@ -1526,7 +1526,7 @@ class vimconnector(vimconn.vimconnector):
                                   }
                     protocol_index += 2
                     return console_dict
                                   }
                     protocol_index += 2
                     return console_dict
-            raise vimconn.vimconnUnexpectedResponse("Unexpected response from VIM")
+            raise vimconn.VimConnUnexpectedResponse("Unexpected response from VIM")
 
         except (nvExceptions.NotFound, ksExceptions.ClientException, nvExceptions.ClientException, nvExceptions.BadRequest, ConnectionError) as e:
             self._format_exception(e)
 
         except (nvExceptions.NotFound, ksExceptions.ClientException, nvExceptions.ClientException, nvExceptions.BadRequest, ConnectionError) as e:
             self._format_exception(e)
@@ -1676,11 +1676,11 @@ class vimconnector(vimconn.vimconnector):
                 except Exception as e:
                     self.logger.error("Error getting vm interface information {}: {}".format(type(e).__name__, e),
                                       exc_info=True)
                 except Exception as e:
                     self.logger.error("Error getting vm interface information {}: {}".format(type(e).__name__, e),
                                       exc_info=True)
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "DELETED"
                 vm['error_msg'] = str(e)
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "DELETED"
                 vm['error_msg'] = str(e)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "VIM_ERROR"
                 vm['error_msg'] = str(e)
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "VIM_ERROR"
                 vm['error_msg'] = str(e)
@@ -1737,7 +1737,7 @@ class vimconnector(vimconn.vimconnector):
                 elif console_type == "spice-html5":
                     console_dict = server.get_spice_console(console_type)
                 else:
                 elif console_type == "spice-html5":
                     console_dict = server.get_spice_console(console_type)
                 else:
-                    raise vimconn.vimconnException("console type '{}' not allowed".format(console_type),
+                    raise vimconn.VimConnException("console type '{}' not allowed".format(console_type),
                                                    http_code=vimconn.HTTP_Bad_Request)
                 try:
                     console_url = console_dict["console"]["url"]
                                                    http_code=vimconn.HTTP_Bad_Request)
                 try:
                     console_url = console_dict["console"]["url"]
@@ -1746,7 +1746,7 @@ class vimconnector(vimconn.vimconnector):
                     suffix_index = console_url[protocol_index+2:].find("/") + protocol_index+2
                     port_index = console_url[protocol_index+2:suffix_index].find(":") + protocol_index+2
                     if protocol_index < 0 or port_index<0 or suffix_index<0:
                     suffix_index = console_url[protocol_index+2:].find("/") + protocol_index+2
                     port_index = console_url[protocol_index+2:suffix_index].find(":") + protocol_index+2
                     if protocol_index < 0 or port_index<0 or suffix_index<0:
-                        raise vimconn.vimconnException("Unexpected response from VIM " + str(console_dict))
+                        raise vimconn.VimConnException("Unexpected response from VIM " + str(console_dict))
                     console_dict2={"protocol": console_url[0:protocol_index],
                                   "server":   console_url[protocol_index+2 : port_index],
                                   "port":     int(console_url[port_index+1 : suffix_index]),
                     console_dict2={"protocol": console_url[0:protocol_index],
                                   "server":   console_url[protocol_index+2 : port_index],
                                   "port":     int(console_url[port_index+1 : suffix_index]),
@@ -1754,7 +1754,7 @@ class vimconnector(vimconn.vimconnector):
                                   }
                     return console_dict2
                 except Exception as e:
                                   }
                     return console_dict2
                 except Exception as e:
-                    raise vimconn.vimconnException("Unexpected response from VIM " + str(console_dict))
+                    raise vimconn.VimConnException("Unexpected response from VIM " + str(console_dict))
 
             return None
         except (ksExceptions.ClientException, nvExceptions.ClientException, nvExceptions.NotFound, ConnectionError) as e:
 
             return None
         except (ksExceptions.ClientException, nvExceptions.ClientException, nvExceptions.NotFound, ConnectionError) as e:
@@ -1786,9 +1786,9 @@ class vimconnector(vimconn.vimconnector):
                     if vlanID not in used_vlanIDs:
                         return vlanID
             except Exception as exp:
                     if vlanID not in used_vlanIDs:
                         return vlanID
             except Exception as exp:
-                raise vimconn.vimconnException("Exception {} occurred while generating VLAN ID.".format(exp))
+                raise vimconn.VimConnException("Exception {} occurred while generating VLAN ID.".format(exp))
         else:
         else:
-            raise vimconn.vimconnConflictException("Unable to create the SRIOV VLAN network."\
+            raise vimconn.VimConnConflictException("Unable to create the SRIOV VLAN network."\
                 " All given Vlan IDs {} are in use.".format(self.config.get('dataplane_net_vlan_range')))
 
 
                 " All given Vlan IDs {} are in use.".format(self.config.get('dataplane_net_vlan_range')))
 
 
@@ -1820,9 +1820,9 @@ class vimconnector(vimconn.vimconnector):
                     if vlanID not in used_vlanIDs:
                         return vlanID
             except Exception as exp:
                     if vlanID not in used_vlanIDs:
                         return vlanID
             except Exception as exp:
-                raise vimconn.vimconnException("Exception {} occurred while generating VLAN ID.".format(exp))
+                raise vimconn.VimConnException("Exception {} occurred while generating VLAN ID.".format(exp))
         else:
         else:
-            raise vimconn.vimconnConflictException("Unable to create the VLAN segment."
+            raise vimconn.VimConnConflictException("Unable to create the VLAN segment."
                 " All VLAN IDs {} are in use.".format(self.config.get('multisegment_vlan_range')))
 
 
                 " All VLAN IDs {} are in use.".format(self.config.get('multisegment_vlan_range')))
 
 
@@ -1838,21 +1838,21 @@ class vimconnector(vimconn.vimconnector):
             vlanID_pattern = r'(\d)*-(\d)*$'
             match_obj = re.match(vlanID_pattern, vlan_range)
             if not match_obj:
             vlanID_pattern = r'(\d)*-(\d)*$'
             match_obj = re.match(vlanID_pattern, vlan_range)
             if not match_obj:
-                raise vimconn.vimconnConflictException("Invalid VLAN range for {}: {}.You must provide "\
+                raise vimconn.VimConnConflictException("Invalid VLAN range for {}: {}.You must provide "\
                 "'{}' in format [start_ID - end_ID].".format(text_vlan_range, vlanID_range, text_vlan_range))
 
             start_vlanid , end_vlanid = map(int,vlan_range.split("-"))
             if start_vlanid <= 0 :
                 "'{}' in format [start_ID - end_ID].".format(text_vlan_range, vlanID_range, text_vlan_range))
 
             start_vlanid , end_vlanid = map(int,vlan_range.split("-"))
             if start_vlanid <= 0 :
-                raise vimconn.vimconnConflictException("Invalid VLAN range for {}: {}."\
+                raise vimconn.VimConnConflictException("Invalid VLAN range for {}: {}."\
                 "Start ID can not be zero. For VLAN "\
                 "networks valid IDs are 1 to 4094 ".format(text_vlan_range, vlanID_range))
             if end_vlanid > 4094 :
                 "Start ID can not be zero. For VLAN "\
                 "networks valid IDs are 1 to 4094 ".format(text_vlan_range, vlanID_range))
             if end_vlanid > 4094 :
-                raise vimconn.vimconnConflictException("Invalid VLAN range for {}: {}."\
+                raise vimconn.VimConnConflictException("Invalid VLAN range for {}: {}."\
                 "End VLAN ID can not be greater than 4094. For VLAN "\
                 "networks valid IDs are 1 to 4094 ".format(text_vlan_range, vlanID_range))
 
             if start_vlanid > end_vlanid:
                 "End VLAN ID can not be greater than 4094. For VLAN "\
                 "networks valid IDs are 1 to 4094 ".format(text_vlan_range, vlanID_range))
 
             if start_vlanid > end_vlanid:
-                raise vimconn.vimconnConflictException("Invalid VLAN range for {}: {}."\
+                raise vimconn.VimConnConflictException("Invalid VLAN range for {}: {}."\
                     "You must provide '{}' in format start_ID - end_ID and "\
                     "start_ID < end_ID ".format(text_vlan_range, vlanID_range, text_vlan_range))
 
                     "You must provide '{}' in format start_ID - end_ID and "\
                     "start_ID < end_ID ".format(text_vlan_range, vlanID_range, text_vlan_range))
 
@@ -1970,12 +1970,12 @@ class vimconnector(vimconn.vimconnector):
             new_class = None
             self._reload_connection()
             if ctype not in supportedClassificationTypes:
             new_class = None
             self._reload_connection()
             if ctype not in supportedClassificationTypes:
-                raise vimconn.vimconnNotSupportedException(
+                raise vimconn.VimConnNotSupportedException(
                         'OpenStack VIM connector doesn\'t support provided '
                         'Classification Type {}, supported ones are: '
                         '{}'.format(ctype, supportedClassificationTypes))
             if not self._validate_classification(ctype, definition):
                         'OpenStack VIM connector doesn\'t support provided '
                         'Classification Type {}, supported ones are: '
                         '{}'.format(ctype, supportedClassificationTypes))
             if not self._validate_classification(ctype, definition):
-                raise vimconn.vimconnException(
+                raise vimconn.VimConnException(
                     'Incorrect Classification definition '
                     'for the type specified.')
             classification_dict = definition
                     'Incorrect Classification definition '
                     'for the type specified.')
             classification_dict = definition
@@ -1995,10 +1995,10 @@ class vimconnector(vimconn.vimconnector):
         filter_dict = {"id": class_id}
         class_list = self.get_classification_list(filter_dict)
         if len(class_list) == 0:
         filter_dict = {"id": class_id}
         class_list = self.get_classification_list(filter_dict)
         if len(class_list) == 0:
-            raise vimconn.vimconnNotFoundException(
+            raise vimconn.VimConnNotFoundException(
                 "Classification '{}' not found".format(class_id))
         elif len(class_list) > 1:
                 "Classification '{}' not found".format(class_id))
         elif len(class_list) > 1:
-            raise vimconn.vimconnConflictException(
+            raise vimconn.VimConnConflictException(
                 "Found more than one Classification with this criteria")
         classification = class_list[0]
         return classification
                 "Found more than one Classification with this criteria")
         classification = class_list[0]
         return classification
@@ -2040,11 +2040,11 @@ class vimconnector(vimconn.vimconnector):
             if sfc_encap:
                 correlation = 'nsh'
             if len(ingress_ports) != 1:
             if sfc_encap:
                 correlation = 'nsh'
             if len(ingress_ports) != 1:
-                raise vimconn.vimconnNotSupportedException(
+                raise vimconn.VimConnNotSupportedException(
                     "OpenStack VIM connector can only have "
                     "1 ingress port per SFI")
             if len(egress_ports) != 1:
                     "OpenStack VIM connector can only have "
                     "1 ingress port per SFI")
             if len(egress_ports) != 1:
-                raise vimconn.vimconnNotSupportedException(
+                raise vimconn.VimConnNotSupportedException(
                     "OpenStack VIM connector can only have "
                     "1 egress port per SFI")
             sfi_dict = {'name': name,
                     "OpenStack VIM connector can only have "
                     "1 egress port per SFI")
             sfi_dict = {'name': name,
@@ -2071,9 +2071,9 @@ class vimconnector(vimconn.vimconnector):
         filter_dict = {"id": sfi_id}
         sfi_list = self.get_sfi_list(filter_dict)
         if len(sfi_list) == 0:
         filter_dict = {"id": sfi_id}
         sfi_list = self.get_sfi_list(filter_dict)
         if len(sfi_list) == 0:
-            raise vimconn.vimconnNotFoundException("Service Function Instance '{}' not found".format(sfi_id))
+            raise vimconn.VimConnNotFoundException("Service Function Instance '{}' not found".format(sfi_id))
         elif len(sfi_list) > 1:
         elif len(sfi_list) > 1:
-            raise vimconn.vimconnConflictException(
+            raise vimconn.VimConnConflictException(
                 'Found more than one Service Function Instance '
                 'with this criteria')
         sfi = sfi_list[0]
                 'Found more than one Service Function Instance '
                 'with this criteria')
         sfi = sfi_list[0]
@@ -2117,7 +2117,7 @@ class vimconnector(vimconn.vimconnector):
             for instance in sfis:
                 sfi = self.get_sfi(instance)
                 if sfi.get('sfc_encap') != sfc_encap:
             for instance in sfis:
                 sfi = self.get_sfi(instance)
                 if sfi.get('sfc_encap') != sfc_encap:
-                    raise vimconn.vimconnNotSupportedException(
+                    raise vimconn.VimConnNotSupportedException(
                         "OpenStack VIM connector requires all SFIs of the "
                         "same SF to share the same SFC Encapsulation")
             sf_dict = {'name': name,
                         "OpenStack VIM connector requires all SFIs of the "
                         "same SF to share the same SFC Encapsulation")
             sf_dict = {'name': name,
@@ -2142,10 +2142,10 @@ class vimconnector(vimconn.vimconnector):
         filter_dict = {"id": sf_id}
         sf_list = self.get_sf_list(filter_dict)
         if len(sf_list) == 0:
         filter_dict = {"id": sf_id}
         sf_list = self.get_sf_list(filter_dict)
         if len(sf_list) == 0:
-            raise vimconn.vimconnNotFoundException(
+            raise vimconn.VimConnNotFoundException(
                 "Service Function '{}' not found".format(sf_id))
         elif len(sf_list) > 1:
                 "Service Function '{}' not found".format(sf_id))
         elif len(sf_list) > 1:
-            raise vimconn.vimconnConflictException(
+            raise vimconn.VimConnConflictException(
                 "Found more than one Service Function with this criteria")
         sf = sf_list[0]
         return sf
                 "Found more than one Service Function with this criteria")
         sf = sf_list[0]
         return sf
@@ -2211,10 +2211,10 @@ class vimconnector(vimconn.vimconnector):
         filter_dict = {"id": sfp_id}
         sfp_list = self.get_sfp_list(filter_dict)
         if len(sfp_list) == 0:
         filter_dict = {"id": sfp_id}
         sfp_list = self.get_sfp_list(filter_dict)
         if len(sfp_list) == 0:
-            raise vimconn.vimconnNotFoundException(
+            raise vimconn.VimConnNotFoundException(
                 "Service Function Path '{}' not found".format(sfp_id))
         elif len(sfp_list) > 1:
                 "Service Function Path '{}' not found".format(sfp_id))
         elif len(sfp_list) > 1:
-            raise vimconn.vimconnConflictException(
+            raise vimconn.VimConnConflictException(
                 "Found more than one Service Function Path with this criteria")
         sfp = sfp_list[0]
         return sfp
                 "Found more than one Service Function Path with this criteria")
         sfp = sfp_list[0]
         return sfp
@@ -2278,11 +2278,11 @@ class vimconnector(vimconn.vimconnector):
                 if sfp_vim.get('fault'):
                     sfp['error_msg'] = str(sfp_vim['fault'])
 
                 if sfp_vim.get('fault'):
                     sfp['error_msg'] = str(sfp_vim['fault'])
 
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting sfp status: %s", str(e))
                 sfp['status'] = "DELETED"
                 sfp['error_msg'] = str(e)
                 self.logger.error("Exception getting sfp status: %s", str(e))
                 sfp['status'] = "DELETED"
                 sfp['error_msg'] = str(e)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 self.logger.error("Exception getting sfp status: %s", str(e))
                 sfp['status'] = "VIM_ERROR"
                 sfp['error_msg'] = str(e)
                 self.logger.error("Exception getting sfp status: %s", str(e))
                 sfp['status'] = "VIM_ERROR"
                 sfp['error_msg'] = str(e)
@@ -2322,11 +2322,11 @@ class vimconnector(vimconn.vimconnector):
                 if sfi_vim.get('fault'):
                     sfi['error_msg'] = str(sfi_vim['fault'])
 
                 if sfi_vim.get('fault'):
                     sfi['error_msg'] = str(sfi_vim['fault'])
 
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting sfi status: %s", str(e))
                 sfi['status'] = "DELETED"
                 sfi['error_msg'] = str(e)
                 self.logger.error("Exception getting sfi status: %s", str(e))
                 sfi['status'] = "DELETED"
                 sfi['error_msg'] = str(e)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 self.logger.error("Exception getting sfi status: %s", str(e))
                 sfi['status'] = "VIM_ERROR"
                 sfi['error_msg'] = str(e)
                 self.logger.error("Exception getting sfi status: %s", str(e))
                 sfi['status'] = "VIM_ERROR"
                 sfi['error_msg'] = str(e)
@@ -2366,11 +2366,11 @@ class vimconnector(vimconn.vimconnector):
                 if sf_vim.get('fault'):
                     sf['error_msg'] = str(sf_vim['fault'])
 
                 if sf_vim.get('fault'):
                     sf['error_msg'] = str(sf_vim['fault'])
 
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting sf status: %s", str(e))
                 sf['status'] = "DELETED"
                 sf['error_msg'] = str(e)
                 self.logger.error("Exception getting sf status: %s", str(e))
                 sf['status'] = "DELETED"
                 sf['error_msg'] = str(e)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 self.logger.error("Exception getting sf status: %s", str(e))
                 sf['status'] = "VIM_ERROR"
                 sf['error_msg'] = str(e)
                 self.logger.error("Exception getting sf status: %s", str(e))
                 sf['status'] = "VIM_ERROR"
                 sf['error_msg'] = str(e)
@@ -2411,11 +2411,11 @@ class vimconnector(vimconn.vimconnector):
                 if classification_vim.get('fault'):
                     classification['error_msg'] = str(classification_vim['fault'])
 
                 if classification_vim.get('fault'):
                     classification['error_msg'] = str(classification_vim['fault'])
 
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting classification status: %s", str(e))
                 classification['status'] = "DELETED"
                 classification['error_msg'] = str(e)
                 self.logger.error("Exception getting classification status: %s", str(e))
                 classification['status'] = "DELETED"
                 classification['error_msg'] = str(e)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 self.logger.error("Exception getting classification status: %s", str(e))
                 classification['status'] = "VIM_ERROR"
                 classification['error_msg'] = str(e)
                 self.logger.error("Exception getting classification status: %s", str(e))
                 classification['status'] = "VIM_ERROR"
                 classification['error_msg'] = str(e)
index 9c7dd5c..2a4b69e 100644 (file)
@@ -23,4 +23,4 @@ netaddr
 #TODO py3 python-keystoneclient
 #TODO py3 python-glanceclient
 #TODO py3 python-cinderclient
 #TODO py3 python-keystoneclient
 #TODO py3 python-glanceclient
 #TODO py3 python-cinderclient
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 56c798b..8c3b1ee 100644 (file)
@@ -47,12 +47,12 @@ setup(
     install_requires=[
         "python-openstackclient", "python-neutronclient", 
         "requests", "netaddr", "PyYAML",
     install_requires=[
         "python-openstackclient", "python-neutronclient", 
         "requests", "netaddr", "PyYAML",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
         # TODO py3 "networking-l2gw"
         # "python-novaclient", "python-keystoneclient", "python-glanceclient", "python-cinderclient",
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
         # TODO py3 "networking-l2gw"
         # "python-novaclient", "python-keystoneclient", "python-glanceclient", "python-cinderclient",
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_openstack = osm_rovim_openstack.vimconn_openstack'],
+        'osm_rovim.plugins': ['rovim_openstack = osm_rovim_openstack.vimconn_openstack:vimconnector'],
     },
 )
     },
 )
index ef5f94d..a0adf96 100644 (file)
@@ -15,6 +15,7 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
 Depends3: python3-openstackclient, python3-neutronclient, python3-requests, python3-netaddr, python3-yaml,
 Depends3: python3-openstackclient, python3-neutronclient, python3-requests, python3-netaddr, python3-yaml,
-          python3-osm-ro, python3-pip
+          python3-osm-ro-plugin, python3-pip
           # TODO py3 python3-networking-l2gw
           # TODO py3 python3-networking-l2gw
index 9490485..0c24003 100644 (file)
@@ -27,7 +27,7 @@ vimconnector implements all the methods to interact with openvim using the openv
 __author__="Alfonso Tierno, Gerardo Garcia"
 __date__ ="$26-aug-2014 11:09:29$"
 
 __author__="Alfonso Tierno, Gerardo Garcia"
 __date__ ="$26-aug-2014 11:09:29$"
 
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 import requests
 import json
 import yaml
 import requests
 import json
 import yaml
@@ -324,10 +324,10 @@ get_processor_rankings_response_schema = {
 }
 
 
 }
 
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None,
                  log_level="DEBUG", config={}, persistent_info={}):
     def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None,
                  log_level="DEBUG", config={}, persistent_info={}):
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level, config)
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level, config)
         self.tenant = None
         self.headers_req = {'content-type': 'application/json'}
         self.logger = logging.getLogger('openmano.vim.openvim')
         self.tenant = None
         self.headers_req = {'content-type': 'application/json'}
         self.logger = logging.getLogger('openmano.vim.openvim')
@@ -343,7 +343,7 @@ class vimconnector(vimconn.vimconnector):
             self.tenant = value
         elif index=='tenant_name':
             self.tenant = None
             self.tenant = value
         elif index=='tenant_name':
             self.tenant = None
-        vimconn.vimconnector.__setitem__(self,index, value)    
+        vimconn.VimConnector.__setitem__(self,index, value)    
 
     def _get_my_tenant(self):
         '''Obtain uuid of my tenant from name
 
     def _get_my_tenant(self):
         '''Obtain uuid of my tenant from name
@@ -358,13 +358,13 @@ class vimconnector(vimconn.vimconnector):
         try:
             tenant_list = vim_response.json()["tenants"]
             if len(tenant_list) == 0:
         try:
             tenant_list = vim_response.json()["tenants"]
             if len(tenant_list) == 0:
-                raise vimconn.vimconnNotFoundException("No tenant found for name '{}'".format(self.tenant_name))
+                raise vimconn.VimConnNotFoundException("No tenant found for name '{}'".format(self.tenant_name))
             elif len(tenant_list) > 1:
             elif len(tenant_list) > 1:
-                raise vimconn.vimconnConflictException ("More that one tenant found for name '{}'".format(self.tenant_name))
+                raise vimconn.VimConnConflictException ("More that one tenant found for name '{}'".format(self.tenant_name))
             self.tenant = tenant_list[0]["id"]
             return self.tenant
         except Exception as e:
             self.tenant = tenant_list[0]["id"]
             return self.tenant
         except Exception as e:
-            raise vimconn.vimconnUnexpectedResponse("Get VIM tenant {} '{}'".format(type(e).__name__, str(e)))
+            raise vimconn.VimConnUnexpectedResponse("Get VIM tenant {} '{}'".format(type(e).__name__, str(e)))
 
     def _format_jsonerror(self,http_response):
         #DEPRECATED, to delete in the future
 
     def _format_jsonerror(self,http_response):
         #DEPRECATED, to delete in the future
@@ -409,24 +409,24 @@ class vimconnector(vimconn.vimconnector):
     def _format_request_exception(self, request_exception):
         '''Transform a request exception into a vimconn exception'''
         if isinstance(request_exception, js_e.ValidationError):
     def _format_request_exception(self, request_exception):
         '''Transform a request exception into a vimconn exception'''
         if isinstance(request_exception, js_e.ValidationError):
-            raise vimconn.vimconnUnexpectedResponse("jsonschema exception '{}' at '{}'".format(request_exception.message, request_exception.path))            
+            raise vimconn.VimConnUnexpectedResponse("jsonschema exception '{}' at '{}'".format(request_exception.message, request_exception.path))            
         elif isinstance(request_exception, requests.exceptions.HTTPError):
         elif isinstance(request_exception, requests.exceptions.HTTPError):
-            raise vimconn.vimconnUnexpectedResponse(type(request_exception).__name__ + ": " + str(request_exception))
+            raise vimconn.VimConnUnexpectedResponse(type(request_exception).__name__ + ": " + str(request_exception))
         else:
         else:
-            raise vimconn.vimconnConnectionException(type(request_exception).__name__ + ": " + str(request_exception))
+            raise vimconn.VimConnConnectionException(type(request_exception).__name__ + ": " + str(request_exception))
 
     def _check_http_request_response(self, request_response):
         '''Raise a vimconn exception if the response is not Ok'''
         if request_response.status_code >= 200 and  request_response.status_code < 300:
             return
         if request_response.status_code == vimconn.HTTP_Unauthorized:
 
     def _check_http_request_response(self, request_response):
         '''Raise a vimconn exception if the response is not Ok'''
         if request_response.status_code >= 200 and  request_response.status_code < 300:
             return
         if request_response.status_code == vimconn.HTTP_Unauthorized:
-            raise vimconn.vimconnAuthException(request_response.text)
+            raise vimconn.VimConnAuthException(request_response.text)
         elif request_response.status_code == vimconn.HTTP_Not_Found:
         elif request_response.status_code == vimconn.HTTP_Not_Found:
-            raise vimconn.vimconnNotFoundException(request_response.text)
+            raise vimconn.VimConnNotFoundException(request_response.text)
         elif request_response.status_code == vimconn.HTTP_Conflict:
         elif request_response.status_code == vimconn.HTTP_Conflict:
-            raise vimconn.vimconnConflictException(request_response.text)
+            raise vimconn.VimConnConflictException(request_response.text)
         else: 
         else: 
-            raise vimconn.vimconnUnexpectedResponse("VIM HTTP_response {}, {}".format(request_response.status_code, str(request_response.text)))
+            raise vimconn.VimConnUnexpectedResponse("VIM HTTP_response {}, {}".format(request_response.status_code, str(request_response.text)))
 
     def new_tenant(self,tenant_name,tenant_description):
         '''Adds a new tenant to VIM with this name and description, returns the tenant identifier'''
 
     def new_tenant(self,tenant_name,tenant_description):
         '''Adds a new tenant to VIM with this name and description, returns the tenant identifier'''
@@ -759,9 +759,9 @@ class vimconnector(vimconn.vimconnector):
             #if r is not None: 
             #    self.logger.warn("Warning: remove extra items %s", str(r))
             if len(response['images'])==0:
             #if r is not None: 
             #    self.logger.warn("Warning: remove extra items %s", str(r))
             if len(response['images'])==0:
-                raise vimconn.vimconnNotFoundException("Image not found at VIM with path '{}'".format(path))
+                raise vimconn.VimConnNotFoundException("Image not found at VIM with path '{}'".format(path))
             elif len(response['images'])>1:
             elif len(response['images'])>1:
-                raise vimconn.vimconnConflictException("More than one image found at VIM with path '{}'".format(path))
+                raise vimconn.VimConnConflictException("More than one image found at VIM with path '{}'".format(path))
             return response['images'][0]['id']
         except (requests.exceptions.RequestException, js_e.ValidationError) as e:
             self._format_request_exception(e)
             return response['images'][0]['id']
         except (requests.exceptions.RequestException, js_e.ValidationError) as e:
             self._format_request_exception(e)
@@ -1033,11 +1033,11 @@ class vimconnector(vimconn.vimconnector):
                 if vm['status'] == "ACTIVE" and not management_ip:
                     vm['status'] = "ACTIVE:NoMgmtIP"
                     
                 if vm['status'] == "ACTIVE" and not management_ip:
                     vm['status'] = "ACTIVE:NoMgmtIP"
                     
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "DELETED"
                 vm['error_msg'] = str(e)
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "DELETED"
                 vm['error_msg'] = str(e)
-            except (requests.exceptions.RequestException, js_e.ValidationError, vimconn.vimconnException) as e:
+            except (requests.exceptions.RequestException, js_e.ValidationError, vimconn.VimConnException) as e:
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "VIM_ERROR"
                 vm['error_msg'] = str(e)
                 self.logger.error("Exception getting vm status: %s", str(e))
                 vm['status'] = "VIM_ERROR"
                 vm['error_msg'] = str(e)
@@ -1083,11 +1083,11 @@ class vimconnector(vimconn.vimconnector):
                 if net_vim.get('last_error'):
                     net['error_msg'] = net_vim['last_error']
                 net["vim_info"] = yaml.safe_dump(net_vim)
                 if net_vim.get('last_error'):
                     net['error_msg'] = net_vim['last_error']
                 net["vim_info"] = yaml.safe_dump(net_vim)
-            except vimconn.vimconnNotFoundException as e:
+            except vimconn.VimConnNotFoundException as e:
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "DELETED"
                 net['error_msg'] = str(e)
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "DELETED"
                 net['error_msg'] = str(e)
-            except (requests.exceptions.RequestException, js_e.ValidationError, vimconn.vimconnException) as e:
+            except (requests.exceptions.RequestException, js_e.ValidationError, vimconn.VimConnException) as e:
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "VIM_ERROR"
                 net['error_msg'] = str(e)
                 self.logger.error("Exception getting net status: %s", str(e))
                 net['status'] = "VIM_ERROR"
                 net['error_msg'] = str(e)
@@ -1100,7 +1100,7 @@ class vimconnector(vimconn.vimconnector):
         try:
             self._get_my_tenant()
             if "console" in action_dict:
         try:
             self._get_my_tenant()
             if "console" in action_dict:
-                raise vimconn.vimconnException("getting console is not available at openvim", http_code=vimconn.HTTP_Service_Unavailable)
+                raise vimconn.VimConnException("getting console is not available at openvim", http_code=vimconn.HTTP_Service_Unavailable)
             url = self.url+'/'+self.tenant+'/servers/'+vm_id+"/action"
             self.logger.info("Action over VM instance POST %s", url)
             vim_response = requests.post(url, headers = self.headers_req, data=json.dumps(action_dict) )
             url = self.url+'/'+self.tenant+'/servers/'+vm_id+"/action"
             self.logger.info("Action over VM instance POST %s", url)
             vim_response = requests.post(url, headers = self.headers_req, data=json.dumps(action_dict) )
index 34a2518..5802df5 100644 (file)
@@ -16,4 +16,4 @@
 PyYAML
 requests
 netaddr
 PyYAML
 requests
 netaddr
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 7a9070c..ab99577 100644 (file)
@@ -46,10 +46,10 @@ setup(
     include_package_data=True,
     install_requires=[
         "requests", "netaddr", "PyYAML",
     include_package_data=True,
     install_requires=[
         "requests", "netaddr", "PyYAML",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_openvim = osm_rovim_openvim.vimconn_openvim'],
+        'osm_rovim.plugins': ['rovim_openvim = osm_rovim_openvim.vimconn_openvim:vimconnector'],
     },
 )
     },
 )
index 50f9821..b5efb97 100644 (file)
@@ -15,4 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
+Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro-plugin
index 1fe3e65..04f9d80 100755 (executable)
@@ -23,7 +23,7 @@
 
 
 from osm_rovim_vmware.vimconn_vmware import vimconnector
 
 
 from osm_rovim_vmware.vimconn_vmware import vimconnector
-from osm_ro.vimconn import vimconnUnexpectedResponse, vimconnNotFoundException,vimconnException
+from osm_ro_plugin.vimconn import VimConnUnexpectedResponse, VimConnNotFoundException,VimConnException
 from pyvcloud.vcd.client import Client
 from lxml import etree as lxmlElementTree
 from pyvcloud.vcd.org import Org
 from pyvcloud.vcd.client import Client
 from lxml import etree as lxmlElementTree
 from pyvcloud.vcd.org import Org
@@ -78,7 +78,7 @@ class TestVimconn_VMware(unittest.TestCase):
         perform_request.return_value.content = xml_resp.vdc_xml_response
 
         # call to VIM connector method with invalid id
         perform_request.return_value.content = xml_resp.vdc_xml_response
 
         # call to VIM connector method with invalid id
-        self.assertRaises(vimconnNotFoundException,self.vim.get_network,'mgmt-net')
+        self.assertRaises(VimConnNotFoundException,self.vim.get_network,'mgmt-net')
 
     @mock.patch.object(vimconnector,'perform_request')
     @mock.patch.object(vimconnector,'get_vdc_details')
 
     @mock.patch.object(vimconnector,'perform_request')
     @mock.patch.object(vimconnector,'get_vdc_details')
@@ -189,7 +189,7 @@ class TestVimconn_VMware(unittest.TestCase):
                                               <OrgVdcNetwork></OrgVdcNetwork>"""
 
         # assert verified expected and return result from VIM connector
                                               <OrgVdcNetwork></OrgVdcNetwork>"""
 
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnUnexpectedResponse,self.vim.new_network,
+        self.assertRaises(VimConnUnexpectedResponse,self.vim.new_network,
                                                               'test_net',
                                                                 'bridge')
 
                                                               'test_net',
                                                                 'bridge')
 
@@ -222,7 +222,7 @@ class TestVimconn_VMware(unittest.TestCase):
         # assumed return value from VIM connector
         get_vcd_network.return_value = False
         # assert verified expected and return result from VIM connector
         # assumed return value from VIM connector
         get_vcd_network.return_value = False
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnNotFoundException,self.vim.delete_network,
+        self.assertRaises(VimConnNotFoundException,self.vim.delete_network,
                                     '2a23e5d1-42a2-0648-bc92-cb508046bf87')
 
     def test_get_flavor(self):
                                     '2a23e5d1-42a2-0648-bc92-cb508046bf87')
 
     def test_get_flavor(self):
@@ -244,7 +244,7 @@ class TestVimconn_VMware(unittest.TestCase):
         """
         vimconnector.flavorlist = {}
         # assert verified expected and return result from VIM connector
         """
         vimconnector.flavorlist = {}
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnNotFoundException,self.vim.get_flavor,
+        self.assertRaises(VimConnNotFoundException,self.vim.get_flavor,
                                 'a646eb8a-95bd-4e81-8321-5413ee72b62e')
 
     def test_new_flavor(self):
                                 'a646eb8a-95bd-4e81-8321-5413ee72b62e')
 
     def test_new_flavor(self):
@@ -287,7 +287,7 @@ class TestVimconn_VMware(unittest.TestCase):
                                        ]
 
         # assert verified expected and return result from VIM connector
                                        ]
 
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnNotFoundException, self.vim.delete_image, 'invali3453')
+        self.assertRaises(VimConnNotFoundException, self.vim.delete_image, 'invali3453')
 
     @mock.patch.object(vimconnector,'get_vdc_details')
     @mock.patch.object(vimconnector,'connect')
 
     @mock.patch.object(vimconnector,'get_vdc_details')
     @mock.patch.object(vimconnector,'connect')
@@ -550,7 +550,7 @@ class TestVimconn_VMware(unittest.TestCase):
         create_vdc.return_value = None
 
         # assert verified expected and return result from VIM connector
         create_vdc.return_value = None
 
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnException,self.vim.new_tenant,tenant_name)
+        self.assertRaises(VimConnException,self.vim.new_tenant,tenant_name)
 
     @mock.patch.object(vimconnector,'connect_as_admin')
     @mock.patch.object(vimconnector,'connect')
 
     @mock.patch.object(vimconnector,'connect_as_admin')
     @mock.patch.object(vimconnector,'connect')
@@ -587,7 +587,7 @@ class TestVimconn_VMware(unittest.TestCase):
         perform_request.return_value.status_code = 201
 
         # assert verified expected and return result from VIM connector
         perform_request.return_value.status_code = 201
 
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnNotFoundException,self.vim.delete_tenant,tenant_id)
+        self.assertRaises(VimConnNotFoundException,self.vim.delete_tenant,tenant_id)
 
     @mock.patch.object(vimconnector,'get_vdc_details')
     @mock.patch.object(Org,'list_catalogs')
 
     @mock.patch.object(vimconnector,'get_vdc_details')
     @mock.patch.object(Org,'list_catalogs')
@@ -708,7 +708,7 @@ class TestVimconn_VMware(unittest.TestCase):
                                        content = "Bad request error")]
 
         # call to VIM connector method
                                        content = "Bad request error")]
 
         # call to VIM connector method
-        self.assertRaises(vimconnUnexpectedResponse,self.vim.new_vminstance,
+        self.assertRaises(VimConnUnexpectedResponse,self.vim.new_vminstance,
                                                                  name='Test1_vm',
                                                                  image_id=image_id,
                                                                  flavor_id=flavor_id,
                                                                  name='Test1_vm',
                                                                  image_id=image_id,
                                                                  flavor_id=flavor_id,
@@ -779,7 +779,7 @@ class TestVimconn_VMware(unittest.TestCase):
         get_catalogid.return_value = '34925a30-0f4a-4018-9759-0d6799063b51'
 
         # assert verified expected and return result from VIM connector
         get_catalogid.return_value = '34925a30-0f4a-4018-9759-0d6799063b51'
 
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnException,self.vim.new_image,{'name':'TestImage', 'location':path})
+        self.assertRaises(VimConnException,self.vim.new_image,{'name':'TestImage', 'location':path})
 
     @mock.patch.object(vimconnector,'connect_as_admin')
     @mock.patch.object(vimconnector,'perform_request')
 
     @mock.patch.object(vimconnector,'connect_as_admin')
     @mock.patch.object(vimconnector,'perform_request')
@@ -878,7 +878,7 @@ class TestVimconn_VMware(unittest.TestCase):
         create_catalog.return_value = catalog
         upload_vimimage.return_value = False
         get_catalogid.return_value = '7208-0f6777052c30'
         create_catalog.return_value = catalog
         upload_vimimage.return_value = False
         get_catalogid.return_value = '7208-0f6777052c30'
-        self.assertRaises(vimconnException, self.vim.get_image_id_from_path, path)
+        self.assertRaises(VimConnException, self.vim.get_image_id_from_path, path)
 
     @mock.patch.object(vimconnector,'get_vdc_details')
     @mock.patch.object(vimconnector,'connect')
 
     @mock.patch.object(vimconnector,'get_vdc_details')
     @mock.patch.object(vimconnector,'connect')
@@ -915,7 +915,7 @@ class TestVimconn_VMware(unittest.TestCase):
         get_vapp_details_rest.return_value = False
 
         # assert verified expected and return result from VIM connector
         get_vapp_details_rest.return_value = False
 
         # assert verified expected and return result from VIM connector
-        self.assertRaises(vimconnNotFoundException, self.vim.get_vminstance,invalid_vmid)
+        self.assertRaises(VimConnNotFoundException, self.vim.get_vminstance,invalid_vmid)
 
     @mock.patch.object(vimconnector,'connect')
     @mock.patch.object(vimconnector,'get_namebyvappid')
 
     @mock.patch.object(vimconnector,'connect')
     @mock.patch.object(vimconnector,'get_namebyvappid')
@@ -940,7 +940,7 @@ class TestVimconn_VMware(unittest.TestCase):
         get_vapp.return_value = None
 
         # call to VIM connector method
         get_vapp.return_value = None
 
         # call to VIM connector method
-        self.assertRaises(vimconnException, self.vim.delete_vminstance,vm_id)
+        self.assertRaises(VimConnException, self.vim.delete_vminstance,vm_id)
 
     @mock.patch.object(vimconnector,'get_vcd_network')
     def test_refresh_nets_status_negative(self, get_vcd_network):
 
     @mock.patch.object(vimconnector,'get_vcd_network')
     def test_refresh_nets_status_negative(self, get_vcd_network):
@@ -977,4 +977,4 @@ class TestVimconn_VMware(unittest.TestCase):
         self.vim.client = self.vim.connect()
 
         # call to VIM connector method
         self.vim.client = self.vim.connect()
 
         # call to VIM connector method
-        self.assertRaises(vimconnException, self.vim.action_vminstance, vm_id,{'invalid': None})
+        self.assertRaises(VimConnException, self.vim.action_vminstance, vm_id,{'invalid': None})
index 6bb83e4..b698f4c 100644 (file)
@@ -26,7 +26,7 @@ vimconn_vmware implementation an Abstract class in order to interact with VMware
 """
 
 from lxml import etree as lxmlElementTree
 """
 
 from lxml import etree as lxmlElementTree
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 from progressbar import Percentage, Bar, ETA, FileTransferSpeed, ProgressBar
 from pyVim.connect import SmartConnect, Disconnect
 from pyVmomi import vim, vmodl  # @UnresolvedImport
 from progressbar import Percentage, Bar, ETA, FileTransferSpeed, ProgressBar
 from pyVim.connect import SmartConnect, Disconnect
 from pyVmomi import vim, vmodl  # @UnresolvedImport
@@ -110,7 +110,7 @@ netStatus2manoFormat = {'ACTIVE': 'ACTIVE',
                         }
 
 
                         }
 
 
-class vimconnector(vimconn.vimconnector):
+class vimconnector(vimconn.VimConnector):
     # dict used to store flavor in memory
     flavorlist = {}
 
     # dict used to store flavor in memory
     flavorlist = {}
 
@@ -148,7 +148,7 @@ class vimconnector(vimconn.vimconnector):
                 Nothing.
         """
 
                 Nothing.
         """
 
-        vimconn.vimconnector.__init__(self, uuid, name, tenant_id, tenant_name, url,
+        vimconn.VimConnector.__init__(self, uuid, name, tenant_id, tenant_name, url,
                                       url_admin, user, passwd, log_level, config)
 
         self.logger = logging.getLogger('openmano.vim.vmware')
                                       url_admin, user, passwd, log_level, config)
 
         self.logger = logging.getLogger('openmano.vim.vmware')
@@ -192,14 +192,14 @@ class vimconnector(vimconn.vimconnector):
             self.admin_user = config['admin_username']
             self.admin_password = config['admin_password']
         except KeyError:
             self.admin_user = config['admin_username']
             self.admin_password = config['admin_password']
         except KeyError:
-            raise vimconn.vimconnException(message="Error admin username or admin password is empty.")
+            raise vimconn.VimConnException(message="Error admin username or admin password is empty.")
 
         try:
             self.nsx_manager = config['nsx_manager']
             self.nsx_user = config['nsx_user']
             self.nsx_password = config['nsx_password']
         except KeyError:
 
         try:
             self.nsx_manager = config['nsx_manager']
             self.nsx_user = config['nsx_user']
             self.nsx_password = config['nsx_password']
         except KeyError:
-            raise vimconn.vimconnException(message="Error: nsx manager or nsx user or nsx password is empty in Config")
+            raise vimconn.VimConnException(message="Error: nsx manager or nsx user or nsx password is empty in Config")
 
         self.vcenter_ip = config.get("vcenter_ip", None)
         self.vcenter_port = config.get("vcenter_port", None)
 
         self.vcenter_ip = config.get("vcenter_ip", None)
         self.vcenter_port = config.get("vcenter_port", None)
@@ -213,7 +213,7 @@ class vimconnector(vimconn.vimconnector):
 #         try:
 #             self.dvs_name = config['dv_switch_name']
 #         except KeyError:
 #         try:
 #             self.dvs_name = config['dv_switch_name']
 #         except KeyError:
-#             raise vimconn.vimconnException(message="Error: distributed virtaul switch name is empty in Config")
+#             raise vimconn.VimConnException(message="Error: distributed virtaul switch name is empty in Config")
 #
 #         self.vlanID_range = config.get("vlanID_range", None)
 
 #
 #         self.vlanID_range = config.get("vlanID_range", None)
 
@@ -221,7 +221,7 @@ class vimconnector(vimconn.vimconnector):
         self.client = None
 
         if not url:
         self.client = None
 
         if not url:
-            raise vimconn.vimconnException('url param can not be NoneType')
+            raise vimconn.VimConnException('url param can not be NoneType')
 
         if not self.url_admin:  # try to use normal url
             self.url_admin = self.url
 
         if not self.url_admin:  # try to use normal url
             self.url_admin = self.url
@@ -301,7 +301,7 @@ class vimconnector(vimconn.vimconnector):
             client_as_admin = Client(host, verify_ssl_certs=False, api_version=API_VERSION)
             client_as_admin.set_credentials(BasicLoginCredentials(self.admin_user, org, self.admin_password))
         except Exception as e:
             client_as_admin = Client(host, verify_ssl_certs=False, api_version=API_VERSION)
             client_as_admin.set_credentials(BasicLoginCredentials(self.admin_user, org, self.admin_password))
         except Exception as e:
-            raise vimconn.vimconnException(
+            raise vimconn.VimConnException(
                 "Can't connect to vCloud director as: {} with exception {}".format(self.admin_user, e))
 
         return client_as_admin
                 "Can't connect to vCloud director as: {} with exception {}".format(self.admin_user, e))
 
         return client_as_admin
@@ -320,7 +320,7 @@ class vimconnector(vimconn.vimconnector):
             client = Client(host, verify_ssl_certs=False, api_version=API_VERSION)
             client.set_credentials(BasicLoginCredentials(self.user, self.org_name, self.passwd))
         except Exception as e:
             client = Client(host, verify_ssl_certs=False, api_version=API_VERSION)
             client.set_credentials(BasicLoginCredentials(self.user, self.org_name, self.passwd))
         except Exception as e:
-            raise vimconn.vimconnConnectionException("Can't connect to vCloud director org: "
+            raise vimconn.VimConnConnectionException("Can't connect to vCloud director org: "
                                                      "{} as user {} with exception: {}".format(self.org_name,
                                                                                                self.user,
                                                                                                e))
                                                      "{} as user {} with exception: {}".format(self.org_name,
                                                                                                self.user,
                                                                                                e))
@@ -340,7 +340,7 @@ class vimconnector(vimconn.vimconnector):
         """
         client = self.connect()
         if not client:
         """
         client = self.connect()
         if not client:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD.")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD.")
 
         self.client = client
         try:
 
         self.client = client
         try:
@@ -353,7 +353,7 @@ class vimconnector(vimconn.vimconnector):
                         self.logger.debug("Setting organization UUID {}".format(self.org_uuid))
                         break
                 else:
                         self.logger.debug("Setting organization UUID {}".format(self.org_uuid))
                         break
                 else:
-                    raise vimconn.vimconnException("Vcloud director organization {} not found".format(self.org_name))
+                    raise vimconn.VimConnException("Vcloud director organization {} not found".format(self.org_name))
 
                 # if well good we require for org details
                 org_details_dict = self.get_org(org_uuid=self.org_uuid)
 
                 # if well good we require for org details
                 org_details_dict = self.get_org(org_uuid=self.org_uuid)
@@ -369,7 +369,7 @@ class vimconnector(vimconn.vimconnector):
                                                                                                     self.org_name))
                             break
                     else:
                                                                                                     self.org_name))
                             break
                     else:
-                        raise vimconn.vimconnException("Tenant name indicated but not present in vcloud director.")
+                        raise vimconn.VimConnException("Tenant name indicated but not present in vcloud director.")
                     # case two we have tenant_id but we don't have tenant name so we find and set it.
                     if self.tenant_id is not None and self.tenant_name is None and 'vdcs' in org_details_dict:
                         vdcs_dict = org_details_dict['vdcs']
                     # case two we have tenant_id but we don't have tenant name so we find and set it.
                     if self.tenant_id is not None and self.tenant_name is None and 'vdcs' in org_details_dict:
                         vdcs_dict = org_details_dict['vdcs']
@@ -380,7 +380,7 @@ class vimconnector(vimconn.vimconnector):
                                                                                                         self.org_name))
                                 break
                         else:
                                                                                                         self.org_name))
                                 break
                         else:
-                            raise vimconn.vimconnException("Tenant id indicated but not present in vcloud director")
+                            raise vimconn.VimConnException("Tenant id indicated but not present in vcloud director")
             self.logger.debug("Setting organization uuid {}".format(self.org_uuid))
         except Exception as e:
             self.logger.debug("Failed initialize organization UUID for org {}: {}".format(self.org_name), e)
             self.logger.debug("Setting organization uuid {}".format(self.org_uuid))
         except Exception as e:
             self.logger.debug("Failed initialize organization UUID for org {}: {}".format(self.org_name), e)
@@ -397,7 +397,7 @@ class vimconnector(vimconn.vimconnector):
 
             Return:
                 returns the tenant identifier in UUID format.
 
             Return:
                 returns the tenant identifier in UUID format.
-                If action is failed method will throw vimconn.vimconnException method
+                If action is failed method will throw vimconn.VimConnException method
             """
         vdc_task = self.create_vdc(vdc_name=tenant_name)
         if vdc_task is not None:
             """
         vdc_task = self.create_vdc(vdc_name=tenant_name)
         if vdc_task is not None:
@@ -405,7 +405,7 @@ class vimconnector(vimconn.vimconnector):
             self.logger.info("Created new vdc {} and uuid: {}".format(tenant_name, vdc_uuid))
             return vdc_uuid
         else:
             self.logger.info("Created new vdc {} and uuid: {}".format(tenant_name, vdc_uuid))
             return vdc_uuid
         else:
-            raise vimconn.vimconnException("Failed create tenant {}".format(tenant_name))
+            raise vimconn.VimConnException("Failed create tenant {}".format(tenant_name))
 
     def delete_tenant(self, tenant_id=None):
         """ Delete a tenant from VIM
 
     def delete_tenant(self, tenant_id=None):
         """ Delete a tenant from VIM
@@ -418,7 +418,7 @@ class vimconnector(vimconn.vimconnector):
         """
         vca = self.connect_as_admin()
         if not vca:
         """
         vca = self.connect_as_admin()
         if not vca:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD")
 
         if tenant_id is not None:
             if vca._session:
 
         if tenant_id is not None:
             if vca._session:
@@ -436,7 +436,7 @@ class vimconnector(vimconn.vimconnector):
                     self.logger.debug("delete_tenant():GET REST API call {} failed. "
                                       "Return status code {}".format(orgvdc_herf,
                                                                      response.status_code))
                     self.logger.debug("delete_tenant():GET REST API call {} failed. "
                                       "Return status code {}".format(orgvdc_herf,
                                                                      response.status_code))
-                    raise vimconn.vimconnNotFoundException("Fail to get tenant {}".format(tenant_id))
+                    raise vimconn.VimConnNotFoundException("Fail to get tenant {}".format(tenant_id))
 
                 lxmlroot_respond = lxmlElementTree.fromstring(response.content)
                 namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
 
                 lxmlroot_respond = lxmlElementTree.fromstring(response.content)
                 namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
@@ -455,10 +455,10 @@ class vimconnector(vimconn.vimconnector):
                     self.logger.debug("delete_tenant(): DELETE REST API call {} failed. "
                                       "Return status code {}".format(vdc_remove_href,
                                                                      response.status_code))
                     self.logger.debug("delete_tenant(): DELETE REST API call {} failed. "
                                       "Return status code {}".format(vdc_remove_href,
                                                                      response.status_code))
-                    raise vimconn.vimconnException("Fail to delete tenant with ID {}".format(tenant_id))
+                    raise vimconn.VimConnException("Fail to delete tenant with ID {}".format(tenant_id))
         else:
             self.logger.debug("delete_tenant():Incorrect tenant ID  {}".format(tenant_id))
         else:
             self.logger.debug("delete_tenant():Incorrect tenant ID  {}".format(tenant_id))
-            raise vimconn.vimconnNotFoundException("Fail to get tenant {}".format(tenant_id))
+            raise vimconn.VimConnNotFoundException("Fail to get tenant {}".format(tenant_id))
 
     def get_tenant_list(self, filter_dict={}):
         """Obtain tenants of VIM
 
     def get_tenant_list(self, filter_dict={}):
         """Obtain tenants of VIM
@@ -490,7 +490,7 @@ class vimconnector(vimconn.vimconnector):
         except Exception:
             self.logger.debug("Error in get_tenant_list()")
             self.logger.debug(traceback.format_exc())
         except Exception:
             self.logger.debug("Error in get_tenant_list()")
             self.logger.debug(traceback.format_exc())
-            raise vimconn.vimconnException("Incorrect state. {}")
+            raise vimconn.VimConnException("Incorrect state. {}")
 
         return vdclist
 
 
         return vdclist
 
@@ -533,7 +533,7 @@ class vimconnector(vimconn.vimconnector):
 # ############# Stub code for SRIOV #################
 #         if net_type == "data" or net_type == "ptp":
 #             if self.config.get('dv_switch_name') == None:
 # ############# Stub code for SRIOV #################
 #         if net_type == "data" or net_type == "ptp":
 #             if self.config.get('dv_switch_name') == None:
-#                  raise vimconn.vimconnConflictException("You must provide 'dv_switch_name' at config value")
+#                  raise vimconn.VimConnConflictException("You must provide 'dv_switch_name' at config value")
 #             network_uuid = self.create_dvPort_group(net_name)
         parent_network_uuid = None
 
 #             network_uuid = self.create_dvPort_group(net_name)
         parent_network_uuid = None
 
@@ -548,7 +548,7 @@ class vimconnector(vimconn.vimconnector):
         if network_uuid is not None:
             return network_uuid, created_items
         else:
         if network_uuid is not None:
             return network_uuid, created_items
         else:
-            raise vimconn.vimconnUnexpectedResponse("Failed create a new network {}".format(net_name))
+            raise vimconn.VimConnUnexpectedResponse("Failed create a new network {}".format(net_name))
 
     def get_vcd_network_list(self):
         """ Method available organization for a logged in tenant
 
     def get_vcd_network_list(self):
         """ Method available organization for a logged in tenant
@@ -560,11 +560,11 @@ class vimconnector(vimconn.vimconnector):
         self.logger.debug("get_vcd_network_list(): retrieving network list for vcd {}".format(self.tenant_name))
 
         if not self.tenant_name:
         self.logger.debug("get_vcd_network_list(): retrieving network list for vcd {}".format(self.tenant_name))
 
         if not self.tenant_name:
-            raise vimconn.vimconnConnectionException("Tenant name is empty.")
+            raise vimconn.VimConnConnectionException("Tenant name is empty.")
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
-            raise vimconn.vimconnConnectionException("Can't retrieve information for a VDC {}".format(self.tenant_name))
+            raise vimconn.VimConnConnectionException("Can't retrieve information for a VDC {}".format(self.tenant_name))
 
         vdc_uuid = vdc.get('id').split(":")[3]
         if self.client._session:
 
         vdc_uuid = vdc.get('id').split(":")[3]
         if self.client._session:
@@ -575,7 +575,7 @@ class vimconnector(vimconn.vimconnector):
                                                 headers=headers)
         if response.status_code != 200:
             self.logger.error("Failed to get vdc content")
                                                 headers=headers)
         if response.status_code != 200:
             self.logger.error("Failed to get vdc content")
-            raise vimconn.vimconnNotFoundException("Failed to get vdc content")
+            raise vimconn.VimConnNotFoundException("Failed to get vdc content")
         else:
             content = XmlElementTree.fromstring(response.text)
 
         else:
             content = XmlElementTree.fromstring(response.text)
 
@@ -590,7 +590,7 @@ class vimconnector(vimconn.vimconnector):
 
                         if response.status_code != 200:
                             self.logger.error("Failed to get network content")
 
                         if response.status_code != 200:
                             self.logger.error("Failed to get network content")
-                            raise vimconn.vimconnNotFoundException("Failed to get network content")
+                            raise vimconn.VimConnNotFoundException("Failed to get network content")
                         else:
                             net_details = XmlElementTree.fromstring(response.text)
 
                         else:
                             net_details = XmlElementTree.fromstring(response.text)
 
@@ -648,11 +648,11 @@ class vimconnector(vimconn.vimconnector):
         self.logger.debug("get_network_list(): retrieving network list for vcd {}".format(self.tenant_name))
 
         if not self.tenant_name:
         self.logger.debug("get_network_list(): retrieving network list for vcd {}".format(self.tenant_name))
 
         if not self.tenant_name:
-            raise vimconn.vimconnConnectionException("Tenant name is empty.")
+            raise vimconn.VimConnConnectionException("Tenant name is empty.")
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
-            raise vimconn.vimconnConnectionException(
+            raise vimconn.VimConnConnectionException(
                 "Can't retrieve information for a VDC {}.".format(self.tenant_name))
 
         try:
                 "Can't retrieve information for a VDC {}.".format(self.tenant_name))
 
         try:
@@ -666,7 +666,7 @@ class vimconnector(vimconn.vimconnector):
                                                 headers=headers)
             if response.status_code != 200:
                 self.logger.error("Failed to get vdc content")
                                                 headers=headers)
             if response.status_code != 200:
                 self.logger.error("Failed to get vdc content")
-                raise vimconn.vimconnNotFoundException("Failed to get vdc content")
+                raise vimconn.VimConnNotFoundException("Failed to get vdc content")
             else:
                 content = XmlElementTree.fromstring(response.text)
 
             else:
                 content = XmlElementTree.fromstring(response.text)
 
@@ -680,7 +680,7 @@ class vimconnector(vimconn.vimconnector):
 
                         if response.status_code != 200:
                             self.logger.error("Failed to get network content")
 
                         if response.status_code != 200:
                             self.logger.error("Failed to get network content")
-                            raise vimconn.vimconnNotFoundException("Failed to get network content")
+                            raise vimconn.VimConnNotFoundException("Failed to get network content")
                         else:
                             net_details = XmlElementTree.fromstring(response.text)
 
                         else:
                             net_details = XmlElementTree.fromstring(response.text)
 
@@ -723,10 +723,10 @@ class vimconnector(vimconn.vimconnector):
                                     network_list.append(filtered_entry)
         except Exception as e:
             self.logger.debug("Error in get_network_list", exc_info=True)
                                     network_list.append(filtered_entry)
         except Exception as e:
             self.logger.debug("Error in get_network_list", exc_info=True)
-            if isinstance(e, vimconn.vimconnException):
+            if isinstance(e, vimconn.VimConnException):
                 raise
             else:
                 raise
             else:
-                raise vimconn.vimconnNotFoundException("Failed : Networks list not found {} ".format(e))
+                raise vimconn.VimConnNotFoundException("Failed : Networks list not found {} ".format(e))
 
         self.logger.debug("Returning {}".format(network_list))
         return network_list
 
         self.logger.debug("Returning {}".format(network_list))
         return network_list
@@ -746,7 +746,7 @@ class vimconnector(vimconn.vimconnector):
                                                 headers=headers)
             if response.status_code != 200:
                 self.logger.error("Failed to get vdc content")
                                                 headers=headers)
             if response.status_code != 200:
                 self.logger.error("Failed to get vdc content")
-                raise vimconn.vimconnNotFoundException("Failed to get vdc content")
+                raise vimconn.VimConnNotFoundException("Failed to get vdc content")
             else:
                 content = XmlElementTree.fromstring(response.text)
 
             else:
                 content = XmlElementTree.fromstring(response.text)
 
@@ -761,7 +761,7 @@ class vimconnector(vimconn.vimconnector):
 
                         if response.status_code != 200:
                             self.logger.error("Failed to get network content")
 
                         if response.status_code != 200:
                             self.logger.error("Failed to get network content")
-                            raise vimconn.vimconnNotFoundException("Failed to get network content")
+                            raise vimconn.VimConnNotFoundException("Failed to get network content")
                         else:
                             net_details = XmlElementTree.fromstring(response.text)
 
                         else:
                             net_details = XmlElementTree.fromstring(response.text)
 
@@ -784,14 +784,14 @@ class vimconnector(vimconn.vimconnector):
                                 self.logger.debug("Returning {}".format(filter_dict))
                                 return filter_dict
                     else:
                                 self.logger.debug("Returning {}".format(filter_dict))
                                 return filter_dict
                     else:
-                        raise vimconn.vimconnNotFoundException("Network {} not found".format(net_id))
+                        raise vimconn.VimConnNotFoundException("Network {} not found".format(net_id))
         except Exception as e:
             self.logger.debug("Error in get_network")
             self.logger.debug(traceback.format_exc())
         except Exception as e:
             self.logger.debug("Error in get_network")
             self.logger.debug(traceback.format_exc())
-            if isinstance(e, vimconn.vimconnException):
+            if isinstance(e, vimconn.VimConnException):
                 raise
             else:
                 raise
             else:
-                raise vimconn.vimconnNotFoundException("Failed : Network not found {} ".format(e))
+                raise vimconn.VimConnNotFoundException("Failed : Network not found {} ".format(e))
 
         return filter_dict
 
 
         return filter_dict
 
@@ -820,7 +820,7 @@ class vimconnector(vimconn.vimconnector):
             if self.delete_network_action(network_uuid=net_id):
                 return net_id
         else:
             if self.delete_network_action(network_uuid=net_id):
                 return net_id
         else:
-            raise vimconn.vimconnNotFoundException("Network {} not found".format(net_id))
+            raise vimconn.VimConnNotFoundException("Network {} not found".format(net_id))
 
     def refresh_nets_status(self, net_list):
         """Get the status of the networks
 
     def refresh_nets_status(self, net_list):
         """Get the status of the networks
@@ -867,7 +867,7 @@ class vimconnector(vimconn.vimconnector):
             Returns the flavor dict details {'id':<>, 'name':<>, other vim specific } #TODO to concrete
         """
         if flavor_id not in vimconnector.flavorlist:
             Returns the flavor dict details {'id':<>, 'name':<>, other vim specific } #TODO to concrete
         """
         if flavor_id not in vimconnector.flavorlist:
-            raise vimconn.vimconnNotFoundException("Flavor not found.")
+            raise vimconn.VimConnNotFoundException("Flavor not found.")
         return vimconnector.flavorlist[flavor_id]
 
     def new_flavor(self, flavor_data):
         return vimconnector.flavorlist[flavor_id]
 
     def new_flavor(self, flavor_data):
@@ -899,11 +899,11 @@ class vimconnector(vimconn.vimconnector):
         disk = flavor_data.get(FLAVOR_DISK_KEY, 0)
 
         if not isinstance(ram, int):
         disk = flavor_data.get(FLAVOR_DISK_KEY, 0)
 
         if not isinstance(ram, int):
-            raise vimconn.vimconnException("Non-integer value for ram")
+            raise vimconn.VimConnException("Non-integer value for ram")
         elif not isinstance(cpu, int):
         elif not isinstance(cpu, int):
-            raise vimconn.vimconnException("Non-integer value for cpu")
+            raise vimconn.VimConnException("Non-integer value for cpu")
         elif not isinstance(disk, int):
         elif not isinstance(disk, int):
-            raise vimconn.vimconnException("Non-integer value for disk")
+            raise vimconn.VimConnException("Non-integer value for disk")
 
         extended_flv = flavor_data.get("extended")
         if extended_flv:
 
         extended_flv = flavor_data.get("extended")
         if extended_flv:
@@ -936,7 +936,7 @@ class vimconnector(vimconn.vimconnector):
            Returns the used id or raise an exception
         """
         if flavor_id not in vimconnector.flavorlist:
            Returns the used id or raise an exception
         """
         if flavor_id not in vimconnector.flavorlist:
-            raise vimconn.vimconnNotFoundException("Flavor not found.")
+            raise vimconn.VimConnNotFoundException("Flavor not found.")
 
         vimconnector.flavorlist.pop(flavor_id, None)
         return flavor_id
 
         vimconnector.flavorlist.pop(flavor_id, None)
         return flavor_id
@@ -961,7 +961,7 @@ class vimconnector(vimconn.vimconnector):
         """
         conn = self.connect_as_admin()
         if not conn:
         """
         conn = self.connect_as_admin()
         if not conn:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD")
         # Get Catalog details
         url_list = [self.url, '/api/catalog/', image_id]
         catalog_herf = ''.join(url_list)
         # Get Catalog details
         url_list = [self.url, '/api/catalog/', image_id]
         catalog_herf = ''.join(url_list)
@@ -977,7 +977,7 @@ class vimconnector(vimconn.vimconnector):
             self.logger.debug("delete_image():GET REST API call {} failed. "
                               "Return status code {}".format(catalog_herf,
                                                              response.status_code))
             self.logger.debug("delete_image():GET REST API call {} failed. "
                               "Return status code {}".format(catalog_herf,
                                                              response.status_code))
-            raise vimconn.vimconnNotFoundException("Fail to get image {}".format(image_id))
+            raise vimconn.VimConnNotFoundException("Fail to get image {}".format(image_id))
 
         lxmlroot_respond = lxmlElementTree.fromstring(response.content)
         namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
 
         lxmlroot_respond = lxmlElementTree.fromstring(response.content)
         namespaces = {prefix: uri for prefix, uri in lxmlroot_respond.nsmap.items() if prefix}
@@ -996,7 +996,7 @@ class vimconnector(vimconn.vimconnector):
                 self.logger.debug("delete_image():GET REST API call {} failed. "
                                   "Return status code {}".format(catalog_herf,
                                                                  response.status_code))
                 self.logger.debug("delete_image():GET REST API call {} failed. "
                                   "Return status code {}".format(catalog_herf,
                                                                  response.status_code))
-                raise vimconn.vimconnNotFoundException("Fail to get catalogItem {} for catalog {}".format(
+                raise vimconn.VimConnNotFoundException("Fail to get catalogItem {} for catalog {}".format(
                     catalogItem,
                     image_id))
 
                     catalogItem,
                     image_id))
 
@@ -1012,7 +1012,7 @@ class vimconnector(vimconn.vimconnector):
             if response.status_code == requests.codes.no_content:
                 self.logger.debug("Deleted Catalog item {}".format(catalogItem))
             else:
             if response.status_code == requests.codes.no_content:
                 self.logger.debug("Deleted Catalog item {}".format(catalogItem))
             else:
-                raise vimconn.vimconnException("Fail to delete Catalog Item {}".format(catalogItem))
+                raise vimconn.VimConnException("Fail to delete Catalog Item {}".format(catalogItem))
 
         # Remove catalog
         url_list = [self.url, '/api/admin/catalog/', image_id]
 
         # Remove catalog
         url_list = [self.url, '/api/admin/catalog/', image_id]
@@ -1025,7 +1025,7 @@ class vimconnector(vimconn.vimconnector):
             self.logger.debug("Deleted Catalog {}".format(image_id))
             return image_id
         else:
             self.logger.debug("Deleted Catalog {}".format(image_id))
             return image_id
         else:
-            raise vimconn.vimconnException("Fail to delete Catalog {}".format(image_id))
+            raise vimconn.VimConnException("Fail to delete Catalog {}".format(image_id))
 
     def catalog_exists(self, catalog_name, catalogs):
         """
 
     def catalog_exists(self, catalog_name, catalogs):
         """
@@ -1202,7 +1202,7 @@ class vimconnector(vimconn.vimconnector):
         except Exception as exp:
             self.logger.debug("Failed while uploading OVF to catalog {} for OVF file {} with Exception {}"
                               .format(catalog_name, media_file_name, exp))
         except Exception as exp:
             self.logger.debug("Failed while uploading OVF to catalog {} for OVF file {} with Exception {}"
                               .format(catalog_name, media_file_name, exp))
-            raise vimconn.vimconnException(
+            raise vimconn.VimConnException(
                 "Failed while uploading OVF to catalog {} for OVF file {} with Exception {}"
                 .format(catalog_name, media_file_name, exp))
 
                 "Failed while uploading OVF to catalog {} for OVF file {} with Exception {}"
                 .format(catalog_name, media_file_name, exp))
 
@@ -1303,13 +1303,13 @@ class vimconnector(vimconn.vimconnector):
         """
 
         if not path:
         """
 
         if not path:
-            raise vimconn.vimconnException("Image path can't be None.")
+            raise vimconn.VimConnException("Image path can't be None.")
 
         if not os.path.isfile(path):
 
         if not os.path.isfile(path):
-            raise vimconn.vimconnException("Can't read file. File not found.")
+            raise vimconn.VimConnException("Can't read file. File not found.")
 
         if not os.access(path, os.R_OK):
 
         if not os.access(path, os.R_OK):
-            raise vimconn.vimconnException("Can't read file. Check file permission to read.")
+            raise vimconn.VimConnException("Can't read file. Check file permission to read.")
 
         self.logger.debug("get_image_id_from_path() client requesting {} ".format(path))
 
 
         self.logger.debug("get_image_id_from_path() client requesting {} ".format(path))
 
@@ -1317,7 +1317,7 @@ class vimconnector(vimconn.vimconnector):
         _, file_extension = os.path.splitext(path)
         if file_extension != '.ovf':
             self.logger.debug("Wrong file extension {} connector support only OVF container.".format(file_extension))
         _, file_extension = os.path.splitext(path)
         if file_extension != '.ovf':
             self.logger.debug("Wrong file extension {} connector support only OVF container.".format(file_extension))
-            raise vimconn.vimconnException("Wrong container.  vCloud director supports only OVF.")
+            raise vimconn.VimConnException("Wrong container.  vCloud director supports only OVF.")
 
         catalog_name = os.path.splitext(filename)[0]
         catalog_md5_name = hashlib.md5(path.encode('utf-8')).hexdigest()
 
         catalog_name = os.path.splitext(filename)[0]
         catalog_md5_name = hashlib.md5(path.encode('utf-8')).hexdigest()
@@ -1329,17 +1329,17 @@ class vimconnector(vimconn.vimconnector):
             catalogs = org.list_catalogs()
         except Exception as exp:
             self.logger.debug("Failed get catalogs() with Exception {} ".format(exp))
             catalogs = org.list_catalogs()
         except Exception as exp:
             self.logger.debug("Failed get catalogs() with Exception {} ".format(exp))
-            raise vimconn.vimconnException("Failed get catalogs() with Exception {} ".format(exp))
+            raise vimconn.VimConnException("Failed get catalogs() with Exception {} ".format(exp))
 
         if len(catalogs) == 0:
             self.logger.info("Creating a new catalog entry {} in vcloud director".format(catalog_name))
             if self.create_vimcatalog(org, catalog_md5_name) is None:
 
         if len(catalogs) == 0:
             self.logger.info("Creating a new catalog entry {} in vcloud director".format(catalog_name))
             if self.create_vimcatalog(org, catalog_md5_name) is None:
-                raise vimconn.vimconnException("Failed create new catalog {} ".format(catalog_md5_name))
+                raise vimconn.VimConnException("Failed create new catalog {} ".format(catalog_md5_name))
 
             result = self.upload_vimimage(vca=org, catalog_name=catalog_md5_name,
                                           media_name=filename, medial_file_name=path, progress=progress)
             if not result:
 
             result = self.upload_vimimage(vca=org, catalog_name=catalog_md5_name,
                                           media_name=filename, medial_file_name=path, progress=progress)
             if not result:
-                raise vimconn.vimconnException("Failed create vApp template for catalog {} ".format(catalog_name))
+                raise vimconn.VimConnException("Failed create vApp template for catalog {} ".format(catalog_name))
             return self.get_catalogid(catalog_name, catalogs)
         else:
             for catalog in catalogs:
             return self.get_catalogid(catalog_name, catalogs)
         else:
             for catalog in catalogs:
@@ -1354,12 +1354,12 @@ class vimconnector(vimconn.vimconnector):
         # if we didn't find existing catalog we create a new one and upload image.
         self.logger.debug("Creating new catalog entry {} - {}".format(catalog_name, catalog_md5_name))
         if self.create_vimcatalog(org, catalog_md5_name) is None:
         # if we didn't find existing catalog we create a new one and upload image.
         self.logger.debug("Creating new catalog entry {} - {}".format(catalog_name, catalog_md5_name))
         if self.create_vimcatalog(org, catalog_md5_name) is None:
-            raise vimconn.vimconnException("Failed create new catalog {} ".format(catalog_md5_name))
+            raise vimconn.VimConnException("Failed create new catalog {} ".format(catalog_md5_name))
 
         result = self.upload_vimimage(vca=org, catalog_name=catalog_md5_name,
                                       media_name=filename, medial_file_name=path, progress=progress)
         if not result:
 
         result = self.upload_vimimage(vca=org, catalog_name=catalog_md5_name,
                                       media_name=filename, medial_file_name=path, progress=progress)
         if not result:
-            raise vimconn.vimconnException("Failed create vApp template for catalog {} ".format(catalog_md5_name))
+            raise vimconn.VimConnException("Failed create vApp template for catalog {} ".format(catalog_md5_name))
 
         return self.get_catalogid(catalog_md5_name, org.list_catalogs())
 
 
         return self.get_catalogid(catalog_md5_name, org.list_catalogs())
 
@@ -1397,7 +1397,7 @@ class vimconnector(vimconn.vimconnector):
                 self.logger.debug("List of already created catalog items: {}".format(image_list))
                 return image_list
         except Exception as exp:
                 self.logger.debug("List of already created catalog items: {}".format(image_list))
                 return image_list
         except Exception as exp:
-            raise vimconn.vimconnException("Exception occured while retriving catalog items {}".format(exp))
+            raise vimconn.VimConnException("Exception occured while retriving catalog items {}".format(exp))
 
     def get_vappid(self, vdc=None, vapp_name=None):
         """ Method takes vdc object and vApp name and returns vapp uuid or None
 
     def get_vappid(self, vdc=None, vapp_name=None):
         """ Method takes vdc object and vApp name and returns vapp uuid or None
@@ -1545,18 +1545,18 @@ class vimconnector(vimconn.vimconnector):
 
         for net in net_list:
             if net['type'] == "PCI-PASSTHROUGH":
 
         for net in net_list:
             if net['type'] == "PCI-PASSTHROUGH":
-                raise vimconn.vimconnNotSupportedException(
+                raise vimconn.VimConnNotSupportedException(
                     "Current vCD version does not support type : {}".format(net['type']))
 
         if len(net_list) > 10:
                     "Current vCD version does not support type : {}".format(net['type']))
 
         if len(net_list) > 10:
-            raise vimconn.vimconnNotSupportedException(
+            raise vimconn.VimConnNotSupportedException(
                 "The VM hardware versions 7 and above support upto 10 NICs only")
 
         # if vm already deployed we return existing uuid
         # we check for presence of VDC, Catalog entry and Flavor.
         org, vdc = self.get_vdc_details()
         if vdc is None:
                 "The VM hardware versions 7 and above support upto 10 NICs only")
 
         # if vm already deployed we return existing uuid
         # we check for presence of VDC, Catalog entry and Flavor.
         org, vdc = self.get_vdc_details()
         if vdc is None:
-            raise vimconn.vimconnNotFoundException(
+            raise vimconn.VimConnNotFoundException(
                 "new_vminstance(): Failed create vApp {}: (Failed retrieve VDC information)".format(name))
         catalogs = org.list_catalogs()
         if catalogs is None:
                 "new_vminstance(): Failed create vApp {}: (Failed retrieve VDC information)".format(name))
         catalogs = org.list_catalogs()
         if catalogs is None:
@@ -1565,14 +1565,14 @@ class vimconnector(vimconn.vimconnector):
             org = Org(self.client, resource=self.client.get_org())
             catalogs = org.list_catalogs()
         if catalogs is None:
             org = Org(self.client, resource=self.client.get_org())
             catalogs = org.list_catalogs()
         if catalogs is None:
-            raise vimconn.vimconnNotFoundException(
+            raise vimconn.VimConnNotFoundException(
                 "new_vminstance(): Failed create vApp {}: (Failed retrieve catalogs list)".format(name))
 
         catalog_hash_name = self.get_catalogbyid(catalog_uuid=image_id, catalogs=catalogs)
         if catalog_hash_name:
             self.logger.info("Found catalog entry {} for image id {}".format(catalog_hash_name, image_id))
         else:
                 "new_vminstance(): Failed create vApp {}: (Failed retrieve catalogs list)".format(name))
 
         catalog_hash_name = self.get_catalogbyid(catalog_uuid=image_id, catalogs=catalogs)
         if catalog_hash_name:
             self.logger.info("Found catalog entry {} for image id {}".format(catalog_hash_name, image_id))
         else:
-            raise vimconn.vimconnNotFoundException("new_vminstance(): Failed create vApp {}: "
+            raise vimconn.VimConnNotFoundException("new_vminstance(): Failed create vApp {}: "
                                                    "(Failed retrieve catalog information {})".format(name, image_id))
 
         # Set vCPU and Memory based on flavor.
                                                    "(Failed retrieve catalog information {})".format(name, image_id))
 
         # Set vCPU and Memory based on flavor.
@@ -1583,7 +1583,7 @@ class vimconnector(vimconn.vimconnector):
 
         if flavor_id is not None:
             if flavor_id not in vimconnector.flavorlist:
 
         if flavor_id is not None:
             if flavor_id not in vimconnector.flavorlist:
-                raise vimconn.vimconnNotFoundException("new_vminstance(): Failed create vApp {}: "
+                raise vimconn.VimConnNotFoundException("new_vminstance(): Failed create vApp {}: "
                                                        "Failed retrieve flavor information "
                                                        "flavor id {}".format(name, flavor_id))
             else:
                                                        "Failed retrieve flavor information "
                                                        "flavor id {}".format(name, flavor_id))
             else:
@@ -1597,7 +1597,7 @@ class vimconnector(vimconn.vimconnector):
                         numas = extended.get("numas", None)
 
                 except Exception as exp:
                         numas = extended.get("numas", None)
 
                 except Exception as exp:
-                    raise vimconn.vimconnException("Corrupted flavor. {}.Exception: {}".format(flavor_id, exp))
+                    raise vimconn.VimConnException("Corrupted flavor. {}.Exception: {}".format(flavor_id, exp))
 
         # image upload creates template name as catalog name space Template.
         templateName = self.get_catalogbyid(catalog_uuid=image_id, catalogs=catalogs)
 
         # image upload creates template name as catalog name space Template.
         templateName = self.get_catalogbyid(catalog_uuid=image_id, catalogs=catalogs)
@@ -1628,16 +1628,16 @@ class vimconnector(vimconn.vimconnector):
                     primary_netname = network_dict['name']
 
             except KeyError:
                     primary_netname = network_dict['name']
 
             except KeyError:
-                raise vimconn.vimconnException("Corrupted flavor. {}".format(primary_net))
+                raise vimconn.VimConnException("Corrupted flavor. {}".format(primary_net))
         else:
         else:
-            raise vimconn.vimconnUnexpectedResponse("new_vminstance(): Failed network list is empty.".format(name))
+            raise vimconn.VimConnUnexpectedResponse("new_vminstance(): Failed network list is empty.".format(name))
 
         # use: 'data', 'bridge', 'mgmt'
         # create vApp.  Set vcpu and ram based on flavor id.
         try:
             vdc_obj = VDC(self.client, resource=org.get_vdc(self.tenant_name))
             if not vdc_obj:
 
         # use: 'data', 'bridge', 'mgmt'
         # create vApp.  Set vcpu and ram based on flavor id.
         try:
             vdc_obj = VDC(self.client, resource=org.get_vdc(self.tenant_name))
             if not vdc_obj:
-                raise vimconn.vimconnNotFoundException("new_vminstance(): Failed to get VDC object")
+                raise vimconn.VimConnNotFoundException("new_vminstance(): Failed to get VDC object")
 
             for retry in (1, 2):
                 items = org.get_catalog_item(catalog_hash_name, catalog_hash_name)
 
             for retry in (1, 2):
                 items = org.get_catalog_item(catalog_hash_name, catalog_hash_name)
@@ -1706,7 +1706,7 @@ class vimconnector(vimconn.vimconnector):
                                       "status code : {}".format(instantiate_vapp_href,
                                                                 response.text,
                                                                 response.status_code))
                                       "status code : {}".format(instantiate_vapp_href,
                                                                 response.text,
                                                                 response.status_code))
-                    raise vimconn.vimconnException("new_vminstance(): Failed to create"
+                    raise vimconn.VimConnException("new_vminstance(): Failed to create"
                                                    "vAapp {}".format(vmname_andid))
                 else:
                     vapptask = self.get_task_from_response(response.text)
                                                    "vAapp {}".format(vmname_andid))
                 else:
                     vapptask = self.get_task_from_response(response.text)
@@ -1718,7 +1718,7 @@ class vimconnector(vimconn.vimconnector):
                     break
 
             if vapptask is None or vapptask is False:
                     break
 
             if vapptask is None or vapptask is False:
-                raise vimconn.vimconnUnexpectedResponse(
+                raise vimconn.VimConnUnexpectedResponse(
                     "new_vminstance(): failed to create vApp {}".format(vmname_andid))
 
             # wait for task to complete
                     "new_vminstance(): failed to create vApp {}".format(vmname_andid))
 
             # wait for task to complete
@@ -1727,11 +1727,11 @@ class vimconnector(vimconn.vimconnector):
             if result.get('status') == 'success':
                 self.logger.debug("new_vminstance(): Sucessfully created Vapp {}".format(vmname_andid))
             else:
             if result.get('status') == 'success':
                 self.logger.debug("new_vminstance(): Sucessfully created Vapp {}".format(vmname_andid))
             else:
-                raise vimconn.vimconnUnexpectedResponse(
+                raise vimconn.VimConnUnexpectedResponse(
                     "new_vminstance(): failed to create vApp {}".format(vmname_andid))
 
         except Exception as exp:
                     "new_vminstance(): failed to create vApp {}".format(vmname_andid))
 
         except Exception as exp:
-            raise vimconn.vimconnUnexpectedResponse(
+            raise vimconn.VimConnUnexpectedResponse(
                 "new_vminstance(): failed to create vApp {} with Exception:{}".format(vmname_andid, exp))
 
         # we should have now vapp in undeployed state.
                 "new_vminstance(): failed to create vApp {} with Exception:{}".format(vmname_andid, exp))
 
         # we should have now vapp in undeployed state.
@@ -1742,12 +1742,12 @@ class vimconnector(vimconn.vimconnector):
             vapp = VApp(self.client, resource=vapp_resource)
 
         except Exception as exp:
             vapp = VApp(self.client, resource=vapp_resource)
 
         except Exception as exp:
-            raise vimconn.vimconnUnexpectedResponse(
+            raise vimconn.VimConnUnexpectedResponse(
                 "new_vminstance(): Failed to retrieve vApp {} after creation: Exception:{}"
                 .format(vmname_andid, exp))
 
         if vapp_uuid is None:
                 "new_vminstance(): Failed to retrieve vApp {} after creation: Exception:{}"
                 .format(vmname_andid, exp))
 
         if vapp_uuid is None:
-            raise vimconn.vimconnUnexpectedResponse(
+            raise vimconn.VimConnUnexpectedResponse(
                 "new_vminstance(): Failed to retrieve vApp {} after creation".format(vmname_andid))
 
         # Add PCI passthrough/SRIOV configrations
                 "new_vminstance(): Failed to retrieve vApp {} after creation".format(vmname_andid))
 
         # Add PCI passthrough/SRIOV configrations
@@ -1949,7 +1949,7 @@ class vimconnector(vimconn.vimconnector):
             # it might be a case if specific mandatory entry in dict is empty or some other pyVcloud exception
             self.logger.error("new_vminstance(): Failed create new vm instance {} with exception {}"
                               .format(name, exp))
             # it might be a case if specific mandatory entry in dict is empty or some other pyVcloud exception
             self.logger.error("new_vminstance(): Failed create new vm instance {} with exception {}"
                               .format(name, exp))
-            raise vimconn.vimconnException("new_vminstance(): Failed create new vm instance {} with exception {}"
+            raise vimconn.VimConnException("new_vminstance(): Failed create new vm instance {} with exception {}"
                                            .format(name, exp))
         # check if vApp deployed and if that the case return vApp UUID otherwise -1
         wait_time = 0
                                            .format(name, exp))
         # check if vApp deployed and if that the case return vApp UUID otherwise -1
         wait_time = 0
@@ -1959,7 +1959,7 @@ class vimconnector(vimconn.vimconnector):
                 vapp_resource = vdc_obj.get_vapp(vmname_andid)
                 vapp = VApp(self.client, resource=vapp_resource)
             except Exception as exp:
                 vapp_resource = vdc_obj.get_vapp(vmname_andid)
                 vapp = VApp(self.client, resource=vapp_resource)
             except Exception as exp:
-                raise vimconn.vimconnUnexpectedResponse(
+                raise vimconn.VimConnUnexpectedResponse(
                     "new_vminstance(): Failed to retrieve vApp {} after creation: Exception:{}"
                     .format(vmname_andid, exp))
 
                     "new_vminstance(): Failed to retrieve vApp {} after creation: Exception:{}"
                     .format(vmname_andid, exp))
 
@@ -1986,7 +1986,7 @@ class vimconnector(vimconn.vimconnector):
             # Admin access required for creating Affinity rules
             client = self.connect_as_admin()
             if not client:
             # Admin access required for creating Affinity rules
             client = self.connect_as_admin()
             if not client:
-                raise vimconn.vimconnConnectionException("Failed to connect vCD as admin")
+                raise vimconn.VimConnConnectionException("Failed to connect vCD as admin")
             else:
                 self.client = client
             if self.client:
             else:
                 self.client = client
             if self.client:
@@ -2061,7 +2061,7 @@ class vimconnector(vimconn.vimconnector):
         if vapp_uuid is not None:
             return vapp_uuid, None
         else:
         if vapp_uuid is not None:
             return vapp_uuid, None
         else:
-            raise vimconn.vimconnUnexpectedResponse("new_vminstance(): Failed create new vm instance {}".format(name))
+            raise vimconn.VimConnUnexpectedResponse("new_vminstance(): Failed create new vm instance {}".format(name))
 
     def create_config_drive_iso(self, user_data):
         tmpdir = tempfile.mkdtemp()
 
     def create_config_drive_iso(self, user_data):
         tmpdir = tempfile.mkdtemp()
@@ -2228,7 +2228,7 @@ class vimconnector(vimconn.vimconnector):
             else:
                 return availability_zone_list[availability_zone_index]
         else:
             else:
                 return availability_zone_list[availability_zone_index]
         else:
-            raise vimconn.vimconnConflictException("No enough availability zones at VIM for this deployment")
+            raise vimconn.VimConnConflictException("No enough availability zones at VIM for this deployment")
 
     def create_vm_to_host_affinity_rule(self, addrule_href, vmgrpname, hostgrpname, polarity, headers):
         """ Method to create VM to Host Affinity rule in vCD
 
     def create_vm_to_host_affinity_rule(self, addrule_href, vmgrpname, hostgrpname, polarity, headers):
         """ Method to create VM to Host Affinity rule in vCD
@@ -2270,14 +2270,14 @@ class vimconnector(vimconn.vimconnector):
             affinity_task = self.get_task_from_response(resp.content)
             self.logger.debug("affinity_task: {}".format(affinity_task))
             if affinity_task is None or affinity_task is False:
             affinity_task = self.get_task_from_response(resp.content)
             self.logger.debug("affinity_task: {}".format(affinity_task))
             if affinity_task is None or affinity_task is False:
-                raise vimconn.vimconnUnexpectedResponse("failed to find affinity task")
+                raise vimconn.VimConnUnexpectedResponse("failed to find affinity task")
             # wait for task to complete
             result = self.client.get_task_monitor().wait_for_success(task=affinity_task)
             if result.get('status') == 'success':
                 self.logger.debug("Successfully created affinity rule {}".format(rule_name))
                 return True
             else:
             # wait for task to complete
             result = self.client.get_task_monitor().wait_for_success(task=affinity_task)
             if result.get('status') == 'success':
                 self.logger.debug("Successfully created affinity rule {}".format(rule_name))
                 return True
             else:
-                raise vimconn.vimconnUnexpectedResponse(
+                raise vimconn.VimConnUnexpectedResponse(
                     "failed to create affinity rule {}".format(rule_name))
 
     def get_add_rule_reference(self, respool_href, headers):
                     "failed to create affinity rule {}".format(rule_name))
 
     def get_add_rule_reference(self, respool_href, headers):
@@ -2404,7 +2404,7 @@ class vimconnector(vimconn.vimconnector):
         else:
             vmgroup_task = self.get_task_from_response(resp.content)
             if vmgroup_task is None or vmgroup_task is False:
         else:
             vmgroup_task = self.get_task_from_response(resp.content)
             if vmgroup_task is None or vmgroup_task is False:
-                raise vimconn.vimconnUnexpectedResponse(
+                raise vimconn.VimConnUnexpectedResponse(
                     "create_vmgroup(): failed to create VM group {}".format(vmgroup_name))
 
             # wait for task to complete
                     "create_vmgroup(): failed to create VM group {}".format(vmgroup_name))
 
             # wait for task to complete
@@ -2416,7 +2416,7 @@ class vimconnector(vimconn.vimconnector):
                 vmgroup_status = True
                 return vmgroup_status
             else:
                 vmgroup_status = True
                 return vmgroup_status
             else:
-                raise vimconn.vimconnUnexpectedResponse(
+                raise vimconn.VimConnUnexpectedResponse(
                     "create_vmgroup(): failed to create VM group {}".format(vmgroup_name))
 
     def find_vmgroup_reference(self, url, headers):
                     "create_vmgroup(): failed to create VM group {}".format(vmgroup_name))
 
     def find_vmgroup_reference(self, url, headers):
@@ -2519,7 +2519,7 @@ class vimconnector(vimconn.vimconnector):
                     # Get vdcReferences to find org
                     pvdc_resp = self.perform_request(req_type='GET', url=pvdc_href, headers=headers)
                     if pvdc_resp.status_code != requests.codes.ok:
                     # Get vdcReferences to find org
                     pvdc_resp = self.perform_request(req_type='GET', url=pvdc_href, headers=headers)
                     if pvdc_resp.status_code != requests.codes.ok:
-                        raise vimconn.vimconnException("REST API call {} failed. "
+                        raise vimconn.VimConnException("REST API call {} failed. "
                                                        "Return status code {}"
                                                        .format(url, pvdc_resp.status_code))
 
                                                        "Return status code {}"
                                                        .format(url, pvdc_resp.status_code))
 
@@ -2534,7 +2534,7 @@ class vimconnector(vimconn.vimconnector):
                                                                 url=vdc_href,
                                                                 headers=headers)
                                 if vdc_resp.status_code != requests.codes.ok:
                                                                 url=vdc_href,
                                                                 headers=headers)
                                 if vdc_resp.status_code != requests.codes.ok:
-                                    raise vimconn.vimconnException("REST API call {} failed. "
+                                    raise vimconn.VimConnException("REST API call {} failed. "
                                                                    "Return status code {}"
                                                                    .format(url, vdc_resp.status_code))
                                 vdc_resp_xml = XmlElementTree.fromstring(vdc_resp.content)
                                                                    "Return status code {}"
                                                                    .format(url, vdc_resp.status_code))
                                 vdc_resp_xml = XmlElementTree.fromstring(vdc_resp.content)
@@ -2581,7 +2581,7 @@ class vimconnector(vimconn.vimconnector):
         # get token to connect vCD as a normal user
         self.get_token()
         self.logger.debug(msg)
         # get token to connect vCD as a normal user
         self.get_token()
         self.logger.debug(msg)
-        raise vimconn.vimconnException(msg)
+        raise vimconn.VimConnException(msg)
 
     # #
     # #
 
     # #
     # #
@@ -2605,13 +2605,13 @@ class vimconnector(vimconn.vimconnector):
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
-            raise vimconn.vimconnConnectionException(
+            raise vimconn.VimConnConnectionException(
                 "Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
 
         vm_info_dict = self.get_vapp_details_rest(vapp_uuid=vim_vm_uuid)
         if not vm_info_dict:
             self.logger.debug("get_vminstance(): Failed to get vApp name by UUID {}".format(vim_vm_uuid))
                 "Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
 
         vm_info_dict = self.get_vapp_details_rest(vapp_uuid=vim_vm_uuid)
         if not vm_info_dict:
             self.logger.debug("get_vminstance(): Failed to get vApp name by UUID {}".format(vim_vm_uuid))
-            raise vimconn.vimconnNotFoundException("Failed to get vApp name by UUID {}".format(vim_vm_uuid))
+            raise vimconn.VimConnNotFoundException("Failed to get vApp name by UUID {}".format(vim_vm_uuid))
 
         status_key = vm_info_dict['status']
         error = ''
 
         status_key = vm_info_dict['status']
         error = ''
@@ -2654,7 +2654,7 @@ class vimconnector(vimconn.vimconnector):
         if vdc_obj is None:
             self.logger.debug("delete_vminstance(): Failed to get a reference of VDC for a tenant {}".format(
                 self.tenant_name))
         if vdc_obj is None:
             self.logger.debug("delete_vminstance(): Failed to get a reference of VDC for a tenant {}".format(
                 self.tenant_name))
-            raise vimconn.vimconnException(
+            raise vimconn.VimConnException(
                 "delete_vminstance(): Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
 
         try:
                 "delete_vminstance(): Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
 
         try:
@@ -2760,7 +2760,7 @@ class vimconnector(vimconn.vimconnector):
                         return vm__vim_uuid
         except Exception:
             self.logger.debug(traceback.format_exc())
                         return vm__vim_uuid
         except Exception:
             self.logger.debug(traceback.format_exc())
-            raise vimconn.vimconnException("delete_vminstance(): Failed delete vm instance {}".format(vm__vim_uuid))
+            raise vimconn.VimConnException("delete_vminstance(): Failed delete vm instance {}".format(vm__vim_uuid))
 
     def refresh_vms_status(self, vm_list):
         """Get the status of the virtual machines and their interfaces/ports
 
     def refresh_vms_status(self, vm_list):
         """Get the status of the virtual machines and their interfaces/ports
@@ -2790,7 +2790,7 @@ class vimconnector(vimconn.vimconnector):
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
-            raise vimconn.vimconnException("Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
+            raise vimconn.VimConnException("Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
 
         vms_dict = {}
         nsx_edge_list = []
 
         vms_dict = {}
         nsx_edge_list = []
@@ -2817,7 +2817,7 @@ class vimconnector(vimconn.vimconnector):
                                               "status code : {}".format(vm.get('href'),
                                                                         response.text,
                                                                         response.status_code))
                                               "status code : {}".format(vm.get('href'),
                                                                         response.text,
                                                                         response.status_code))
-                            raise vimconn.vimconnException("refresh_vms_status : Failed to get VM details")
+                            raise vimconn.VimConnException("refresh_vms_status : Failed to get VM details")
                         xmlroot = XmlElementTree.fromstring(response.text)
 
                         result = response.text.replace("\n", " ")
                         xmlroot = XmlElementTree.fromstring(response.text)
 
                         result = response.text.replace("\n", " ")
@@ -2859,7 +2859,7 @@ class vimconnector(vimconn.vimconnector):
                                 if not nsx_edge_list:
                                     nsx_edge_list = self.get_edge_details()
                                     if nsx_edge_list is None:
                                 if not nsx_edge_list:
                                     nsx_edge_list = self.get_edge_details()
                                     if nsx_edge_list is None:
-                                        raise vimconn.vimconnException("refresh_vms_status:"
+                                        raise vimconn.VimConnException("refresh_vms_status:"
                                                                        "Failed to get edge details from NSX Manager")
                                 if vm_mac is not None:
                                     vm_ip = self.get_ipaddr_from_NSXedge(nsx_edge_list, vm_mac)
                                                                        "Failed to get edge details from NSX Manager")
                                 if vm_mac is not None:
                                     vm_ip = self.get_ipaddr_from_NSXedge(nsx_edge_list, vm_mac)
@@ -2906,7 +2906,7 @@ class vimconnector(vimconn.vimconnector):
                             if edge_summary.tag == 'pagingInfo':
                                 for element in edge_summary:
                                     if element.tag == 'totalCount' and element.text == '0':
                             if edge_summary.tag == 'pagingInfo':
                                 for element in edge_summary:
                                     if element.tag == 'totalCount' and element.text == '0':
-                                        raise vimconn.vimconnException(
+                                        raise vimconn.VimConnException(
                                             "get_edge_details: No NSX edges details found: {}"
                                             .format(self.nsx_manager))
 
                                             "get_edge_details: No NSX edges details found: {}"
                                             .format(self.nsx_manager))
 
@@ -2915,11 +2915,11 @@ class vimconnector(vimconn.vimconnector):
                                     if element.tag == 'id':
                                         edge_list.append(element.text)
                     else:
                                     if element.tag == 'id':
                                         edge_list.append(element.text)
                     else:
-                        raise vimconn.vimconnException("get_edge_details: No NSX edge details found: {}"
+                        raise vimconn.VimConnException("get_edge_details: No NSX edge details found: {}"
                                                        .format(self.nsx_manager))
 
                 if not edge_list:
                                                        .format(self.nsx_manager))
 
                 if not edge_list:
-                    raise vimconn.vimconnException("get_edge_details: "
+                    raise vimconn.VimConnException("get_edge_details: "
                                                    "No NSX edge details found: {}"
                                                    .format(self.nsx_manager))
                 else:
                                                    "No NSX edge details found: {}"
                                                    .format(self.nsx_manager))
                 else:
@@ -2935,7 +2935,7 @@ class vimconnector(vimconn.vimconnector):
             self.logger.debug("get_edge_details: "
                               "Failed to get NSX edge details from NSX Manager: {}"
                               .format(exp))
             self.logger.debug("get_edge_details: "
                               "Failed to get NSX edge details from NSX Manager: {}"
                               .format(exp))
-            raise vimconn.vimconnException("get_edge_details: "
+            raise vimconn.VimConnException("get_edge_details: "
                                            "Failed to get NSX edge details from NSX Manager: {}"
                                            .format(exp))
 
                                            "Failed to get NSX edge details from NSX Manager: {}"
                                            .format(exp))
 
@@ -2992,16 +2992,16 @@ class vimconnector(vimconn.vimconnector):
 
         self.logger.debug("Received action for vm {} and action dict {}".format(vm__vim_uuid, action_dict))
         if vm__vim_uuid is None or action_dict is None:
 
         self.logger.debug("Received action for vm {} and action dict {}".format(vm__vim_uuid, action_dict))
         if vm__vim_uuid is None or action_dict is None:
-            raise vimconn.vimconnException("Invalid request. VM id or action is None.")
+            raise vimconn.VimConnException("Invalid request. VM id or action is None.")
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
 
         _, vdc = self.get_vdc_details()
         if vdc is None:
-            raise vimconn.vimconnException("Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
+            raise vimconn.VimConnException("Failed to get a reference of VDC for a tenant {}".format(self.tenant_name))
 
         vapp_name = self.get_namebyvappid(vm__vim_uuid)
         if vapp_name is None:
             self.logger.debug("action_vminstance(): Failed to get vm by given {} vm uuid".format(vm__vim_uuid))
 
         vapp_name = self.get_namebyvappid(vm__vim_uuid)
         if vapp_name is None:
             self.logger.debug("action_vminstance(): Failed to get vm by given {} vm uuid".format(vm__vim_uuid))
-            raise vimconn.vimconnException("Failed to get vm by given {} vm uuid".format(vm__vim_uuid))
+            raise vimconn.VimConnException("Failed to get vm by given {} vm uuid".format(vm__vim_uuid))
         else:
             self.logger.info("Action_vminstance vApp {} and UUID {}".format(vapp_name, vm__vim_uuid))
 
         else:
             self.logger.info("Action_vminstance vApp {} and UUID {}".format(vapp_name, vm__vim_uuid))
 
@@ -3046,12 +3046,12 @@ class vimconnector(vimconn.vimconnector):
                 reboot_task = vapp.reboot()
                 self.client.get_task_monitor().wait_for_success(task=reboot_task)
             else:
                 reboot_task = vapp.reboot()
                 self.client.get_task_monitor().wait_for_success(task=reboot_task)
             else:
-                raise vimconn.vimconnException(
+                raise vimconn.VimConnException(
                     "action_vminstance: Invalid action {} or action is None.".format(action_dict))
             return vm__vim_uuid
         except Exception as exp:
             self.logger.debug("action_vminstance: Failed with Exception {}".format(exp))
                     "action_vminstance: Invalid action {} or action is None.".format(action_dict))
             return vm__vim_uuid
         except Exception as exp:
             self.logger.debug("action_vminstance: Failed with Exception {}".format(exp))
-            raise vimconn.vimconnException("action_vminstance: Failed with Exception {}".format(exp))
+            raise vimconn.VimConnException("action_vminstance: Failed with Exception {}".format(exp))
 
     def instance_actions_result(self, action, result, vapp_name):
         if result.get('status') == 'success':
 
     def instance_actions_result(self, action, result, vapp_name):
         if result.get('status') == 'success':
@@ -3093,7 +3093,7 @@ class vimconnector(vimconn.vimconnector):
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
-                raise vimconn.vimconnException("get_vminstance_console : Failed to get "
+                raise vimconn.VimConnException("get_vminstance_console : Failed to get "
                                                "VM Mks ticket details")
             s = re.search("<Host>(.*?)</Host>", response.text)
             console_dict['server'] = s.group(1) if s else None
                                                "VM Mks ticket details")
             s = re.search("<Host>(.*?)</Host>", response.text)
             console_dict['server'] = s.group(1) if s else None
@@ -3116,7 +3116,7 @@ class vimconnector(vimconn.vimconnector):
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
-                raise vimconn.vimconnException("get_vminstance_console : Failed to get "
+                raise vimconn.VimConnException("get_vminstance_console : Failed to get "
                                                "VM console details")
             s = re.search(">.*?/(vm-\d+.*)</", response.text)
             console_dict['suffix'] = s.group(1) if s else None
                                                "VM console details")
             s = re.search(">.*?/(vm-\d+.*)</", response.text)
             console_dict['suffix'] = s.group(1) if s else None
@@ -3130,46 +3130,46 @@ class vimconnector(vimconn.vimconnector):
         """Transform host dictionary from VIM format to GUI format,
         and append to the server_dict
         """
         """Transform host dictionary from VIM format to GUI format,
         and append to the server_dict
         """
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def get_hosts_info(self):
         """Get the information of deployed hosts
         Returns the hosts content"""
 
     def get_hosts_info(self):
         """Get the information of deployed hosts
         Returns the hosts content"""
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def get_hosts(self, vim_tenant):
         """Get the hosts and deployed instances
         Returns the hosts content"""
 
     def get_hosts(self, vim_tenant):
         """Get the hosts and deployed instances
         Returns the hosts content"""
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def get_processor_rankings(self):
         """Get the processor rankings in the VIM database"""
 
     def get_processor_rankings(self):
         """Get the processor rankings in the VIM database"""
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def new_host(self, host_data):
         """Adds a new host to VIM"""
         '''Returns status code of the VIM response'''
 
     def new_host(self, host_data):
         """Adds a new host to VIM"""
         '''Returns status code of the VIM response'''
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def new_external_port(self, port_data):
         """Adds a external port to VIM"""
         '''Returns the port identifier'''
 
     def new_external_port(self, port_data):
         """Adds a external port to VIM"""
         '''Returns the port identifier'''
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def new_external_network(self, net_name, net_type):
         """Adds a external network to VIM (shared)"""
         '''Returns the network identifier'''
 
     def new_external_network(self, net_name, net_type):
         """Adds a external network to VIM (shared)"""
         '''Returns the network identifier'''
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def connect_port_network(self, port_id, network_id, admin=False):
         """Connects a external port to a network"""
         '''Returns status code of the VIM response'''
 
     def connect_port_network(self, port_id, network_id, admin=False):
         """Connects a external port to a network"""
         '''Returns status code of the VIM response'''
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def new_vminstancefromJSON(self, vm_data):
         """Adds a VM instance to VIM"""
         '''Returns the instance identifier'''
 
     def new_vminstancefromJSON(self, vm_data):
         """Adds a VM instance to VIM"""
         '''Returns the instance identifier'''
-        raise vimconn.vimconnNotImplemented("Should have implemented this")
+        raise vimconn.VimConnNotImplemented("Should have implemented this")
 
     def get_network_name_by_id(self, network_uuid=None):
         """Method gets vcloud director network named based on supplied uuid.
 
     def get_network_name_by_id(self, network_uuid=None):
         """Method gets vcloud director network named based on supplied uuid.
@@ -3234,7 +3234,7 @@ class vimconnector(vimconn.vimconnector):
         try:
             client_as_admin = self.connect_as_admin()
             if not client_as_admin:
         try:
             client_as_admin = self.connect_as_admin()
             if not client_as_admin:
-                raise vimconn.vimconnConnectionException("Failed to connect vCD.")
+                raise vimconn.VimConnConnectionException("Failed to connect vCD.")
             url_list = [self.url, '/api/admin/vdc/', self.tenant_id]
             vm_list_rest_call = ''.join(url_list)
 
             url_list = [self.url, '/api/admin/vdc/', self.tenant_id]
             vm_list_rest_call = ''.join(url_list)
 
@@ -3543,7 +3543,7 @@ class vimconnector(vimconn.vimconnector):
         vm_dict = {}
         vca = self.connect()
         if not vca:
         vm_dict = {}
         vca = self.connect()
         if not vca:
-            raise vimconn.vimconnConnectionException("self.connect() is failed")
+            raise vimconn.VimConnConnectionException("self.connect() is failed")
 
         if vdc_name is None:
             return vm_dict
 
         if vdc_name is None:
             return vm_dict
@@ -3663,7 +3663,7 @@ class vimconnector(vimconn.vimconnector):
                                 network_configuration[tagKey] = configuration.text.strip()
         except Exception as exp:
             self.logger.debug("get_vcd_network: Failed with Exception {}".format(exp))
                                 network_configuration[tagKey] = configuration.text.strip()
         except Exception as exp:
             self.logger.debug("get_vcd_network: Failed with Exception {}".format(exp))
-            raise vimconn.vimconnException("get_vcd_network: Failed with Exception {}".format(exp))
+            raise vimconn.VimConnException("get_vcd_network: Failed with Exception {}".format(exp))
 
         return network_configuration
 
 
         return network_configuration
 
@@ -3679,7 +3679,7 @@ class vimconnector(vimconn.vimconnector):
         """
         client = self.connect_as_admin()
         if not client:
         """
         client = self.connect_as_admin()
         if not client:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD as admin")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD as admin")
         if network_uuid is None:
             return False
 
         if network_uuid is None:
             return False
 
@@ -3752,7 +3752,7 @@ class vimconnector(vimconn.vimconnector):
         """
         client_as_admin = self.connect_as_admin()
         if not client_as_admin:
         """
         client_as_admin = self.connect_as_admin()
         if not client_as_admin:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD.")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD.")
         if network_name is None:
             return None
 
         if network_name is None:
             return None
 
@@ -3858,7 +3858,7 @@ class vimconnector(vimconn.vimconnector):
                 dns_address = ip_profile['dns_address']
             except KeyError as exp:
                 self.logger.debug("Create Network REST: Key error {}".format(exp))
                 dns_address = ip_profile['dns_address']
             except KeyError as exp:
                 self.logger.debug("Create Network REST: Key error {}".format(exp))
-                raise vimconn.vimconnException("Create Network REST: Key error{}".format(exp))
+                raise vimconn.VimConnException("Create Network REST: Key error{}".format(exp))
 
             # either use client provided UUID or search for a first available
             #  if both are not defined we return none
 
             # either use client provided UUID or search for a first available
             #  if both are not defined we return none
@@ -4039,7 +4039,7 @@ class vimconnector(vimconn.vimconnector):
         self.logger.info("Creating new vdc {}".format(vdc_name))
         vca = self.connect_as_admin()
         if not vca:
         self.logger.info("Creating new vdc {}".format(vdc_name))
         vca = self.connect_as_admin()
         if not vca:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD")
         if vdc_name is None:
             return None
 
         if vdc_name is None:
             return None
 
@@ -4114,7 +4114,7 @@ class vimconnector(vimconn.vimconnector):
 
         vca = self.connect_as_admin()
         if not vca:
 
         vca = self.connect_as_admin()
         if not vca:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD")
         if vdc_name is None:
             return None
 
         if vdc_name is None:
             return None
 
@@ -4208,7 +4208,7 @@ class vimconnector(vimconn.vimconnector):
             vca = self.client
 
         if not vca:
             vca = self.client
 
         if not vca:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD")
         if vapp_uuid is None:
             return None
 
         if vapp_uuid is None:
             return None
 
@@ -4545,7 +4545,7 @@ class vimconnector(vimconn.vimconnector):
                                     host_obj = new_host_obj
                                 else:
                                     self.logger.info("Fail to migrate VM : {}".format(result))
                                     host_obj = new_host_obj
                                 else:
                                     self.logger.info("Fail to migrate VM : {}".format(result))
-                                    raise vimconn.vimconnNotFoundException(
+                                    raise vimconn.VimConnNotFoundException(
                                         "Fail to migrate VM : {} to host {}".format(
                                             vmname_andid,
                                             new_host_obj)
                                         "Fail to migrate VM : {} to host {}".format(
                                             vmname_andid,
                                             new_host_obj)
@@ -4569,7 +4569,7 @@ class vimconnector(vimconn.vimconnector):
                                                   no_of_pci_devices,
                                                   vmname_andid)
                                               )
                                                   no_of_pci_devices,
                                                   vmname_andid)
                                               )
-                            raise vimconn.vimconnNotFoundException(
+                            raise vimconn.VimConnNotFoundException(
                                 "Currently there is no host with {} "
                                 "number of avaialble PCI devices required for VM {}".format(
                                     no_of_pci_devices,
                                 "Currently there is no host with {} "
                                 "number of avaialble PCI devices required for VM {}".format(
                                     no_of_pci_devices,
@@ -4807,26 +4807,26 @@ class vimconnector(vimconn.vimconnector):
         if self.vcenter_ip is not None:
             vm_vcenter_info["vm_vcenter_ip"] = self.vcenter_ip
         else:
         if self.vcenter_ip is not None:
             vm_vcenter_info["vm_vcenter_ip"] = self.vcenter_ip
         else:
-            raise vimconn.vimconnException(message="vCenter IP is not provided."
+            raise vimconn.VimConnException(message="vCenter IP is not provided."
                                            " Please provide vCenter IP while attaching datacenter "
                                            "to tenant in --config")
         if self.vcenter_port is not None:
             vm_vcenter_info["vm_vcenter_port"] = self.vcenter_port
         else:
                                            " Please provide vCenter IP while attaching datacenter "
                                            "to tenant in --config")
         if self.vcenter_port is not None:
             vm_vcenter_info["vm_vcenter_port"] = self.vcenter_port
         else:
-            raise vimconn.vimconnException(message="vCenter port is not provided."
+            raise vimconn.VimConnException(message="vCenter port is not provided."
                                            " Please provide vCenter port while attaching datacenter "
                                            "to tenant in --config")
         if self.vcenter_user is not None:
             vm_vcenter_info["vm_vcenter_user"] = self.vcenter_user
         else:
                                            " Please provide vCenter port while attaching datacenter "
                                            "to tenant in --config")
         if self.vcenter_user is not None:
             vm_vcenter_info["vm_vcenter_user"] = self.vcenter_user
         else:
-            raise vimconn.vimconnException(message="vCenter user is not provided."
+            raise vimconn.VimConnException(message="vCenter user is not provided."
                                            " Please provide vCenter user while attaching datacenter "
                                            "to tenant in --config")
 
         if self.vcenter_password is not None:
             vm_vcenter_info["vm_vcenter_password"] = self.vcenter_password
         else:
                                            " Please provide vCenter user while attaching datacenter "
                                            "to tenant in --config")
 
         if self.vcenter_password is not None:
             vm_vcenter_info["vm_vcenter_password"] = self.vcenter_password
         else:
-            raise vimconn.vimconnException(message="vCenter user password is not provided."
+            raise vimconn.VimConnException(message="vCenter user password is not provided."
                                            " Please provide vCenter user password while attaching datacenter "
                                            "to tenant in --config")
 
                                            " Please provide vCenter user password while attaching datacenter "
                                            "to tenant in --config")
 
@@ -4867,7 +4867,7 @@ class vimconnector(vimconn.vimconnector):
         except Exception as exp:
             self.logger.error("Error occurred while getting VM information"
                               " for VM : {}".format(exp))
         except Exception as exp:
             self.logger.error("Error occurred while getting VM information"
                               " for VM : {}".format(exp))
-            raise vimconn.vimconnException(message=exp)
+            raise vimconn.VimConnException(message=exp)
 
     def reserve_memory_for_all_vms(self, vapp, memory_mb):
         """
 
     def reserve_memory_for_all_vms(self, vapp, memory_mb):
         """
@@ -4900,7 +4900,7 @@ class vimconnector(vimconn.vimconnector):
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
-                raise vimconn.vimconnException("reserve_memory_for_all_vms : Failed to get "
+                raise vimconn.VimConnException("reserve_memory_for_all_vms : Failed to get "
                                                "memory")
 
             bytexml = bytes(bytearray(response.text, encoding='utf-8'))
                                                "memory")
 
             bytexml = bytes(bytearray(response.text, encoding='utf-8'))
@@ -4929,7 +4929,7 @@ class vimconnector(vimconn.vimconnector):
                                   "status code : {} ".format(url_rest_call,
                                                              response.text,
                                                              response.status_code))
                                   "status code : {} ".format(url_rest_call,
                                                              response.text,
                                                              response.status_code))
-                raise vimconn.vimconnException("reserve_memory_for_all_vms : Failed to update "
+                raise vimconn.VimConnException("reserve_memory_for_all_vms : Failed to update "
                                                "virtual hardware memory section")
             else:
                 mem_task = self.get_task_from_response(response.text)
                                                "virtual hardware memory section")
             else:
                 mem_task = self.get_task_from_response(response.text)
@@ -4969,14 +4969,14 @@ class vimconnector(vimconn.vimconnector):
                               "status code : {}".format(url_rest_call,
                                                         response.text,
                                                         response.status_code))
                               "status code : {}".format(url_rest_call,
                                                         response.text,
                                                         response.status_code))
-            raise vimconn.vimconnException("connect_vapp_to_org_vdc_network : Failed to get "
+            raise vimconn.VimConnException("connect_vapp_to_org_vdc_network : Failed to get "
                                            "network config section")
 
         data = response.text
         headers['Content-Type'] = 'application/vnd.vmware.vcloud.networkConfigSection+xml'
         net_id = self.get_network_id_by_name(net_name)
         if not net_id:
                                            "network config section")
 
         data = response.text
         headers['Content-Type'] = 'application/vnd.vmware.vcloud.networkConfigSection+xml'
         net_id = self.get_network_id_by_name(net_name)
         if not net_id:
-            raise vimconn.vimconnException("connect_vapp_to_org_vdc_network : Failed to find "
+            raise vimconn.VimConnException("connect_vapp_to_org_vdc_network : Failed to find "
                                            "existing network")
 
         bytexml = bytes(bytearray(data, encoding='utf-8'))
                                            "existing network")
 
         bytexml = bytes(bytearray(data, encoding='utf-8'))
@@ -5021,7 +5021,7 @@ class vimconnector(vimconn.vimconnector):
                               "status code : {} ".format(url_rest_call,
                                                          response.text,
                                                          response.status_code))
                               "status code : {} ".format(url_rest_call,
                                                          response.text,
                                                          response.status_code))
-            raise vimconn.vimconnException("connect_vapp_to_org_vdc_network : Failed to update "
+            raise vimconn.VimConnException("connect_vapp_to_org_vdc_network : Failed to update "
                                            "network config section")
         else:
             vapp_task = self.get_task_from_response(response.text)
                                            "network config section")
         else:
             vapp_task = self.get_task_from_response(response.text)
@@ -5062,7 +5062,7 @@ class vimconnector(vimconn.vimconnector):
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
-                raise vimconn.vimconnException("remove_primary_network_adapter : Failed to get "
+                raise vimconn.VimConnException("remove_primary_network_adapter : Failed to get "
                                                "network connection section")
 
             data = response.text
                                                "network connection section")
 
             data = response.text
@@ -5101,7 +5101,7 @@ class vimconnector(vimconn.vimconnector):
                                   "status code : {} ".format(url_rest_call,
                                                              response.text,
                                                              response.status_code))
                                   "status code : {} ".format(url_rest_call,
                                                              response.text,
                                                              response.status_code))
-                raise vimconn.vimconnException("remove_primary_network_adapter : Failed to update "
+                raise vimconn.VimConnException("remove_primary_network_adapter : Failed to update "
                                                "network connection section")
             else:
                 nic_task = self.get_task_from_response(response.text)
                                                "network connection section")
             else:
                 nic_task = self.get_task_from_response(response.text)
@@ -5168,7 +5168,7 @@ class vimconnector(vimconn.vimconnector):
                                           "status code : {}".format(url_rest_call,
                                                                     response.text,
                                                                     response.status_code))
                                           "status code : {}".format(url_rest_call,
                                                                     response.text,
                                                                     response.status_code))
-                        raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to get "
+                        raise vimconn.VimConnException("add_network_adapter_to_vms : Failed to get "
                                                        "network connection section")
 
                     data = response.text
                                                        "network connection section")
 
                     data = response.text
@@ -5230,7 +5230,7 @@ class vimconnector(vimconn.vimconnector):
                                           "status code : {} ".format(url_rest_call,
                                                                      response.text,
                                                                      response.status_code))
                                           "status code : {} ".format(url_rest_call,
                                                                      response.text,
                                                                      response.status_code))
-                        raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to update "
+                        raise vimconn.VimConnException("add_network_adapter_to_vms : Failed to update "
                                                        "network connection section")
                     else:
                         nic_task = self.get_task_from_response(response.text)
                                                        "network connection section")
                     else:
                         nic_task = self.get_task_from_response(response.text)
@@ -5261,7 +5261,7 @@ class vimconnector(vimconn.vimconnector):
                                           "status code : {}".format(url_rest_call,
                                                                     response.text,
                                                                     response.status_code))
                                           "status code : {}".format(url_rest_call,
                                                                     response.text,
                                                                     response.status_code))
-                        raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to get "
+                        raise vimconn.VimConnException("add_network_adapter_to_vms : Failed to get "
                                                        "network connection section")
                     data = response.text
                     data = data.split('<Link rel="edit"')[0]
                                                        "network connection section")
                     data = response.text
                     data = data.split('<Link rel="edit"')[0]
@@ -5328,7 +5328,7 @@ class vimconnector(vimconn.vimconnector):
                                           "status code : {}".format(url_rest_call,
                                                                     response.text,
                                                                     response.status_code))
                                           "status code : {}".format(url_rest_call,
                                                                     response.text,
                                                                     response.status_code))
-                        raise vimconn.vimconnException("add_network_adapter_to_vms : Failed to update "
+                        raise vimconn.VimConnException("add_network_adapter_to_vms : Failed to update "
                                                        "network connection section")
                     else:
                         nic_task = self.get_task_from_response(response.text)
                                                        "network connection section")
                     else:
                         nic_task = self.get_task_from_response(response.text)
@@ -5342,7 +5342,7 @@ class vimconnector(vimconn.vimconnector):
         except Exception as exp:
             self.logger.error("add_network_adapter_to_vms() : exception occurred "
                               "while adding Network adapter")
         except Exception as exp:
             self.logger.error("add_network_adapter_to_vms() : exception occurred "
                               "while adding Network adapter")
-            raise vimconn.vimconnException(message=exp)
+            raise vimconn.VimConnException(message=exp)
 
     def set_numa_affinity(self, vmuuid, paired_threads_id):
         """
 
     def set_numa_affinity(self, vmuuid, paired_threads_id):
         """
@@ -5383,7 +5383,7 @@ class vimconnector(vimconn.vimconnector):
         except Exception as exp:
             self.logger.error("set_numa_affinity : exception occurred while setting numa affinity "
                               "for VM {} : {}".format(vm_obj, vm_moref_id))
         except Exception as exp:
             self.logger.error("set_numa_affinity : exception occurred while setting numa affinity "
                               "for VM {} : {}".format(vm_obj, vm_moref_id))
-            raise vimconn.vimconnException("set_numa_affinity : Error {} failed to assign numa "
+            raise vimconn.VimConnException("set_numa_affinity : Error {} failed to assign numa "
                                            "affinity".format(exp))
 
     def cloud_init(self, vapp, cloud_config):
                                            "affinity".format(exp))
 
     def cloud_init(self, vapp, cloud_config):
@@ -5426,7 +5426,7 @@ class vimconnector(vimconn.vimconnector):
         except Exception as exp:
             self.logger.error("cloud_init : exception occurred while injecting "
                               "ssh-key")
         except Exception as exp:
             self.logger.error("cloud_init : exception occurred while injecting "
                               "ssh-key")
-            raise vimconn.vimconnException("cloud_init : Error {} failed to inject "
+            raise vimconn.VimConnException("cloud_init : Error {} failed to inject "
                                            "ssh-key".format(exp))
 
     def format_script(self, key_pairs=[], users_list=[]):
                                            "ssh-key".format(exp))
 
     def format_script(self, key_pairs=[], users_list=[]):
@@ -5545,7 +5545,7 @@ if [ "$1" = "precustomization" ];then
             else:
                 self.logger.error("guest_customization : task for customized guest os"
                                   "failed for VM {}".format(vm_name))
             else:
                 self.logger.error("guest_customization : task for customized guest os"
                                   "failed for VM {}".format(vm_name))
-                raise vimconn.vimconnException("guest_customization : failed to perform"
+                raise vimconn.VimConnException("guest_customization : failed to perform"
                                                "guest os customization on VM {}".format(vm_name))
 
     def add_new_disk(self, vapp_uuid, disk_size):
                                                "guest os customization on VM {}".format(vm_name))
 
     def add_new_disk(self, vapp_uuid, disk_size):
@@ -5828,7 +5828,7 @@ if [ "$1" = "precustomization" ];then
         except Exception as exp:
             self.logger.error("Error occurred while getting vCenter infromationn"
                               " for VM : {}".format(exp))
         except Exception as exp:
             self.logger.error("Error occurred while getting vCenter infromationn"
                               " for VM : {}".format(exp))
-            raise vimconn.vimconnException(message=exp)
+            raise vimconn.VimConnException(message=exp)
 
         context = None
         if hasattr(ssl, '_create_unverified_context'):
 
         context = None
         if hasattr(ssl, '_create_unverified_context'):
@@ -5875,7 +5875,7 @@ if [ "$1" = "precustomization" ];then
 
         vca = self.connect_as_admin()
         if not vca:
 
         vca = self.connect_as_admin()
         if not vca:
-            raise vimconn.vimconnConnectionException("Failed to connect vCD")
+            raise vimconn.VimConnConnectionException("Failed to connect vCD")
 
         try:
             org, _ = self.get_vdc_details()
 
         try:
             org, _ = self.get_vdc_details()
@@ -5950,9 +5950,9 @@ if [ "$1" = "precustomization" ];then
             msg = "No vApp ID"
         self.logger.error(msg)
         if exp_type == "Genric":
             msg = "No vApp ID"
         self.logger.error(msg)
         if exp_type == "Genric":
-            raise vimconn.vimconnException(msg)
+            raise vimconn.VimConnException(msg)
         elif exp_type == "NotFound":
         elif exp_type == "NotFound":
-            raise vimconn.vimconnNotFoundException(message=msg)
+            raise vimconn.VimConnNotFoundException(message=msg)
 
     def add_sriov(self, vapp_uuid, sriov_nets, vmname_andid):
         """
 
     def add_sriov(self, vapp_uuid, sriov_nets, vmname_andid):
         """
@@ -6002,7 +6002,7 @@ if [ "$1" = "precustomization" ];then
                                     host_obj = new_host_obj
                                 else:
                                     self.logger.info("Fail to migrate VM : {}".format(result))
                                     host_obj = new_host_obj
                                 else:
                                     self.logger.info("Fail to migrate VM : {}".format(result))
-                                    raise vimconn.vimconnNotFoundException(
+                                    raise vimconn.VimConnNotFoundException(
                                         "Fail to migrate VM : {} to host {}".format(
                                             vmname_andid,
                                             new_host_obj)
                                         "Fail to migrate VM : {} to host {}".format(
                                             vmname_andid,
                                             new_host_obj)
@@ -6035,7 +6035,7 @@ if [ "$1" = "precustomization" ];then
                                     self.logger.error("Fail to add SRIOV {} to VM {}".format(
                                         no_of_sriov_devices,
                                         str(vm_obj)))
                                     self.logger.error("Fail to add SRIOV {} to VM {}".format(
                                         no_of_sriov_devices,
                                         str(vm_obj)))
-                                    raise vimconn.vimconnUnexpectedResponse(
+                                    raise vimconn.VimConnUnexpectedResponse(
                                         "Fail to add SRIOV adapter in VM ".format(str(vm_obj))
                                         )
                             return True, vm_obj, vcenter_conect
                                         "Fail to add SRIOV adapter in VM ".format(str(vm_obj))
                                         )
                             return True, vm_obj, vcenter_conect
@@ -6046,7 +6046,7 @@ if [ "$1" = "precustomization" ];then
                                                   no_of_sriov_devices,
                                                   vmname_andid)
                                               )
                                                   no_of_sriov_devices,
                                                   vmname_andid)
                                               )
-                            raise vimconn.vimconnNotFoundException(
+                            raise vimconn.VimConnNotFoundException(
                                 "Currently there is no host with {} "
                                 "number of avaialble SRIOV devices required for VM {}".format(
                                     no_of_sriov_devices,
                                 "Currently there is no host with {} "
                                 "number of avaialble SRIOV devices required for VM {}".format(
                                     no_of_sriov_devices,
@@ -6332,7 +6332,7 @@ if [ "$1" = "precustomization" ];then
         vlan_id = None
         used_ids = []
         if self.config.get('vlanID_range') is None:
         vlan_id = None
         used_ids = []
         if self.config.get('vlanID_range') is None:
-            raise vimconn.vimconnConflictException("You must provide a 'vlanID_range' "
+            raise vimconn.VimConnConflictException("You must provide a 'vlanID_range' "
                                                    "at config value before creating sriov network with vlan tag")
         if "used_vlanIDs" not in self.persistent_info:
                 self.persistent_info["used_vlanIDs"] = {}
                                                    "at config value before creating sriov network with vlan tag")
         if "used_vlanIDs" not in self.persistent_info:
                 self.persistent_info["used_vlanIDs"] = {}
@@ -6342,7 +6342,7 @@ if [ "$1" = "precustomization" ];then
         for vlanID_range in self.config.get('vlanID_range'):
             start_vlanid, end_vlanid = vlanID_range.split("-")
             if start_vlanid > end_vlanid:
         for vlanID_range in self.config.get('vlanID_range'):
             start_vlanid, end_vlanid = vlanID_range.split("-")
             if start_vlanid > end_vlanid:
-                raise vimconn.vimconnConflictException("Invalid vlan ID range {}".format(
+                raise vimconn.VimConnConflictException("Invalid vlan ID range {}".format(
                     vlanID_range))
 
             for vid in range(int(start_vlanid), int(end_vlanid) + 1):
                     vlanID_range))
 
             for vid in range(int(start_vlanid), int(end_vlanid) + 1):
@@ -6351,7 +6351,7 @@ if [ "$1" = "precustomization" ];then
                     self.persistent_info["used_vlanIDs"][network_name] = vlan_id
                     return vlan_id
         if vlan_id is None:
                     self.persistent_info["used_vlanIDs"][network_name] = vlan_id
                     return vlan_id
         if vlan_id is None:
-            raise vimconn.vimconnConflictException("All Vlan IDs are in use")
+            raise vimconn.VimConnConflictException("All Vlan IDs are in use")
 
     def get_obj(self, content, vimtype, name):
         """
 
     def get_obj(self, content, vimtype, name):
         """
@@ -6388,7 +6388,7 @@ if [ "$1" = "precustomization" ];then
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
                                   "status code : {}".format(url_rest_call,
                                                             response.text,
                                                             response.status_code))
-                raise vimconn.vimconnException("insert_media_to_vm(): Failed to get "
+                raise vimconn.VimConnException("insert_media_to_vm(): Failed to get "
                                                "catalog details")
             # searching iso name and id
             iso_name, media_id = self.get_media_details(vca, response.text)
                                                "catalog details")
             # searching iso name and id
             iso_name, media_id = self.get_media_details(vca, response.text)
@@ -6427,7 +6427,7 @@ if [ "$1" = "precustomization" ];then
                         error_msg = ("insert_media_to_vm() : Failed to insert CD-ROM to vm. Reason {}. "
                                      "Status code {}".format(response.text, response.status_code))
                         self.logger.error(error_msg)
                         error_msg = ("insert_media_to_vm() : Failed to insert CD-ROM to vm. Reason {}. "
                                      "Status code {}".format(response.text, response.status_code))
                         self.logger.error(error_msg)
-                        raise vimconn.vimconnException(error_msg)
+                        raise vimconn.VimConnException(error_msg)
                     else:
                         task = self.get_task_from_response(response.text)
                         result = self.client.get_task_monitor().wait_for_success(task=task)
                     else:
                         task = self.get_task_from_response(response.text)
                         result = self.client.get_task_monitor().wait_for_success(task=task)
@@ -6438,7 +6438,7 @@ if [ "$1" = "precustomization" ];then
         except Exception as exp:
             self.logger.error("insert_media_to_vm() : exception occurred "
                               "while inserting media CD-ROM")
         except Exception as exp:
             self.logger.error("insert_media_to_vm() : exception occurred "
                               "while inserting media CD-ROM")
-            raise vimconn.vimconnException(message=exp)
+            raise vimconn.VimConnException(message=exp)
 
     def get_media_details(self, vca, content):
         """
 
     def get_media_details(self, vca, content):
         """
@@ -6467,7 +6467,7 @@ if [ "$1" = "precustomization" ];then
                                                   "status code : {}".format(href,
                                                                             response.text,
                                                                             response.status_code))
                                                   "status code : {}".format(href,
                                                                             response.text,
                                                                             response.status_code))
-                                raise vimconn.vimconnException("get_media_details : Failed to get "
+                                raise vimconn.VimConnException("get_media_details : Failed to get "
                                                                "catalogitem details")
                             list_xmlroot = XmlElementTree.fromstring(response.text)
                             for child in list_xmlroot.iter():
                                                                "catalogitem details")
                             list_xmlroot = XmlElementTree.fromstring(response.text)
                             for child in list_xmlroot.iter():
@@ -6482,7 +6482,7 @@ if [ "$1" = "precustomization" ];then
         except Exception as exp:
             self.logger.error("get_media_details : exception occurred "
                               "getting media details")
         except Exception as exp:
             self.logger.error("get_media_details : exception occurred "
                               "getting media details")
-            raise vimconn.vimconnException(message=exp)
+            raise vimconn.VimConnException(message=exp)
 
     def retry_rest(self, method, url, add_headers=None, data=None):
         """ Method to get Token & retry respective REST request
 
     def retry_rest(self, method, url, add_headers=None, data=None):
         """ Method to get Token & retry respective REST request
@@ -6640,7 +6640,7 @@ if [ "$1" = "precustomization" ];then
                               "status code : {} ".format(poweron_href,
                                                          response.text,
                                                          response.status_code))
                               "status code : {} ".format(poweron_href,
                                                          response.text,
                                                          response.status_code))
-            raise vimconn.vimconnException("power_on_vapp() : Failed to power on "
+            raise vimconn.VimConnException("power_on_vapp() : Failed to power on "
                                            "vApp {}".format(vapp_name))
         else:
             poweron_task = self.get_task_from_response(response.text)
                                            "vApp {}".format(vapp_name))
         else:
             poweron_task = self.get_task_from_response(response.text)
index 05a3ec1..1657367 100644 (file)
@@ -22,4 +22,4 @@ pyvmomi
 progressbar
 prettytable
 # TODO py3 genisoimage
 progressbar
 prettytable
 # TODO py3 genisoimage
-git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO
+git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin
index 373cf81..46594a6 100644 (file)
@@ -37,9 +37,9 @@ setup(
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
     # version=VERSION,
     # python_requires='>3.5.0',
     author='ETSI OSM',
-    # TODO py3 author_email='',
-    maintainer='OSM_TECH@LIST.ETSI.ORG',  # TODO py3
-    # TODO py3 maintainer_email='',
+    author_email='OSM_TECH@LIST.ETSI.ORG',
+    maintainer='ETSI OSM',
+    maintainer_email='OSM_TECH@LIST.ETSI.ORG',
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
     url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
     license='Apache 2.0',
 
@@ -48,10 +48,10 @@ setup(
     install_requires=[
         "pyvcloud==19.1.1", "progressbar", "prettytable", "pyvmomi",
         "requests", "netaddr", "PyYAML",
     install_requires=[
         "pyvcloud==19.1.1", "progressbar", "prettytable", "pyvmomi",
         "requests", "netaddr", "PyYAML",
-        "osm-ro @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro&subdirectory=RO"
+        "osm-ro-plugin @ git+https://osm.etsi.org/gerrit/osm/RO.git#egg=osm-ro-plugin&subdirectory=RO-plugin"
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
     ],
     setup_requires=['setuptools-version-command'],
     entry_points={
-        'osm_rovim.plugins': ['rovim_vmware = osm_rovim_vmware.vimconn_vmware'],
+        'osm_rovim.plugins': ['rovim_vmware = osm_rovim_vmware.vimconn_vmware:vimconnector'],
     },
 )
     },
 )
index ff50a2f..58ac4b9 100644 (file)
@@ -16,5 +16,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro, python3-pip,
+Depends3: python3-requests, python3-netaddr, python3-yaml, python3-osm-ro-plugin, python3-pip,
           genisoimage, python3-progressbar, python3-prettytable, python3-pyvmomi
           genisoimage, python3-progressbar, python3-prettytable, python3-pyvmomi
index 844e87e..94477fb 100644 (file)
@@ -15,4 +15,5 @@
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
 
 [DEFAULT]
 X-Python3-Version : >= 3.5
-Depends3: python3-argcomplete, python3-requests, python3-yaml 
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
+Depends3: python3-argcomplete, python3-requests, python3-yaml
diff --git a/RO-plugin/Makefile b/RO-plugin/Makefile
new file mode 100644 (file)
index 0000000..3522b72
--- /dev/null
@@ -0,0 +1,24 @@
+##
+# 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.
+##
+
+all: clean package
+
+clean:
+       rm -rf dist deb_dist osm_ro_plugin-*.tar.gz osm_ro_plugin.egg-info .eggs
+
+package:
+       python3 setup.py --command-packages=stdeb.command sdist_dsc
+       cd deb_dist/osm-ro-plugin*/ && dpkg-buildpackage -rfakeroot -uc -us
+
diff --git a/RO-plugin/osm_ro_plugin/openflow_conn.py b/RO-plugin/osm_ro_plugin/openflow_conn.py
new file mode 100644 (file)
index 0000000..f7910c9
--- /dev/null
@@ -0,0 +1,464 @@
+##
+# Copyright 2019 Telefonica Investigacion y Desarrollo, S.A.U.
+# All Rights Reserved.
+#
+# 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 http import HTTPStatus
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
+from uuid import uuid4
+
+"""
+Implement an Abstract class 'OpenflowConn' and an engine 'SdnConnectorOpenFlow' used for base class for SDN plugings
+that implements a pro-active opeflow rules.
+"""
+
+__author__ = "Alfonso Tierno"
+__date__ = "2019-11-11"
+
+
+class OpenflowConnException(Exception):
+    """Common and base class Exception for all vimconnector exceptions"""
+    def __init__(self, message, http_code=HTTPStatus.BAD_REQUEST.value):
+        Exception.__init__(self, message)
+        self.http_code = http_code
+
+
+class OpenflowConnConnectionException(OpenflowConnException):
+    """Connectivity error with the VIM"""
+    def __init__(self, message, http_code=HTTPStatus.SERVICE_UNAVAILABLE.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConnUnexpectedResponse(OpenflowConnException):
+    """Get an wrong response from VIM"""
+    def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConnAuthException(OpenflowConnException):
+    """Invalid credentials or authorization to perform this action over the VIM"""
+    def __init__(self, message, http_code=HTTPStatus.UNAUTHORIZED.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConnNotFoundException(OpenflowConnException):
+    """The item is not found at VIM"""
+    def __init__(self, message, http_code=HTTPStatus.NOT_FOUND.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConnConflictException(OpenflowConnException):
+    """There is a conflict, e.g. more item found than one"""
+    def __init__(self, message, http_code=HTTPStatus.CONFLICT.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConnNotSupportedException(OpenflowConnException):
+    """The request is not supported by connector"""
+    def __init__(self, message, http_code=HTTPStatus.SERVICE_UNAVAILABLE.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConnNotImplemented(OpenflowConnException):
+    """The method is not implemented by the connected"""
+    def __init__(self, message, http_code=HTTPStatus.NOT_IMPLEMENTED.value):
+        OpenflowConnException.__init__(self, message, http_code)
+
+
+class OpenflowConn:
+    """
+    Openflow controller connector abstract implementeation.
+    """
+    def __init__(self, params):
+        self.name = "openflow_conector"
+        self.pp2ofi = {}  # From Physical Port to OpenFlow Index
+        self.ofi2pp = {}  # From OpenFlow Index to Physical Port
+        self.logger = logging.getLogger('openmano.sdn.openflow_conn')
+
+    def get_of_switches(self):
+        """"
+        Obtain a a list of switches or DPID detected by this controller
+        :return: list length, and a list where each element a tuple pair (DPID, IP address), text_error: if fails
+        """
+        raise OpenflowConnNotImplemented("Should have implemented this")
+
+    def obtain_port_correspondence(self):
+        """
+        Obtain the correspondence between physical and openflow port names
+        :return: dictionary: with physical name as key, openflow name as value, error_text: if fails
+        """
+        raise OpenflowConnNotImplemented("Should have implemented this")
+
+    def get_of_rules(self, translate_of_ports=True):
+        """
+        Obtain the rules inserted at openflow controller
+        :param translate_of_ports: if True it translates ports from openflow index to physical switch name
+        :return: list where each item is a  dictionary with the following content:
+                    priority: rule priority
+                    priority: rule priority
+                    name:         rule name (present also as the master dict key)
+                    ingress_port: match input port of the rule
+                    dst_mac:      match destination mac address of the rule, can be missing or None if not apply
+                    vlan_id:      match vlan tag of the rule, can be missing or None if not apply
+                    actions:      list of actions, composed by a pair tuples:
+                        (vlan, None/int): for stripping/setting a vlan tag
+                        (out, port):      send to this port
+                    switch:       DPID, all
+                 text_error if fails
+        """
+        raise OpenflowConnNotImplemented("Should have implemented this")
+
+    def del_flow(self, flow_name):
+        """
+        Delete all existing rules
+        :param flow_name: flow_name, this is the rule name
+        :return: None if ok, text_error if fails
+        """
+        raise OpenflowConnNotImplemented("Should have implemented this")
+
+    def new_flow(self, data):
+        """
+        Insert a new static rule
+        :param data: dictionary with the following content:
+                priority:     rule priority
+                name:         rule name
+                ingress_port: match input port of the rule
+                dst_mac:      match destination mac address of the rule, missing or None if not apply
+                vlan_id:      match vlan tag of the rule, missing or None if not apply
+                actions:      list of actions, composed by a pair tuples with these posibilities:
+                    ('vlan', None/int): for stripping/setting a vlan tag
+                    ('out', port):      send to this port
+        :return: None if ok, text_error if fails
+        """
+        raise OpenflowConnNotImplemented("Should have implemented this")
+
+    def clear_all_flows(self):
+        """"
+        Delete all existing rules
+        :return: None if ok, text_error if fails
+        """
+        raise OpenflowConnNotImplemented("Should have implemented this")
+
+
+class SdnConnectorOpenFlow(SdnConnectorBase):
+    """
+    This class is the base engine of SDN plugins base on openflow rules
+    """
+    flow_fields = ('priority', 'vlan', 'ingress_port', 'actions', 'dst_mac', 'src_mac', 'net_id')
+
+    def __init__(self, wim, wim_account, config=None, logger=None, of_connector=None):
+        self.logger = logger or logging.getLogger('openmano.sdn.openflow_conn')
+        self.of_connector = of_connector
+        self.of_controller_nets_with_same_vlan = config.get("of_controller_nets_with_same_vlan", False)
+
+    def check_credentials(self):
+        try:
+            self.openflow_conn.obtain_port_correspondence()
+        except OpenflowConnException as e:
+            raise SdnConnectorError(e, http_code=e.http_code)
+
+    def get_connectivity_service_status(self, service_uuid, conn_info=None):
+        conn_info = conn_info or {}
+        return {
+            "sdn_status": conn_info.get("status", "ERROR"),
+            "error_msg": conn_info.get("error_msg", "Variable conn_info not provided"),
+        }
+        # TODO check rules connectirng to of_connector
+
+    def create_connectivity_service(self, service_type, connection_points, **kwargs):
+        net_id = str(uuid4())
+        ports = []
+        for cp in connection_points:
+            port = {
+                "uuid": cp["service_endpoint_id"],
+                "vlan": cp.get("service_endpoint_encapsulation_info", {}).get("vlan"),
+                "mac": cp.get("service_endpoint_encapsulation_info", {}).get("mac"),
+                "switch_port": cp.get("service_endpoint_encapsulation_info", {}).get("switch_port"),
+            }
+            ports.append(port)
+        try:
+            created_items = self._set_openflow_rules(service_type, net_id, ports, created_items=None)
+            return net_id, created_items
+        except (SdnConnectorError, OpenflowConnException) as e:
+            raise SdnConnectorError(e, http_code=e.http_code)
+
+    def delete_connectivity_service(self, service_uuid, conn_info=None):
+        try:
+            service_type = "ELAN"
+            ports = []
+            self._set_openflow_rules(service_type, service_uuid, ports, created_items=conn_info)
+            return None
+        except (SdnConnectorError, OpenflowConnException) as e:
+            raise SdnConnectorError(e, http_code=e.http_code)
+
+    def edit_connectivity_service(self, service_uuid, conn_info=None, connection_points=None, **kwargs):
+        ports = []
+        for cp in connection_points:
+            port = {
+                "uuid": cp["service_endpoint_id"],
+                "vlan": cp.get("service_endpoint_encapsulation_info", {}).get("vlan"),
+                "mac": cp.get("service_endpoint_encapsulation_info", {}).get("mac"),
+                "switch_port": cp.get("service_endpoint_encapsulation_info", {}).get("switch_port"),
+            }
+            ports.append(port)
+        service_type = "ELAN"  # TODO. Store at conn_info for later use
+        try:
+            created_items = self._set_openflow_rules(service_type, service_uuid, ports, created_items=conn_info)
+            return created_items
+        except (SdnConnectorError, OpenflowConnException) as e:
+            raise SdnConnectorError(e, http_code=e.http_code)
+
+    def clear_all_connectivity_services(self):
+        """Delete all WAN Links corresponding to a WIM"""
+        pass
+
+    def get_all_active_connectivity_services(self):
+        """Provide information about all active connections provisioned by a
+        WIM
+        """
+        pass
+
+    def _set_openflow_rules(self, net_type, net_id, ports, created_items=None):
+        ifaces_nb = len(ports)
+        if not created_items:
+            created_items = {"status": None, "error_msg": None, "installed_rules_ids": []}
+        rules_to_delete = created_items.get("installed_rules_ids") or []
+        new_installed_rules_ids = []
+        error_list = []
+
+        try:
+            step = "Checking ports and network type compatibility"
+            if ifaces_nb < 2:
+                pass
+            elif net_type == 'ELINE':
+                if ifaces_nb > 2:
+                    raise SdnConnectorError("'ELINE' type network cannot connect {} interfaces, only 2".format(
+                        ifaces_nb))
+            elif net_type == 'ELAN':
+                if ifaces_nb > 2 and self.of_controller_nets_with_same_vlan:
+                    # check all ports are VLAN (tagged) or none
+                    vlan_tags = []
+                    for port in ports:
+                        if port["vlan"] not in vlan_tags:
+                            vlan_tags.append(port["vlan"])
+                    if len(vlan_tags) > 1:
+                        raise SdnConnectorError("This pluging cannot connect ports with diferent VLAN tags when flag "
+                                                "'of_controller_nets_with_same_vlan' is active")
+            else:
+                raise SdnConnectorError('Only ELINE or ELAN network types are supported for openflow')
+
+            # Get the existing flows at openflow controller
+            step = "Getting installed openflow rules"
+            existing_flows = self.of_connector.get_of_rules()
+            existing_flows_ids = [flow["name"] for flow in existing_flows]
+
+            # calculate new flows to be inserted
+            step = "Compute needed openflow rules"
+            new_flows = self._compute_net_flows(net_id, ports)
+
+            name_index = 0
+            for flow in new_flows:
+                # 1 check if an equal flow is already present
+                index = self._check_flow_already_present(flow, existing_flows)
+                if index >= 0:
+                    flow_id = existing_flows[index]["name"]
+                    self.logger.debug("Skipping already present flow %s", str(flow))
+                else:
+                    # 2 look for a non used name
+                    flow_name = flow["net_id"] + "." + str(name_index)
+                    while flow_name in existing_flows_ids:
+                        name_index += 1
+                        flow_name = flow["net_id"] + "." + str(name_index)
+                    flow['name'] = flow_name
+                    # 3 insert at openflow
+                    try:
+                        self.of_connector.new_flow(flow)
+                        flow_id = flow["name"]
+                        existing_flows_ids.append(flow_id)
+                    except OpenflowConnException as e:
+                        flow_id = None
+                        error_list.append("Cannot create rule for ingress_port={}, dst_mac={}: {}"
+                                          .format(flow["ingress_port"], flow["dst_mac"], e))
+
+                # 4 insert at database
+                if flow_id:
+                    new_installed_rules_ids.append(flow_id)
+                    if flow_id in rules_to_delete:
+                        rules_to_delete.remove(flow_id)
+
+            # delete not needed old flows from openflow
+            for flow_id in rules_to_delete:
+                # Delete flow
+                try:
+                    self.of_connector.del_flow(flow_id)
+                except OpenflowConnNotFoundException:
+                    pass
+                except OpenflowConnException as e:
+                    error_text = "Cannot remove rule '{}': {}".format(flow_id, e)
+                    error_list.append(error_text)
+                    self.logger.error(error_text)
+            created_items["installed_rules_ids"] = new_installed_rules_ids
+            if error_list:
+                created_items["error_msg"] = ";".join(error_list)[:1000]
+                created_items["error_msg"] = "ERROR"
+            else:
+                created_items["error_msg"] = None
+                created_items["status"] = "ACTIVE"
+            return created_items
+        except (SdnConnectorError, OpenflowConnException) as e:
+            raise SdnConnectorError("Error while {}: {}".format(step, e)) from e
+        except Exception as e:
+            error_text = "Error while {}: {}".format(step, e)
+            self.logger.critical(error_text, exc_info=True)
+            raise SdnConnectorError(error_text)
+
+    def _compute_net_flows(self, net_id, ports):
+        new_flows = []
+        new_broadcast_flows = {}
+        nb_ports = len(ports)
+
+        # Check switch_port information is right
+        for port in ports:
+            nb_ports += 1
+            if str(port['switch_port']) not in self.of_connector.pp2ofi:
+                raise SdnConnectorError("switch port name '{}' is not valid for the openflow controller".
+                                        format(port['switch_port']))
+        priority = 1000  # 1100
+
+        for src_port in ports:
+            # if src_port.get("groups")
+            vlan_in = src_port['vlan']
+
+            # BROADCAST:
+            broadcast_key = src_port['uuid'] + "." + str(vlan_in)
+            if broadcast_key in new_broadcast_flows:
+                flow_broadcast = new_broadcast_flows[broadcast_key]
+            else:
+                flow_broadcast = {'priority': priority,
+                                  'net_id': net_id,
+                                  'dst_mac': 'ff:ff:ff:ff:ff:ff',
+                                  "ingress_port": str(src_port['switch_port']),
+                                  'vlan_id': vlan_in,
+                                  'actions': []
+                                  }
+                new_broadcast_flows[broadcast_key] = flow_broadcast
+                if vlan_in is not None:
+                    flow_broadcast['vlan_id'] = str(vlan_in)
+
+            for dst_port in ports:
+                vlan_out = dst_port['vlan']
+                if src_port['switch_port'] == dst_port['switch_port'] and vlan_in == vlan_out:
+                    continue
+                flow = {
+                    "priority": priority,
+                    'net_id': net_id,
+                    "ingress_port": str(src_port['switch_port']),
+                    'vlan_id': vlan_in,
+                    'actions': []
+                }
+                # allow that one port have no mac
+                if dst_port['mac'] is None or nb_ports == 2:  # point to point or nets with 2 elements
+                    flow['priority'] = priority - 5  # less priority
+                else:
+                    flow['dst_mac'] = str(dst_port['mac'])
+
+                if vlan_out is None:
+                    if vlan_in:
+                        flow['actions'].append(('vlan', None))
+                else:
+                    flow['actions'].append(('vlan', vlan_out))
+                flow['actions'].append(('out', str(dst_port['switch_port'])))
+
+                if self._check_flow_already_present(flow, new_flows) >= 0:
+                    self.logger.debug("Skipping repeated flow '%s'", str(flow))
+                    continue
+
+                new_flows.append(flow)
+
+                # BROADCAST:
+                if nb_ports <= 2:  # point to multipoint or nets with more than 2 elements
+                    continue
+                out = (vlan_out, str(dst_port['switch_port']))
+                if out not in flow_broadcast['actions']:
+                    flow_broadcast['actions'].append(out)
+
+        # BROADCAST
+        for flow_broadcast in new_broadcast_flows.values():
+            if len(flow_broadcast['actions']) == 0:
+                continue  # nothing to do, skip
+            flow_broadcast['actions'].sort()
+            if 'vlan_id' in flow_broadcast:
+                previous_vlan = 0  # indicates that a packet contains a vlan, and the vlan
+            else:
+                previous_vlan = None
+            final_actions = []
+            action_number = 0
+            for action in flow_broadcast['actions']:
+                if action[0] != previous_vlan:
+                    final_actions.append(('vlan', action[0]))
+                    previous_vlan = action[0]
+                    if self.of_controller_nets_with_same_vlan and action_number:
+                        raise SdnConnectorError("Cannot interconnect different vlan tags in a network when flag "
+                                                "'of_controller_nets_with_same_vlan' is True.")
+                    action_number += 1
+                final_actions.append(('out', action[1]))
+            flow_broadcast['actions'] = final_actions
+
+            if self._check_flow_already_present(flow_broadcast, new_flows) >= 0:
+                self.logger.debug("Skipping repeated flow '%s'", str(flow_broadcast))
+                continue
+
+            new_flows.append(flow_broadcast)
+
+        # UNIFY openflow rules with the same input port and vlan and the same output actions
+        # These flows differ at the dst_mac; and they are unified by not filtering by dst_mac
+        # this can happen if there is only two ports. It is converted to a point to point connection
+        flow_dict = {}  # use as key vlan_id+ingress_port and as value the list of flows matching these values
+        for flow in new_flows:
+            key = str(flow.get("vlan_id")) + ":" + flow["ingress_port"]
+            if key in flow_dict:
+                flow_dict[key].append(flow)
+            else:
+                flow_dict[key] = [flow]
+        new_flows2 = []
+        for flow_list in flow_dict.values():
+            convert2ptp = False
+            if len(flow_list) >= 2:
+                convert2ptp = True
+                for f in flow_list:
+                    if f['actions'] != flow_list[0]['actions']:
+                        convert2ptp = False
+                        break
+            if convert2ptp:  # add only one unified rule without dst_mac
+                self.logger.debug("Convert flow rules to NON mac dst_address " + str(flow_list))
+                flow_list[0].pop('dst_mac')
+                flow_list[0]["priority"] -= 5
+                new_flows2.append(flow_list[0])
+            else:  # add all the rules
+                new_flows2 += flow_list
+        return new_flows2
+
+    def _check_flow_already_present(self, new_flow, flow_list):
+        '''check if the same flow is already present in the flow list
+        The flow is repeated if all the fields, apart from name, are equal
+        Return the index of matching flow, -1 if not match'''
+        for index, flow in enumerate(flow_list):
+            for f in self.flow_fields:
+                if flow.get(f) != new_flow.get(f):
+                    break
+            else:
+                return index
+        return -1
diff --git a/RO-plugin/osm_ro_plugin/sdn_dummy.py b/RO-plugin/osm_ro_plugin/sdn_dummy.py
new file mode 100644 (file)
index 0000000..619a679
--- /dev/null
@@ -0,0 +1,144 @@
+# -*- coding: utf-8 -*-
+##
+# Copyright 2018 Telefonica
+# All Rights Reserved.
+#
+# 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.
+
+"""
+This WIM does nothing and allows using it for testing and when no WIM is needed
+"""
+
+import logging
+from uuid import uuid4
+from osm_ro_plugin.sdnconn import SdnConnectorBase, SdnConnectorError
+from http import HTTPStatus
+__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
+
+
+class SdnDummyConnector(SdnConnectorBase):
+    """Abstract base class for all the WIM connectors
+
+    Arguments:
+        wim (dict): WIM record, as stored in the database
+        wim_account (dict): WIM account record, as stored in the database
+        config (dict): optional persistent information related to an specific
+            connector.  Inside this dict, a special key,
+            ``service_endpoint_mapping`` provides the internal endpoint
+            mapping.
+        logger (logging.Logger): optional logger object. If none is passed
+            ``openmano.wim.wimconn`` is used.
+
+    The arguments of the constructor are converted to object attributes.
+    An extra property, ``service_endpoint_mapping`` is created from ``config``.
+    """
+    def __init__(self, wim, wim_account, config=None, logger=None):
+        self.logger = logger or logging.getLogger('openmano.sdnconn.dummy')
+        super(SdnDummyConnector, self).__init__(wim, wim_account, config, self.logger)
+        self.logger.debug("__init: wim='{}' wim_account='{}'".format(wim, wim_account))
+        self.connections = {}
+        self.counter = 0
+
+    def check_credentials(self):
+        """Check if the connector itself can access the WIM.
+
+        Raises:
+            SdnConnectorError: Issues regarding authorization, access to
+                external URLs, etc are detected.
+        """
+        self.logger.debug("check_credentials")
+        return None
+
+    def get_connectivity_service_status(self, service_uuid, conn_info=None):
+        """Monitor the status of the connectivity service established
+
+        Arguments:
+            service_uuid (str): UUID of the connectivity service
+            conn_info (dict or None): Information returned by the connector
+                during the service creation/edition and subsequently stored in
+                the database.
+
+        Returns:
+            dict: JSON/YAML-serializable dict that contains a mandatory key
+                ``sdn_status`` associated with one of the following values::
+
+                Additionally ``error_msg``(**str**) and ``sdn_info``(**dict**)
+                keys can be used to provide additional status explanation or
+                new information available for the connectivity service.
+        """
+        self.logger.debug("get_connectivity_service_status: service_uuid='{}' conn_info='{}'".format(service_uuid,
+                                                                                                     conn_info))
+        return {'sdn_status': 'ACTIVE', 'sdn_info': self.connectivity.get(service_uuid)}
+
+    def create_connectivity_service(self, service_type, connection_points,
+                                    **kwargs):
+        """
+        Stablish WAN connectivity between the endpoints
+
+        """
+        self.logger.debug("create_connectivity_service: service_type='{}' connection_points='{}', kwargs='{}'".
+                          format(service_type, connection_points, kwargs))
+        _id = str(uuid4())
+        self.connections[_id] = connection_points.copy()
+        self.counter += 1
+        return _id, None
+
+    def delete_connectivity_service(self, service_uuid, conn_info=None):
+        """Disconnect multi-site endpoints previously connected
+
+        """
+        self.logger.debug("delete_connectivity_service: service_uuid='{}' conn_info='{}'".format(service_uuid,
+                                                                                                 conn_info))
+        if service_uuid not in self.connections:
+            raise SdnConnectorError("connectivity {} not found".format(service_uuid),
+                                    http_code=HTTPStatus.NOT_FOUND.value)
+        self.connections.pop(service_uuid, None)
+        return None
+
+    def edit_connectivity_service(self, service_uuid, conn_info=None,
+                                  connection_points=None, **kwargs):
+        """Change an existing connectivity service.
+
+        This method's arguments and return value follow the same convention as
+        :meth:`~.create_connectivity_service`.
+        """
+        self.logger.debug("edit_connectivity_service: service_uuid='{}' conn_info='{}', connection_points='{}'"
+                          "kwargs='{}'".format(service_uuid, conn_info, connection_points, kwargs))
+        if service_uuid not in self.connections:
+            raise SdnConnectorError("connectivity {} not found".format(service_uuid),
+                                    http_code=HTTPStatus.NOT_FOUND.value)
+        self.connections[service_uuid] = connection_points.copy()
+        return None
+
+    def clear_all_connectivity_services(self):
+        """Delete all WAN Links in a WIM.
+
+        This method is intended for debugging only, and should delete all the
+        connections controlled by the WIM, not only the WIM connections that
+        a specific RO is aware of.
+
+        """
+        self.logger.debug("clear_all_connectivity_services")
+        self.connections.clear()
+        return None
+
+    def get_all_active_connectivity_services(self):
+        """Provide information about all active connections provisioned by a
+        WIM.
+
+        Raises:
+            SdnConnectorException: In case of error.
+        """
+        self.logger.debug("get_all_active_connectivity_services")
+        return self.connections
diff --git a/RO-plugin/osm_ro_plugin/sdn_failing.py b/RO-plugin/osm_ro_plugin/sdn_failing.py
new file mode 100644 (file)
index 0000000..b8ea42f
--- /dev/null
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+##
+# Copyright 2018 University of Bristol - High Performance Networks Research
+# Group
+# All Rights Reserved.
+#
+# Contributors: Anderson Bravalheri, Dimitrios Gkounis, Abubakar Siddique
+# Muqaddas, Navdeep Uniyal, Reza Nejabati and Dimitra Simeonidou
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: <highperformance-networks@bristol.ac.uk>
+#
+# Neither the name of the University of Bristol nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# This work has been performed in the context of DCMS UK 5G Testbeds
+# & Trials Programme and in the framework of the Metro-Haul project -
+# funded by the European Commission under Grant number 761727 through the
+# Horizon 2020 and 5G-PPP programmes.
+##
+
+"""In the case any error happens when trying to initiate the WIM Connector,
+we need a replacement for it, that will throw an error every time we try to
+execute any action
+"""
+import json
+from osm_ro_plugin.sdnconn import SdnConnectorError
+
+
+class SdnFailingConnector(object):
+    """Placeholder for a connector whose incitation failed,
+    This place holder will just raise an error every time an action is needed
+    from the connector.
+
+    This way we can make sure that all the other parts of the program will work
+    but the user will have all the information available to fix the problem.
+    """
+    def __init__(self, error_msg):
+        self.error_msg = error_msg
+
+    def __call__(self, wim, wim_account, config=None, logger=None):
+        return self
+
+    def vimconnector(self, *args, **kwargs):
+        raise Exception(self.error_msg)
+
+    def check_credentials(self):
+        raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)
+
+    def get_connectivity_service_status(self, service_uuid, _conn_info=None):
+        raise SdnConnectorError('Impossible to retrieve status for {}\n\n{}'
+                                .format(service_uuid, self.error_msg))
+
+    def create_connectivity_service(self, service_uuid, *args, **kwargs):
+        raise SdnConnectorError('Impossible to connect {}.\n{}\n{}\n{}'
+                                .format(service_uuid, self.error_msg,
+                                        json.dumps(args, indent=4),
+                                        json.dumps(kwargs, indent=4)))
+
+    def delete_connectivity_service(self, service_uuid, _conn_info=None):
+        raise SdnConnectorError('Impossible to disconnect {}\n\n{}'
+                                .format(service_uuid, self.error_msg))
+
+    def edit_connectivity_service(self, service_uuid, *args, **kwargs):
+        raise SdnConnectorError('Impossible to change connection {}.\n{}\n'
+                                '{}\n{}'
+                                .format(service_uuid, self.error_msg,
+                                        json.dumps(args, indent=4),
+                                        json.dumps(kwargs, indent=4)))
+
+    def clear_all_connectivity_services(self):
+        raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)
+
+    def get_all_active_connectivity_services(self):
+        raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)
diff --git a/RO-plugin/osm_ro_plugin/sdnconn.py b/RO-plugin/osm_ro_plugin/sdnconn.py
new file mode 100644 (file)
index 0000000..b7b1faa
--- /dev/null
@@ -0,0 +1,240 @@
+# -*- coding: utf-8 -*-
+##
+# Copyright 2018 University of Bristol - High Performance Networks Research
+# Group
+# All Rights Reserved.
+#
+# Contributors: Anderson Bravalheri, Dimitrios Gkounis, Abubakar Siddique
+# Muqaddas, Navdeep Uniyal, Reza Nejabati and Dimitra Simeonidou
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: <highperformance-networks@bristol.ac.uk>
+#
+# Neither the name of the University of Bristol nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# This work has been performed in the context of DCMS UK 5G Testbeds
+# & Trials Programme and in the framework of the Metro-Haul project -
+# funded by the European Commission under Grant number 761727 through the
+# Horizon 2020 and 5G-PPP programmes.
+##
+"""The SDN connector is responsible for establishing both wide area network connectivity (WIM)
+and intranet SDN connectivity.
+
+It receives information from ports to be connected .
+"""
+import logging
+from http import HTTPStatus
+
+
+class SdnConnectorError(Exception):
+    """Base Exception for all connector related errors
+        provide the parameter 'http_code' (int) with the error code:
+            Bad_Request = 400
+            Unauthorized = 401  (e.g. credentials are not valid)
+            Not_Found = 404    (e.g. try to edit or delete a non existing connectivity service)
+            Forbidden = 403
+            Method_Not_Allowed = 405
+            Not_Acceptable = 406
+            Request_Timeout = 408  (e.g timeout reaching server, or cannot reach the server)
+            Conflict = 409
+            Service_Unavailable = 503
+            Internal_Server_Error = 500
+    """
+    def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value):
+        Exception.__init__(self, message)
+        self.http_code = http_code
+
+
+class SdnConnectorBase(object):
+    """Abstract base class for all the SDN connectors
+
+    Arguments:
+        wim (dict): WIM record, as stored in the database
+        wim_account (dict): WIM account record, as stored in the database
+        config
+    The arguments of the constructor are converted to object attributes.
+    An extra property, ``service_endpoint_mapping`` is created from ``config``.
+    """
+    def __init__(self, wim, wim_account, config=None, logger=None):
+        """
+
+        :param wim: (dict). Contains among others 'wim_url'
+        :param wim_account: (dict). Contains among others 'uuid' (internal id), 'name',
+            'sdn' (True if is intended for SDN-assist or False if intended for WIM), 'user', 'password'.
+        :param config: (dict or None): Particular information of plugin. These keys if present have a common meaning:
+            'mapping_not_needed': (bool) False by default or if missing, indicates that mapping is not needed.
+            'service_endpoint_mapping': (list) provides the internal endpoint mapping. The meaning is:
+                KEY                    meaning for WIM                 meaning for SDN assist
+                --------                --------                    --------
+                device_id                      pop_switch_dpid                 compute_id
+                device_interface_id            pop_switch_port                 compute_pci_address
+                service_endpoint_id        wan_service_endpoint_id     SDN_service_endpoint_id
+                service_mapping_info   wan_service_mapping_info    SDN_service_mapping_info
+                    contains extra information if needed. Text in Yaml format
+                switch_dpid                    wan_switch_dpid                 SDN_switch_dpid
+                switch_port                    wan_switch_port                 SDN_switch_port
+                datacenter_id           vim_account                 vim_account
+                id: (internal, do not use)
+                wim_id: (internal, do not use)
+        :param logger (logging.Logger): optional logger object. If none is passed 'openmano.sdn.sdnconn' is used.
+        """
+        self.logger = logger or logging.getLogger('openmano.sdnconn')
+
+        self.wim = wim
+        self.wim_account = wim_account
+        self.config = config or {}
+        self.service_endpoint_mapping = (
+            self.config.get('service_endpoint_mapping', []))
+
+    def check_credentials(self):
+        """Check if the connector itself can access the SDN/WIM with the provided url (wim.wim_url),
+            user (wim_account.user), and password (wim_account.password)
+
+        Raises:
+            SdnConnectorError: Issues regarding authorization, access to
+                external URLs, etc are detected.
+        """
+        raise NotImplementedError
+
+    def get_connectivity_service_status(self, service_uuid, conn_info=None):
+        """Monitor the status of the connectivity service established
+
+        Arguments:
+            service_uuid (str): UUID of the connectivity service
+            conn_info (dict or None): Information returned by the connector
+                during the service creation/edition and subsequently stored in
+                the database.
+
+        Returns:
+            dict: JSON/YAML-serializable dict that contains a mandatory key
+                ``sdn_status`` associated with one of the following values::
+
+                    {'sdn_status': 'ACTIVE'}
+                        # The service is up and running.
+
+                    {'sdn_status': 'INACTIVE'}
+                        # The service was created, but the connector
+                        # cannot determine yet if connectivity exists
+                        # (ideally, the caller needs to wait and check again).
+
+                    {'sdn_status': 'DOWN'}
+                        # Connection was previously established,
+                        # but an error/failure was detected.
+
+                    {'sdn_status': 'ERROR'}
+                        # An error occurred when trying to create the service/
+                        # establish the connectivity.
+
+                    {'sdn_status': 'BUILD'}
+                        # Still trying to create the service, the caller
+                        # needs to wait and check again.
+
+                Additionally ``error_msg``(**str**) and ``sdn_info``(**dict**)
+                keys can be used to provide additional status explanation or
+                new information available for the connectivity service.
+        """
+        raise NotImplementedError
+
+    def create_connectivity_service(self, service_type, connection_points, **kwargs):
+        """
+        Stablish SDN/WAN connectivity between the endpoints
+        :param service_type: (str): ``ELINE`` (L2), ``ELAN`` (L2), ``ETREE`` (L2), ``L3``.
+        :param connection_points:  (list): each point corresponds to
+            an entry point to be connected. For WIM: from the DC to the transport network.
+            For SDN: Compute/PCI to the transport network. One
+            connection point serves to identify the specific access and
+            some other service parameters, such as encapsulation type.
+            Each item of the list is a dict with:
+                "service_endpoint_id": (str)(uuid)  Same meaning that for 'service_endpoint_mapping' (see __init__)
+                    In case the config attribute mapping_not_needed is True, this value is not relevant. In this case
+                    it will contain the string "device_id:device_interface_id"
+                "service_endpoint_encapsulation_type": None, "dot1q", ...
+                "service_endpoint_encapsulation_info": (dict) with:
+                    "vlan": ..., (int, present if encapsulation is dot1q)
+                    "vni": ... (int, present if encapsulation is vxlan),
+                    "peers": [(ipv4_1), (ipv4_2)] (present if encapsulation is vxlan)
+                    "mac": ...
+                    "device_id": ..., same meaning that for 'service_endpoint_mapping' (see __init__)
+                    "device_interface_id": same meaning that for 'service_endpoint_mapping' (see __init__)
+                    "switch_dpid": ..., present if mapping has been found for this device_id,device_interface_id
+                    "swith_port": ... present if mapping has been found for this device_id,device_interface_id
+                    "service_mapping_info": present if mapping has been found for this device_id,device_interface_id
+        :param kwargs: For future versions:
+            bandwidth (int): value in kilobytes
+            latency (int): value in milliseconds
+            Other QoS might be passed as keyword arguments.
+        :return: tuple: ``(service_id, conn_info)`` containing:
+            - *service_uuid* (str): UUID of the established connectivity service
+            - *conn_info* (dict or None): Information to be stored at the database (or ``None``).
+                This information will be provided to the :meth:`~.edit_connectivity_service` and :obj:`~.delete`.
+                **MUST** be JSON/YAML-serializable (plain data structures).
+        :raises: SdnConnectorException: In case of error. Nothing should be created in this case.
+            Provide the parameter http_code
+        """
+        raise NotImplementedError
+
+    def delete_connectivity_service(self, service_uuid, conn_info=None):
+        """
+        Disconnect multi-site endpoints previously connected
+
+        :param service_uuid: The one returned by create_connectivity_service
+        :param conn_info: The one returned by last call to 'create_connectivity_service' or 'edit_connectivity_service'
+            if they do not return None
+        :return: None
+        :raises: SdnConnectorException: In case of error. The parameter http_code must be filled
+        """
+        raise NotImplementedError
+
+    def edit_connectivity_service(self, service_uuid, conn_info=None, connection_points=None, **kwargs):
+        """ Change an existing connectivity service.
+
+        This method's arguments and return value follow the same convention as
+        :meth:`~.create_connectivity_service`.
+
+        :param service_uuid: UUID of the connectivity service.
+        :param conn_info: (dict or None): Information previously returned by last call to create_connectivity_service
+            or edit_connectivity_service
+        :param connection_points: (list): If provided, the old list of connection points will be replaced.
+        :param kwargs: Same meaning that create_connectivity_service
+        :return: dict or None: Information to be updated and stored at the database.
+                When ``None`` is returned, no information should be changed.
+                When an empty dict is returned, the database record will be deleted.
+                **MUST** be JSON/YAML-serializable (plain data structures).
+        Raises:
+            SdnConnectorException: In case of error.
+        """
+
+    def clear_all_connectivity_services(self):
+        """Delete all WAN Links in a WIM.
+
+        This method is intended for debugging only, and should delete all the
+        connections controlled by the WIM/SDN, not only the  connections that
+        a specific RO is aware of.
+
+        Raises:
+            SdnConnectorException: In case of error.
+        """
+        raise NotImplementedError
+
+    def get_all_active_connectivity_services(self):
+        """Provide information about all active connections provisioned by a
+        WIM.
+
+        Raises:
+            SdnConnectorException: In case of error.
+        """
+        raise NotImplementedError
diff --git a/RO-plugin/osm_ro_plugin/vim_dummy.py b/RO-plugin/osm_ro_plugin/vim_dummy.py
new file mode 100644 (file)
index 0000000..8154304
--- /dev/null
@@ -0,0 +1,281 @@
+# -*- coding: utf-8 -*-
+
+##
+# Copyright 2020 Telefonica Investigacion y Desarrollo, S.A.U.
+#
+# 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.
+##
+
+"""
+Implements a Dummy vim plugin.
+"""
+
+import yaml
+from osm_ro_plugin import vimconn
+from uuid import uuid4
+from copy import deepcopy
+
+__author__ = "Alfonso Tierno"
+__date__  = "2020-04-20"
+
+
+class VimDummyConnector(vimconn.VimConnector):
+    """Dummy vim connector that does nothing
+    Provide config with:
+        vm_ip: ip address to provide at VM creation. For some tests must be a valid reachable VM
+        ssh_key: private ssh key to use for inserting an authorized ssh key
+    """
+    def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
+                 config={}, persistent_info={}):
+        super().__init__(uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
+                         config, persistent_info)
+        self.nets = {
+            "mgmt": {
+                "id": "mgmt",
+                "name": "mgmt",
+                "status": "ACTIVE",
+                "vim_info": '{status: ACTIVE}'
+            }
+        }
+        self.vms = {}
+        self.flavors = {}
+        self.tenants = {}
+        # preload some images
+        self.images = {
+            "90681b39-dc09-49b7-ba2e-2c00c6b33b76": {
+                "id": "90681b39-dc09-49b7-ba2e-2c00c6b33b76",
+                "name": "cirros034",
+                "checksum": "ee1eca47dc88f4879d8a229cc70a07c6"
+            },
+            "83a39656-65db-47dc-af03-b55289115a53": {
+                "id": "",
+                "name": "cirros040",
+                "checksum": "443b7623e27ecf03dc9e01ee93f67afe"
+            },
+            "208314f2-8eb6-4101-965d-fe2ffbaedf3c": {
+                "id": "208314f2-8eb6-4101-965d-fe2ffbaedf3c",
+                "name": "ubuntu18.04",
+                "checksum": "b6fc7b9b91bca32e989e1edbcdeecb95"
+            },
+            "c03321f8-4b6e-4045-a309-1b3878bd32c1": {
+                "id": "c03321f8-4b6e-4045-a309-1b3878bd32c1",
+                "name": "ubuntu16.04",
+                "checksum": "8f08442faebad2d4a99fedb22fca11b5"
+            },
+            "4f6399a2-3554-457e-916e-ada01f8b950b": {
+                "id": "4f6399a2-3554-457e-916e-ada01f8b950b",
+                "name": "ubuntu1604",
+                "checksum": "8f08442faebad2d4a99fedb22fca11b5"
+            },
+            "59ac0b79-5c7d-4e83-b517-4c6c6a8ac1d3": {
+                "id": "59ac0b79-5c7d-4e83-b517-4c6c6a8ac1d3",
+                "name": "hackfest3-mgmt",
+                "checksum": "acec1e5d5ad7be9be7e6342a16bcf66a"
+            },
+            "f8818a03-f099-4c18-b1c7-26b1324203c1": {
+                "id": "f8818a03-f099-4c18-b1c7-26b1324203c1",
+                "name": "hackfest-pktgen",
+                "checksum": "f8818a03-f099-4c18-b1c7-26b1324203c1"
+            },
+        }
+
+    def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
+        net_id = str(uuid4())
+        net = {
+            "id": net_id,
+            "name": net_name,
+            "net_type": net_type,
+            "status": "ACTIVE",
+        }
+        self.nets[net_id] = net
+        return net_id, net
+
+    def get_network_list(self, filter_dict=None):
+        nets = []
+        for net_id, net in self.nets.items():
+            if filter_dict and filter_dict.get("name"):
+                if net["name"] != filter_dict.get("name"):
+                    continue
+            if filter_dict and filter_dict.get("id"):
+                if net_id != filter_dict.get("id"):
+                    continue
+            nets.append(net)
+        return nets
+
+    def get_network(self, net_id):
+        if net_id not in self.nets:
+            raise vimconn.VimConnNotFoundException("network with id {} not found".format(net_id))
+        return self.nets[net_id]
+
+    def delete_network(self, net_id, created_items=None):
+        if net_id not in self.nets:
+            raise vimconn.VimConnNotFoundException("network with id {} not found".format(net_id))
+        return net_id
+        self.nets.pop(net_id)
+
+    def refresh_nets_status(self, net_list):
+        nets = {}
+        for net_id in net_list:
+            if net_id not in self.nets:
+                net = {"status": "DELETED"}
+            else:
+                net = self.nets[net_id].copy()
+                net["vim_info"] = yaml.dump({"status": "ACTIVE", "name": net["name"]},
+                                                 default_flow_style=True, width=256)
+            nets[net_id] = net
+
+        return nets
+
+    def get_flavor(self, flavor_id):
+        if flavor_id not in self.flavors:
+            raise vimconn.VimConnNotFoundException("flavor with id {} not found".format(flavor_id))
+        return self.flavors[flavor_id]
+
+    def new_flavor(self, flavor_data):
+        flavor_id = str(uuid4())
+        flavor = deepcopy(flavor_data)
+        flavor["id"] = flavor_id
+        if "name" not in flavor:
+            flavor["name"] = flavor_id
+        self.flavors[flavor_id] = flavor
+        return flavor_id
+
+    def delete_flavor(self, flavor_id):
+        if flavor_id not in self.flavors:
+            raise vimconn.VimConnNotFoundException("flavor with id {} not found".format(flavor_id))
+        return flavor_id
+        self.flavors.pop(flavor_id)
+
+    def get_flavor_id_from_data(self, flavor_dict):
+        for flavor_id, flavor_data in self.flavors.items():
+            for k in ("ram", "vcpus", "disk", "extended"):
+                if flavor_data.get(k) != flavor_dict.get(k):
+                    break
+            else:
+                return flavor_id
+        raise vimconn.VimConnNotFoundException("flavor with ram={}  cpu={} disk={} {} not found".format(
+            flavor_dict["ram"], flavor_dict["vcpus"], flavor_dict["disk"],
+            "and extended" if flavor_dict.get("extended") else ""))
+
+    def new_tenant(self, tenant_name, tenant_description):
+        tenant_id = str(uuid4())
+        tenant = {'name': tenant_name, 'description': tenant_description, 'id': tenant_id}
+        self.tenants[tenant_id] = tenant
+        return tenant_id
+
+    def delete_tenant(self, tenant_id):
+        if tenant_id not in self.tenants:
+            raise vimconn.VimConnNotFoundException("tenant with id {} not found".format(tenant_id))
+        return tenant_id
+        self.tenants.pop(tenant_id)
+
+    def get_tenant_list(self, filter_dict=None):
+        tenants = []
+        for tenant_id, tenant in self.tenants.items():
+            if filter_dict and filter_dict.get("name"):
+                if tenant["name"] != filter_dict.get("name"):
+                    continue
+            if filter_dict and filter_dict.get("id"):
+                if tenant_id != filter_dict.get("id"):
+                    continue
+            tenants.append(tenant)
+        return tenants
+
+    def new_image(self, image_dict):
+        image_id = str(uuid4())
+        image = deepcopy(image_dict)
+        image["id"] = image_id
+        if "name" not in image:
+            image["id"] = image_id
+        self.images[image_id] = image
+        return image_id
+
+    def delete_image(self, image_id):
+        if image_id not in self.images:
+            raise vimconn.VimConnNotFoundException("image with id {} not found".format(image_id))
+        return image_id
+        self.images.pop(image_id)
+
+    def get_image_list(self, filter_dict=None):
+        images = []
+        for image_id, image in self.images.items():
+            if filter_dict and filter_dict.get("name"):
+                if image["name"] != filter_dict.get("name"):
+                    continue
+            if filter_dict and filter_dict.get("checksum"):
+                if image["checksum"] != filter_dict.get("checksum"):
+                    continue
+            if filter_dict and filter_dict.get("id"):
+                if image_id != filter_dict.get("id"):
+                    continue
+            images.append(image)
+        return images
+
+    def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
+        availability_zone_index=None, availability_zone_list=None):
+        vm_id = str(uuid4())
+        interfaces = []
+        for iface_index, iface in enumerate(net_list):
+            iface["vim_id"] = str(iface_index)
+            interface = {
+                "ip_address": self.config.get("vm_ip") or "192.168.4.2",
+                "vim_interface_id": str(iface_index),
+                "vim_net_id": iface["net_id"],
+            }
+            interfaces.append(interface)
+        vm = {
+            "id": vm_id,
+            "name": name,
+            "status": "ACTIVE",
+            "description": description,
+            "interfaces": interfaces,
+            "image_id": image_id,
+            "flavor_id": flavor_id,
+        }
+        if image_id not in self.images:
+            self.logger.error("vm create, image_id '{}' not found. Skip".format(image_id))
+        if flavor_id not in self.flavors:
+            self.logger.error("vm create flavor_id '{}' not found. Skip".format(flavor_id))
+        self.vms[vm_id] = vm
+        return vm_id, vm
+
+    def get_vminstance(self, vm_id):
+        if vm_id not in self.vms:
+            raise vimconn.VimConnNotFoundException("vm with id {} not found".format(vm_id))
+        return self.vms[vm_id]
+
+    def delete_vminstance(self, vm_id, created_items=None):
+        if vm_id not in self.vms:
+            raise vimconn.VimConnNotFoundException("vm with id {} not found".format(vm_id))
+        return vm_id
+        self.vms.pop(vm_id)
+
+    def refresh_vms_status(self, vm_list):
+        vms = {}
+        for vm_id in vm_list:
+            if vm_id not in self.vms:
+                vm = {"status": "DELETED"}
+            else:
+                vm = deepcopy(self.vms[vm_id])
+                vm["vim_info"] = yaml.dump({"status": "ACTIVE", "name": vm["name"]},
+                                            default_flow_style=True, width=256)
+            vms[vm_id] = vm
+        return vms
+
+    def action_vminstance(self, vm_id, action_dict, created_items={}):
+        return None
+
+    def inject_user_key(self, ip_addr=None, user=None, key=None, ro_key=None, password=None):
+        if self.config.get("ssh_key"):
+            ro_key = self.config.get("ssh_key")
+        return super().inject_user_key(ip_addr=ip_addr, user=user, key=key, ro_key=ro_key, password=password)
diff --git a/RO-plugin/osm_ro_plugin/vimconn.py b/RO-plugin/osm_ro_plugin/vimconn.py
new file mode 100644 (file)
index 0000000..dd60e46
--- /dev/null
@@ -0,0 +1,1003 @@
+# -*- coding: utf-8 -*-
+
+##
+# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U.
+# This file is part of openmano
+# All Rights Reserved.
+#
+# 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.
+#
+# For those usages not covered by the Apache License, Version 2.0 please
+# contact with: nfvlabs@tid.es
+##
+
+"""
+vimconn implement an Abstract class for the vim connector plugins
+ with the definition of the method to be implemented.
+"""
+
+import logging
+import paramiko
+import socket
+from io import StringIO
+import yaml
+import sys
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+from http import HTTPStatus
+import warnings
+
+__author__ = "Alfonso Tierno, Igor D.C."
+__date__ = "$14-aug-2017 23:59:59$"
+
+
+def deprecated(message):
+    def deprecated_decorator(func):
+        def deprecated_func(*args, **kwargs):
+            warnings.warn("{} is a deprecated function. {}".format(func.__name__, message),
+                          category=DeprecationWarning,
+                          stacklevel=2)
+            warnings.simplefilter('default', DeprecationWarning)
+            return func(*args, **kwargs)
+        return deprecated_func
+    return deprecated_decorator
+
+
+# Error variables
+HTTP_Bad_Request = HTTPStatus.BAD_REQUEST.value
+HTTP_Unauthorized = HTTPStatus.UNAUTHORIZED.value
+HTTP_Not_Found = HTTPStatus.NOT_FOUND.value
+HTTP_Method_Not_Allowed = HTTPStatus.METHOD_NOT_ALLOWED.value
+HTTP_Request_Timeout = HTTPStatus.REQUEST_TIMEOUT.value
+HTTP_Conflict = HTTPStatus.CONFLICT.value
+HTTP_Not_Implemented = HTTPStatus.NOT_IMPLEMENTED.value
+HTTP_Service_Unavailable = HTTPStatus.SERVICE_UNAVAILABLE.value
+HTTP_Internal_Server_Error = HTTPStatus.INTERNAL_SERVER_ERROR.value
+
+
+class VimConnException(Exception):
+    """Common and base class Exception for all VimConnector exceptions"""
+    def __init__(self, message, http_code=HTTP_Bad_Request):
+        Exception.__init__(self, message)
+        self.http_code = http_code
+
+
+class VimConnConnectionException(VimConnException):
+    """Connectivity error with the VIM"""
+    def __init__(self, message, http_code=HTTP_Service_Unavailable):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnUnexpectedResponse(VimConnException):
+    """Get an wrong response from VIM"""
+    def __init__(self, message, http_code=HTTP_Service_Unavailable):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnAuthException(VimConnException):
+    """Invalid credentials or authorization to perform this action over the VIM"""
+    def __init__(self, message, http_code=HTTP_Unauthorized):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnNotFoundException(VimConnException):
+    """The item is not found at VIM"""
+    def __init__(self, message, http_code=HTTP_Not_Found):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnConflictException(VimConnException):
+    """There is a conflict, e.g. more item found than one"""
+    def __init__(self, message, http_code=HTTP_Conflict):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnNotSupportedException(VimConnException):
+    """The request is not supported by connector"""
+    def __init__(self, message, http_code=HTTP_Service_Unavailable):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnNotImplemented(VimConnException):
+    """The method is not implemented by the connected"""
+    def __init__(self, message, http_code=HTTP_Not_Implemented):
+        VimConnException.__init__(self, message, http_code)
+
+
+class VimConnector():
+    """Abstract base class for all the VIM connector plugins
+    These plugins must implement a VimConnector class derived from this
+    and all these privated methods
+    """
+    def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
+                 config={}, persistent_info={}):
+        """
+        Constructor of VIM. Raise an exception is some needed parameter is missing, but it must not do any connectivity
+            checking against the VIM
+        :param uuid: internal id of this VIM
+        :param name: name assigned to this VIM, can be used for logging
+        :param tenant_id: 'tenant_id': (only one of them is mandatory) VIM tenant to be used
+        :param tenant_name: 'tenant_name': (only one of them is mandatory) VIM tenant to be used
+        :param url: url used for normal operations
+        :param url_admin: (optional), url used for administrative tasks
+        :param user: user to access
+        :param passwd: password
+        :param log_level: provided if it should use a different log_level than the general one
+        :param config: dictionary with extra VIM information. This contains a consolidate version of VIM config
+                    at VIM_ACCOUNT (attach)
+        :param persitent_info: dict where the class can store information that will be available among class
+                    destroy/creation cycles. This info is unique per VIM/credential. At first call it will contain an
+                    empty dict. Useful to store login/tokens information for speed up communication
+
+        """
+        self.id = uuid
+        self.name = name
+        self.url = url
+        self.url_admin = url_admin
+        self.tenant_id = tenant_id
+        self.tenant_name = tenant_name
+        self.user = user
+        self.passwd = passwd
+        self.config = config or {}
+        self.availability_zone = None
+        self.logger = logging.getLogger('openmano.vim')
+        if log_level:
+            self.logger.setLevel(getattr(logging, log_level))
+        if not self.url_admin:   # try to use normal url
+            self.url_admin = self.url
+
+    def __getitem__(self, index):
+        if index == 'tenant_id':
+            return self.tenant_id
+        if index == 'tenant_name':
+            return self.tenant_name
+        elif index == 'id':
+            return self.id
+        elif index == 'name':
+            return self.name
+        elif index == 'user':
+            return self.user
+        elif index == 'passwd':
+            return self.passwd
+        elif index == 'url':
+            return self.url
+        elif index == 'url_admin':
+            return self.url_admin
+        elif index == "config":
+            return self.config
+        else:
+            raise KeyError("Invalid key '{}'".format(index))
+
+    def __setitem__(self, index, value):
+        if index == 'tenant_id':
+            self.tenant_id = value
+        if index == 'tenant_name':
+            self.tenant_name = value
+        elif index == 'id':
+            self.id = value
+        elif index == 'name':
+            self.name = value
+        elif index == 'user':
+            self.user = value
+        elif index == 'passwd':
+            self.passwd = value
+        elif index == 'url':
+            self.url = value
+        elif index == 'url_admin':
+            self.url_admin = value
+        else:
+            raise KeyError("Invalid key '{}'".format(index))
+
+    @staticmethod
+    def _create_mimemultipart(content_list):
+        """Creates a MIMEmultipart text combining the content_list
+        :param content_list: list of text scripts to be combined
+        :return: str of the created MIMEmultipart. If the list is empty returns None, if the list contains only one
+        element MIMEmultipart is not created and this content is returned
+        """
+        if not content_list:
+            return None
+        elif len(content_list) == 1:
+            return content_list[0]
+        combined_message = MIMEMultipart()
+        for content in content_list:
+            if content.startswith('#include'):
+                mime_format = 'text/x-include-url'
+            elif content.startswith('#include-once'):
+                mime_format = 'text/x-include-once-url'
+            elif content.startswith('#!'):
+                mime_format = 'text/x-shellscript'
+            elif content.startswith('#cloud-config'):
+                mime_format = 'text/cloud-config'
+            elif content.startswith('#cloud-config-archive'):
+                mime_format = 'text/cloud-config-archive'
+            elif content.startswith('#upstart-job'):
+                mime_format = 'text/upstart-job'
+            elif content.startswith('#part-handler'):
+                mime_format = 'text/part-handler'
+            elif content.startswith('#cloud-boothook'):
+                mime_format = 'text/cloud-boothook'
+            else:  # by default
+                mime_format = 'text/x-shellscript'
+            sub_message = MIMEText(content, mime_format, sys.getdefaultencoding())
+            combined_message.attach(sub_message)
+        return combined_message.as_string()
+
+    def _create_user_data(self, cloud_config):
+        """
+        Creates a script user database on cloud_config info
+        :param cloud_config: dictionary with
+            'key-pairs': (optional) list of strings with the public key to be inserted to the default user
+            'users': (optional) list of users to be inserted, each item is a dict with:
+                'name': (mandatory) user name,
+                'key-pairs': (optional) list of strings with the public key to be inserted to the user
+            'user-data': (optional) can be a string with the text script to be passed directly to cloud-init,
+                or a list of strings, each one contains a script to be passed, usually with a MIMEmultipart file
+            'config-files': (optional). List of files to be transferred. Each item is a dict with:
+                'dest': (mandatory) string with the destination absolute path
+                'encoding': (optional, by default text). Can be one of:
+                    'b64', 'base64', 'gz', 'gz+b64', 'gz+base64', 'gzip+b64', 'gzip+base64'
+                'content' (mandatory): string with the content of the file
+                'permissions': (optional) string with file permissions, typically octal notation '0644'
+                'owner': (optional) file owner, string with the format 'owner:group'
+            'boot-data-drive': boolean to indicate if user-data must be passed using a boot drive (hard disk)
+        :return: config_drive, userdata. The first is a boolean or None, the second a string or None
+        """
+        config_drive = None
+        userdata = None
+        userdata_list = []
+        if isinstance(cloud_config, dict):
+            if cloud_config.get("user-data"):
+                if isinstance(cloud_config["user-data"], str):
+                    userdata_list.append(cloud_config["user-data"])
+                else:
+                    for u in cloud_config["user-data"]:
+                        userdata_list.append(u)
+            if cloud_config.get("boot-data-drive") is not None:
+                config_drive = cloud_config["boot-data-drive"]
+            if cloud_config.get("config-files") or cloud_config.get("users") or cloud_config.get("key-pairs"):
+                userdata_dict = {}
+                # default user
+                if cloud_config.get("key-pairs"):
+                    userdata_dict["ssh-authorized-keys"] = cloud_config["key-pairs"]
+                    userdata_dict["users"] = [{"default": None, "ssh-authorized-keys": cloud_config["key-pairs"]}]
+                if cloud_config.get("users"):
+                    if "users" not in userdata_dict:
+                        userdata_dict["users"] = ["default"]
+                    for user in cloud_config["users"]:
+                        user_info = {
+                            "name": user["name"],
+                            "sudo": "ALL = (ALL)NOPASSWD:ALL"
+                        }
+                        if "user-info" in user:
+                            user_info["gecos"] = user["user-info"]
+                        if user.get("key-pairs"):
+                            user_info["ssh-authorized-keys"] = user["key-pairs"]
+                        userdata_dict["users"].append(user_info)
+
+                if cloud_config.get("config-files"):
+                    userdata_dict["write_files"] = []
+                    for file in cloud_config["config-files"]:
+                        file_info = {
+                            "path": file["dest"],
+                            "content": file["content"]
+                        }
+                        if file.get("encoding"):
+                            file_info["encoding"] = file["encoding"]
+                        if file.get("permissions"):
+                            file_info["permissions"] = file["permissions"]
+                        if file.get("owner"):
+                            file_info["owner"] = file["owner"]
+                        userdata_dict["write_files"].append(file_info)
+                userdata_list.append("#cloud-config\n" + yaml.safe_dump(userdata_dict, indent=4,
+                                                                        default_flow_style=False))
+            userdata = self._create_mimemultipart(userdata_list)
+            self.logger.debug("userdata: %s", userdata)
+        elif isinstance(cloud_config, str):
+            userdata = cloud_config
+        return config_drive, userdata
+
+    def check_vim_connectivity(self):
+        """Checks VIM can be reached and user credentials are ok.
+        Returns None if success or raises VimConnConnectionException, VimConnAuthException, ...
+        """
+        # by default no checking until each connector implements it
+        return None
+
+    def get_tenant_list(self, filter_dict={}):
+        """Obtain tenants of VIM
+        filter_dict dictionary that can contain the following keys:
+            name: filter by tenant name
+            id: filter by tenant uuid/id
+            <other VIM specific>
+        Returns the tenant list of dictionaries, and empty list if no tenant match all the filers:
+            [{'name':'<name>, 'id':'<id>, ...}, ...]
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
+        """Adds a tenant network to VIM
+        Params:
+            'net_name': name of the network
+            'net_type': one of:
+                'bridge': overlay isolated network
+                'data':   underlay E-LAN network for Passthrough and SRIOV interfaces
+                'ptp':    underlay E-LINE network for Passthrough and SRIOV interfaces.
+            'ip_profile': is a dict containing the IP parameters of the network
+                'ip_version': can be "IPv4" or "IPv6" (Currently only IPv4 is implemented)
+                'subnet_address': ip_prefix_schema, that is X.X.X.X/Y
+                'gateway_address': (Optional) ip_schema, that is X.X.X.X
+                'dns_address': (Optional) comma separated list of ip_schema, e.g. X.X.X.X[,X,X,X,X]
+                'dhcp_enabled': True or False
+                'dhcp_start_address': ip_schema, first IP to grant
+                'dhcp_count': number of IPs to grant.
+            'shared': if this network can be seen/use by other tenants/organization
+            'provider_network_profile': (optional) contains {segmentation-id: vlan, provider-network: vim_netowrk}
+        Returns a tuple with the network identifier and created_items, or raises an exception on error
+            created_items can be None or a dictionary where this method can include key-values that will be passed to
+            the method delete_network. Can be used to store created segments, created l2gw connections, etc.
+            Format is VimConnector dependent, but do not use nested dictionaries and a value of None should be the same
+            as not present.
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_network_list(self, filter_dict={}):
+        """Obtain tenant networks of VIM
+        Params:
+            'filter_dict' (optional) contains entries to return only networks that matches ALL entries:
+                name: string  => returns only networks with this name
+                id:   string  => returns networks with this VIM id, this imply returns one network at most
+                shared: boolean >= returns only networks that are (or are not) shared
+                tenant_id: sting => returns only networks that belong to this tenant/project
+                ,#(not used yet) admin_state_up: boolean => returns only networks that are (or are not) in admin state
+                    active
+                #(not used yet) status: 'ACTIVE','ERROR',... => filter networks that are on this status
+        Returns the network list of dictionaries. each dictionary contains:
+            'id': (mandatory) VIM network id
+            'name': (mandatory) VIM network name
+            'status': (mandatory) can be 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
+            'network_type': (optional) can be 'vxlan', 'vlan' or 'flat'
+            'segmentation_id': (optional) in case network_type is vlan or vxlan this field contains the segmentation id
+            'error_msg': (optional) text that explains the ERROR status
+            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
+        List can be empty if no network map the filter_dict. Raise an exception only upon VIM connectivity,
+            authorization, or some other unspecific error
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_network(self, net_id):
+        """Obtain network details from the 'net_id' VIM network
+        Return a dict that contains:
+            'id': (mandatory) VIM network id, that is, net_id
+            'name': (mandatory) VIM network name
+            'status': (mandatory) can be 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
+            'error_msg': (optional) text that explains the ERROR status
+            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
+        Raises an exception upon error or when network is not found
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_network(self, net_id, created_items=None):
+        """
+        Removes a tenant network from VIM and its associated elements
+        :param net_id: VIM identifier of the network, provided by method new_network
+        :param created_items: dictionary with extra items to be deleted. provided by method new_network
+        Returns the network identifier or raises an exception upon error or when network is not found
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def refresh_nets_status(self, net_list):
+        """Get the status of the networks
+        Params:
+            'net_list': a list with the VIM network id to be get the status
+        Returns a dictionary with:
+            'net_id':         #VIM id of this network
+                status:     #Mandatory. Text with one of:
+                    #  DELETED (not found at vim)
+                    #  VIM_ERROR (Cannot connect to VIM, authentication problems, VIM response error, ...)
+                    #  OTHER (Vim reported other status not understood)
+                    #  ERROR (VIM indicates an ERROR status)
+                    #  ACTIVE, INACTIVE, DOWN (admin down),
+                    #  BUILD (on building process)
+                error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
+                vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
+            'net_id2': ...
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_flavor(self, flavor_id):
+        """Obtain flavor details from the VIM
+        Returns the flavor dict details {'id':<>, 'name':<>, other vim specific }
+        Raises an exception upon error or if not found
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_flavor_id_from_data(self, flavor_dict):
+        """Obtain flavor id that match the flavor description
+        Params:
+            'flavor_dict': dictionary that contains:
+                'disk': main hard disk in GB
+                'ram': meomry in MB
+                'vcpus': number of virtual cpus
+                #TODO: complete parameters for EPA
+        Returns the flavor_id or raises a VimConnNotFoundException
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_flavor(self, flavor_data):
+        """Adds a tenant flavor to VIM
+            flavor_data contains a dictionary with information, keys:
+                name: flavor name
+                ram: memory (cloud type) in MBytes
+                vpcus: cpus (cloud type)
+                extended: EPA parameters
+                  - numas: #items requested in same NUMA
+                        memory: number of 1G huge pages memory
+                        paired-threads|cores|threads: number of paired hyperthreads, complete cores OR individual
+                            threads
+                        interfaces: # passthrough(PT) or SRIOV interfaces attached to this numa
+                          - name: interface name
+                            dedicated: yes|no|yes:sriov;  for PT, SRIOV or only one SRIOV for the physical NIC
+                            bandwidth: X Gbps; requested guarantee bandwidth
+                            vpci: requested virtual PCI address
+                disk: disk size
+                is_public:
+                 #TODO to concrete
+        Returns the flavor identifier"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_flavor(self, flavor_id):
+        """Deletes a tenant flavor from VIM identify by its id
+        Returns the used id or raise an exception"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_image(self, image_dict):
+        """ Adds a tenant image to VIM
+        Returns the image id or raises an exception if failed
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_image(self, image_id):
+        """Deletes a tenant image from VIM
+        Returns the image_id if image is deleted or raises an exception on error"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_image_id_from_path(self, path):
+        """Get the image id from image path in the VIM database.
+           Returns the image_id or raises a VimConnNotFoundException
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_image_list(self, filter_dict={}):
+        """Obtain tenant images from VIM
+        Filter_dict can be:
+            name: image name
+            id: image uuid
+            checksum: image checksum
+            location: image path
+        Returns the image list of dictionaries:
+            [{<the fields at Filter_dict plus some VIM specific>}, ...]
+            List can be empty
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
+                       availability_zone_index=None, availability_zone_list=None):
+        """Adds a VM instance to VIM
+        Params:
+            'start': (boolean) indicates if VM must start or created in pause mode.
+            'image_id','flavor_id': image and flavor VIM id to use for the VM
+            'net_list': list of interfaces, each one is a dictionary with:
+                'name': (optional) name for the interface.
+                'net_id': VIM network id where this interface must be connect to. Mandatory for type==virtual
+                'vpci': (optional) virtual vPCI address to assign at the VM. Can be ignored depending on VIM 
+                    capabilities
+                'model': (optional and only have sense for type==virtual) interface model: virtio, e1000, ...
+                'mac_address': (optional) mac address to assign to this interface
+                'ip_address': (optional) IP address to assign to this interface
+                #TODO: CHECK if an optional 'vlan' parameter is needed for VIMs when type if VF and net_id is not
+                    provided, the VLAN tag to be used. In case net_id is provided, the internal network vlan is used 
+                    for tagging VF
+                'type': (mandatory) can be one of:
+                    'virtual', in this case always connected to a network of type 'net_type=bridge'
+                     'PCI-PASSTHROUGH' or 'PF' (passthrough): depending on VIM capabilities it can be connected to a
+                        data/ptp network ot it
+                           can created unconnected
+                     'SR-IOV' or 'VF' (SRIOV with VLAN tag): same as PF for network connectivity.
+                     'VFnotShared'(SRIOV without VLAN tag) same as PF for network connectivity. VF where no other VFs
+                            are allocated on the same physical NIC
+                'bw': (optional) only for PF/VF/VFnotShared. Minimal Bandwidth required for the interface in GBPS
+                'port_security': (optional) If False it must avoid any traffic filtering at this interface. If missing
+                                or True, it must apply the default VIM behaviour
+                After execution the method will add the key:
+                'vim_id': must be filled/added by this method with the VIM identifier generated by the VIM for this
+                        interface. 'net_list' is modified
+            'cloud_config': (optional) dictionary with:
+                'key-pairs': (optional) list of strings with the public key to be inserted to the default user
+                'users': (optional) list of users to be inserted, each item is a dict with:
+                    'name': (mandatory) user name,
+                    'key-pairs': (optional) list of strings with the public key to be inserted to the user
+                'user-data': (optional) can be a string with the text script to be passed directly to cloud-init,
+                    or a list of strings, each one contains a script to be passed, usually with a MIMEmultipart file
+                'config-files': (optional). List of files to be transferred. Each item is a dict with:
+                    'dest': (mandatory) string with the destination absolute path
+                    'encoding': (optional, by default text). Can be one of:
+                        'b64', 'base64', 'gz', 'gz+b64', 'gz+base64', 'gzip+b64', 'gzip+base64'
+                    'content' (mandatory): string with the content of the file
+                    'permissions': (optional) string with file permissions, typically octal notation '0644'
+                    'owner': (optional) file owner, string with the format 'owner:group'
+                'boot-data-drive': boolean to indicate if user-data must be passed using a boot drive (hard disk)
+            'disk_list': (optional) list with additional disks to the VM. Each item is a dict with:
+                'image_id': (optional). VIM id of an existing image. If not provided an empty disk must be mounted
+                'size': (mandatory) string with the size of the disk in GB
+            availability_zone_index: Index of availability_zone_list to use for this this VM. None if not AV required
+            availability_zone_list: list of availability zones given by user in the VNFD descriptor.  Ignore if
+                availability_zone_index is None
+        Returns a tuple with the instance identifier and created_items or raises an exception on error
+            created_items can be None or a dictionary where this method can include key-values that will be passed to
+            the method delete_vminstance and action_vminstance. Can be used to store created ports, volumes, etc.
+            Format is VimConnector dependent, but do not use nested dictionaries and a value of None should be the same
+            as not present.
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_vminstance(self, vm_id):
+        """Returns the VM instance information from VIM"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_vminstance(self, vm_id, created_items=None):
+        """
+        Removes a VM instance from VIM and its associated elements
+        :param vm_id: VIM identifier of the VM, provided by method new_vminstance
+        :param created_items: dictionary with extra items to be deleted. provided by method new_vminstance and/or method
+            action_vminstance
+        :return: None or the same vm_id. Raises an exception on fail
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def refresh_vms_status(self, vm_list):
+        """Get the status of the virtual machines and their interfaces/ports
+           Params: the list of VM identifiers
+           Returns a dictionary with:
+                vm_id:          #VIM id of this Virtual Machine
+                    status:     #Mandatory. Text with one of:
+                                #  DELETED (not found at vim)
+                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
+                                #  OTHER (Vim reported other status not understood)
+                                #  ERROR (VIM indicates an ERROR status)
+                                #  ACTIVE, PAUSED, SUSPENDED, INACTIVE (not running),
+                                #  BUILD (on building process), ERROR
+                                #  ACTIVE:NoMgmtIP (Active but any of its interface has an IP address
+                                #
+                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
+                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
+                    interfaces: list with interface info. Each item a dictionary with:
+                        vim_info:         #Text with plain information obtained from vim (yaml.safe_dump)
+                        mac_address:      #Text format XX:XX:XX:XX:XX:XX
+                        vim_net_id:       #network id where this interface is connected, if provided at creation
+                        vim_interface_id: #interface/port VIM id
+                        ip_address:       #null, or text with IPv4, IPv6 address
+                        compute_node:     #identification of compute node where PF,VF interface is allocated
+                        pci:              #PCI address of the NIC that hosts the PF,VF
+                        vlan:             #physical VLAN used for VF
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def action_vminstance(self, vm_id, action_dict, created_items={}):
+        """
+        Send and action over a VM instance. Returns created_items if the action was successfully sent to the VIM.
+        created_items is a dictionary with items that
+        :param vm_id: VIM identifier of the VM, provided by method new_vminstance
+        :param action_dict: dictionary with the action to perform
+        :param created_items: provided by method new_vminstance is a dictionary with key-values that will be passed to
+            the method delete_vminstance. Can be used to store created ports, volumes, etc. Format is VimConnector
+            dependent, but do not use nested dictionaries and a value of None should be the same as not present. This
+            method can modify this value
+        :return: None, or a console dict
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def get_vminstance_console(self, vm_id, console_type="vnc"):
+        """
+        Get a console for the virtual machine
+        Params:
+            vm_id: uuid of the VM
+            console_type, can be:
+                "novnc" (by default), "xvpvnc" for VNC types,
+                "rdp-html5" for RDP types, "spice-html5" for SPICE types
+        Returns dict with the console parameters:
+                protocol: ssh, ftp, http, https, ...
+                server:   usually ip address
+                port:     the http, ssh, ... port
+                suffix:   extra text, e.g. the http path and query string
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def inject_user_key(self, ip_addr=None, user=None, key=None, ro_key=None, password=None):
+        """
+        Inject a ssh public key in a VM
+        Params:
+            ip_addr: ip address of the VM
+            user: username (default-user) to enter in the VM
+            key: public key to be injected in the VM
+            ro_key: private key of the RO, used to enter in the VM if the password is not provided
+            password: password of the user to enter in the VM
+        The function doesn't return a value:
+        """
+        if not ip_addr or not user:
+            raise VimConnNotSupportedException("All parameters should be different from 'None'")
+        elif not ro_key and not password:
+            raise VimConnNotSupportedException("All parameters should be different from 'None'")
+        else:
+            commands = {'mkdir -p ~/.ssh/', 'echo "{}" >> ~/.ssh/authorized_keys'.format(key),
+                        'chmod 644 ~/.ssh/authorized_keys', 'chmod 700 ~/.ssh/'}
+            client = paramiko.SSHClient()
+            try:
+                if ro_key:
+                    pkey = paramiko.RSAKey.from_private_key(StringIO(ro_key))
+                else:
+                    pkey = None
+                client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+                client.connect(ip_addr, username=user, password=password, pkey=pkey, timeout=10)
+                for command in commands:
+                    (i, o, e) = client.exec_command(command, timeout=10)
+                    returncode = o.channel.recv_exit_status()
+                    outerror = e.read()
+                    if returncode != 0:
+                        text = "run_command='{}' Error='{}'".format(command, outerror)
+                        raise VimConnUnexpectedResponse("Cannot inject ssh key in VM: '{}'".format(text))
+                        return
+            except (socket.error, paramiko.AuthenticationException, paramiko.SSHException) as message:
+                raise VimConnUnexpectedResponse(
+                    "Cannot inject ssh key in VM: '{}' - {}".format(ip_addr, str(message)))
+                return
+
+# Optional methods
+
+    def new_tenant(self, tenant_name, tenant_description):
+        """Adds a new tenant to VIM with this name and description, this is done using admin_url if provided
+        "tenant_name": string max lenght 64
+        "tenant_description": string max length 256
+        returns the tenant identifier or raise exception
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_tenant(self, tenant_id,):
+        """Delete a tenant from VIM
+        tenant_id: returned VIM tenant_id on "new_tenant"
+        Returns None on success. Raises and exception of failure. If tenant is not found raises VimConnNotFoundException
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_classification(self, name, ctype, definition):
+        """Creates a traffic classification in the VIM
+        Params:
+            'name': name of this classification
+            'ctype': type of this classification
+            'definition': definition of this classification (type-dependent free-form text)
+        Returns the VIM's classification ID on success or raises an exception on failure
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_classification(self, classification_id):
+        """Obtain classification details of the VIM's classification with ID='classification_id'
+        Return a dict that contains:
+            'id': VIM's classification ID (same as classification_id)
+            'name': VIM's classification name
+            'type': type of this classification
+            'definition': definition of the classification
+            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
+            'error_msg': (optional) text that explains the ERROR status
+            other VIM specific fields: (optional) whenever possible
+        Raises an exception upon error or when classification is not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_classification_list(self, filter_dict={}):
+        """Obtain classifications from the VIM
+        Params:
+            'filter_dict' (optional): contains the entries to filter the classifications on and only return those that
+                match ALL:
+                id:   string => returns classifications with this VIM's classification ID, which implies a return of one
+                    classification at most
+                name: string => returns only classifications with this name
+                type: string => returns classifications of this type
+                definition: string => returns classifications that have this definition
+                tenant_id: string => returns only classifications that belong to this tenant/project
+        Returns a list of classification dictionaries, each dictionary contains:
+            'id': (mandatory) VIM's classification ID
+            'name': (mandatory) VIM's classification name
+            'type': type of this classification
+            'definition': definition of the classification
+            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
+        List can be empty if no classification matches the filter_dict. Raise an exception only upon VIM connectivity,
+            authorization, or some other unspecific error
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def refresh_classifications_status(self, classification_list):
+        '''Get the status of the classifications
+           Params: the list of classification identifiers
+           Returns a dictionary with:
+                vm_id:          #VIM id of this classifier
+                    status:     #Mandatory. Text with one of:
+                                #  DELETED (not found at vim)
+                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
+                                #  OTHER (Vim reported other status not understood)
+                                #  ERROR (VIM indicates an ERROR status)
+                                #  ACTIVE,
+                                #  CREATING (on building process)
+                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
+                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
+        '''
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_classification(self, classification_id):
+        """Deletes a classification from the VIM
+        Returns the classification ID (classification_id) or raises an exception upon error or when classification is
+           not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def new_sfi(self, name, ingress_ports, egress_ports, sfc_encap=True):
+        """Creates a service function instance in the VIM
+        Params:
+            'name': name of this service function instance
+            'ingress_ports': set of ingress ports (VIM's port IDs)
+            'egress_ports': set of egress ports (VIM's port IDs)
+            'sfc_encap': boolean stating whether this specific instance supports IETF SFC Encapsulation
+        Returns the VIM's service function instance ID on success or raises an exception on failure
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_sfi(self, sfi_id):
+        """Obtain service function instance details of the VIM's service function instance with ID='sfi_id'
+        Return a dict that contains:
+            'id': VIM's sfi ID (same as sfi_id)
+            'name': VIM's sfi name
+            'ingress_ports': set of ingress ports (VIM's port IDs)
+            'egress_ports': set of egress ports (VIM's port IDs)
+            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
+            'error_msg': (optional) text that explains the ERROR status
+            other VIM specific fields: (optional) whenever possible
+        Raises an exception upon error or when service function instance is not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_sfi_list(self, filter_dict={}):
+        """Obtain service function instances from the VIM
+        Params:
+            'filter_dict' (optional): contains the entries to filter the sfis on and only return those that match ALL:
+                id:   string  => returns sfis with this VIM's sfi ID, which implies a return of one sfi at most
+                name: string  => returns only service function instances with this name
+                tenant_id: string => returns only service function instances that belong to this tenant/project
+        Returns a list of service function instance dictionaries, each dictionary contains:
+            'id': (mandatory) VIM's sfi ID
+            'name': (mandatory) VIM's sfi name
+            'ingress_ports': set of ingress ports (VIM's port IDs)
+            'egress_ports': set of egress ports (VIM's port IDs)
+            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
+        List can be empty if no sfi matches the filter_dict. Raise an exception only upon VIM connectivity,
+            authorization, or some other unspecific error
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def delete_sfi(self, sfi_id):
+        """Deletes a service function instance from the VIM
+        Returns the service function instance ID (sfi_id) or raises an exception upon error or when sfi is not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def refresh_sfis_status(self, sfi_list):
+        '''Get the status of the service function instances
+           Params: the list of sfi identifiers
+           Returns a dictionary with:
+                vm_id:          #VIM id of this service function instance
+                    status:     #Mandatory. Text with one of:
+                                #  DELETED (not found at vim)
+                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
+                                #  OTHER (Vim reported other status not understood)
+                                #  ERROR (VIM indicates an ERROR status)
+                                #  ACTIVE,
+                                #  CREATING (on building process)
+                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
+                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
+        '''
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_sf(self, name, sfis, sfc_encap=True):
+        """Creates (an abstract) service function in the VIM
+        Params:
+            'name': name of this service function
+            'sfis': set of service function instances of this (abstract) service function
+            'sfc_encap': boolean stating whether this service function supports IETF SFC Encapsulation
+        Returns the VIM's service function ID on success or raises an exception on failure
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_sf(self, sf_id):
+        """Obtain service function details of the VIM's service function with ID='sf_id'
+        Return a dict that contains:
+            'id': VIM's sf ID (same as sf_id)
+            'name': VIM's sf name
+            'sfis': VIM's sf's set of VIM's service function instance IDs
+            'sfc_encap': boolean stating whether this service function supports IETF SFC Encapsulation
+            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
+            'error_msg': (optional) text that explains the ERROR status
+            other VIM specific fields: (optional) whenever possible
+        Raises an exception upon error or when sf is not found
+        """
+
+    def get_sf_list(self, filter_dict={}):
+        """Obtain service functions from the VIM
+        Params:
+            'filter_dict' (optional): contains the entries to filter the sfs on and only return those that match ALL:
+                id:   string  => returns sfs with this VIM's sf ID, which implies a return of one sf at most
+                name: string  => returns only service functions with this name
+                tenant_id: string => returns only service functions that belong to this tenant/project
+        Returns a list of service function dictionaries, each dictionary contains:
+            'id': (mandatory) VIM's sf ID
+            'name': (mandatory) VIM's sf name
+            'sfis': VIM's sf's set of VIM's service function instance IDs
+            'sfc_encap': boolean stating whether this service function supports IETF SFC Encapsulation
+            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
+        List can be empty if no sf matches the filter_dict. Raise an exception only upon VIM connectivity,
+            authorization, or some other unspecific error
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def delete_sf(self, sf_id):
+        """Deletes (an abstract) service function from the VIM
+        Returns the service function ID (sf_id) or raises an exception upon error or when sf is not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def refresh_sfs_status(self, sf_list):
+        '''Get the status of the service functions
+           Params: the list of sf identifiers
+           Returns a dictionary with:
+                vm_id:          #VIM id of this service function
+                    status:     #Mandatory. Text with one of:
+                                #  DELETED (not found at vim)
+                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
+                                #  OTHER (Vim reported other status not understood)
+                                #  ERROR (VIM indicates an ERROR status)
+                                #  ACTIVE,
+                                #  CREATING (on building process)
+                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
+                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
+        '''
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def new_sfp(self, name, classifications, sfs, sfc_encap=True, spi=None):
+        """Creates a service function path
+        Params:
+            'name': name of this service function path
+            'classifications': set of traffic classifications that should be matched on to get into this sfp
+            'sfs': list of every service function that constitutes this path , from first to last
+            'sfc_encap': whether this is an SFC-Encapsulated chain (i.e using NSH), True by default
+            'spi': (optional) the Service Function Path identifier (SPI: Service Path Identifier) for this path
+        Returns the VIM's sfp ID on success or raises an exception on failure
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_sfp(self, sfp_id):
+        """Obtain service function path details of the VIM's sfp with ID='sfp_id'
+        Return a dict that contains:
+            'id': VIM's sfp ID (same as sfp_id)
+            'name': VIM's sfp name
+            'classifications': VIM's sfp's list of VIM's classification IDs
+            'sfs': VIM's sfp's list of VIM's service function IDs
+            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
+            'error_msg': (optional) text that explains the ERROR status
+            other VIM specific fields: (optional) whenever possible
+        Raises an exception upon error or when sfp is not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def get_sfp_list(self, filter_dict={}):
+        """Obtain service function paths from VIM
+        Params:
+            'filter_dict' (optional): contains the entries to filter the sfps on, and only return those that match ALL:
+                id:   string  => returns sfps with this VIM's sfp ID , which implies a return of one sfp at most
+                name: string  => returns only sfps with this name
+                tenant_id: string => returns only sfps that belong to this tenant/project
+        Returns a list of service function path dictionaries, each dictionary contains:
+            'id': (mandatory) VIM's sfp ID
+            'name': (mandatory) VIM's sfp name
+            'classifications': VIM's sfp's list of VIM's classification IDs
+            'sfs': VIM's sfp's list of VIM's service function IDs
+            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
+        List can be empty if no sfp matches the filter_dict. Raise an exception only upon VIM connectivity,
+            authorization, or some other unspecific error
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+    def refresh_sfps_status(self, sfp_list):
+        '''Get the status of the service function path
+           Params: the list of sfp identifiers
+           Returns a dictionary with:
+                vm_id:          #VIM id of this service function path
+                    status:     #Mandatory. Text with one of:
+                                #  DELETED (not found at vim)
+                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
+                                #  OTHER (Vim reported other status not understood)
+                                #  ERROR (VIM indicates an ERROR status)
+                                #  ACTIVE,
+                                #  CREATING (on building process)
+                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
+                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)F
+        '''
+        raise VimConnNotImplemented("Should have implemented this")
+
+    def delete_sfp(self, sfp_id):
+        """Deletes a service function path from the VIM
+        Returns the sfp ID (sfp_id) or raises an exception upon error or when sf is not found
+        """
+        raise VimConnNotImplemented("SFC support not implemented")
+
+# NOT USED METHODS in current version. Deprecated
+
+    @deprecated
+    def host_vim2gui(self, host, server_dict):
+        """Transform host dictionary from VIM format to GUI format,
+        and append to the server_dict
+        """
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def get_hosts_info(self):
+        """Get the information of deployed hosts
+        Returns the hosts content"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def get_hosts(self, vim_tenant):
+        """Get the hosts and deployed instances
+        Returns the hosts content"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def get_processor_rankings(self):
+        """Get the processor rankings in the VIM database"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def new_host(self, host_data):
+        """Adds a new host to VIM"""
+        """Returns status code of the VIM response"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def new_external_port(self, port_data):
+        """Adds a external port to VIM"""
+        """Returns the port identifier"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def new_external_network(self, net_name, net_type):
+        """Adds a external network to VIM (shared)"""
+        """Returns the network identifier"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def connect_port_network(self, port_id, network_id, admin=False):
+        """Connects a external port to a network"""
+        """Returns status code of the VIM response"""
+        raise VimConnNotImplemented("Should have implemented this")
+
+    @deprecated
+    def new_vminstancefromJSON(self, vm_data):
+        """Adds a VM instance to VIM"""
+        """Returns the instance identifier"""
+        raise VimConnNotImplemented("Should have implemented this")
diff --git a/RO-plugin/requirements.txt b/RO-plugin/requirements.txt
new file mode 100644 (file)
index 0000000..64c65b4
--- /dev/null
@@ -0,0 +1,18 @@
+##
+# 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.
+##
+
+PyYAML
+paramiko
+requests
diff --git a/RO-plugin/setup.py b/RO-plugin/setup.py
new file mode 100644 (file)
index 0000000..095e0d0
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+##
+# 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 setuptools import setup
+
+_name = "osm_ro_plugin"
+
+README = """
+===========
+osm-ro_plugin
+===========
+
+osm-ro plugin is the base class for RO VIM and SDN plugins
+"""
+
+setup(
+    name=_name,
+    description='OSM ro base class for vim and SDN plugins',
+    long_description=README,
+    version_command=('git describe --match v* --tags --long --dirty', 'pep440-git-full'),
+    # version=VERSION,
+    # python_requires='>3.5.0',
+    author='ETSI OSM',
+    author_email='alfonso.tiernosepulveda@telefonica.com',
+    maintainer='Alfonso Tierno',
+    maintainer_email='alfonso.tiernosepulveda@telefonica.com',
+    url='https://osm.etsi.org/gitweb/?p=osm/RO.git;a=summary',
+    license='Apache 2.0',
+
+    packages=[_name],
+    include_package_data=True,
+    install_requires=[
+        "requests", "paramiko", "PyYAML",
+    ],
+    setup_requires=['setuptools-version-command'],
+    entry_points={
+        'osm_ro.plugins': ['rovim_plugin = osm_ro_plugin.vimconn:VimConnector',
+                           'rosdn_plugin = osm_ro_plugin.sdnconn:SdnConnectorBase'
+                           ],
+    },
+)
diff --git a/RO-plugin/stdeb.cfg b/RO-plugin/stdeb.cfg
new file mode 100644 (file)
index 0000000..f6f532e
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+[DEFAULT]
+X-Python3-Version : >= 3.5
+Maintainer: Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>
+Depends3: python3-paramiko, python3-requests, python3-yaml,
+
diff --git a/RO-plugin/tox.ini b/RO-plugin/tox.ini
new file mode 100644 (file)
index 0000000..8c6e57c
--- /dev/null
@@ -0,0 +1,41 @@
+##
+# 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.
+##
+
+[tox]
+envlist = py3
+toxworkdir={homedir}/.tox
+
+[testenv]
+basepython = python3
+install_command = python3 -m pip install -r requirements.txt -U {opts} {packages}
+# deps = -r{toxinidir}/test-requirements.txt
+commands=python3 -m unittest discover -v
+
+[testenv:flake8]
+basepython = python3
+deps = flake8
+commands = flake8 osm_ro_plugin --max-line-length 120 \
+    --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp --ignore W291,W293,E226,W504
+
+[testenv:unittest]
+basepython = python3
+commands = python3 -m unittest osm_ro_plugin.tests
+
+[testenv:build]
+basepython = python3
+deps = stdeb
+       setuptools-version-command
+commands = python3 setup.py --command-packages=stdeb.command bdist_deb
+
index 30aae22..829697c 100644 (file)
@@ -36,7 +36,10 @@ from osm_ro import utils
 from osm_ro.utils import deprecated
 from osm_ro.vim_thread import vim_thread
 import osm_ro.console_proxy_thread as cli
 from osm_ro.utils import deprecated
 from osm_ro.vim_thread import vim_thread
 import osm_ro.console_proxy_thread as cli
-from osm_ro import vimconn, vim_dummy
+from osm_ro_plugin.vim_dummy import VimDummyConnector
+from osm_ro_plugin.sdn_dummy import SdnDummyConnector
+from osm_ro_plugin.sdn_failing import SdnFailingConnector
+from osm_ro_plugin import vimconn, sdnconn
 import logging
 import collections
 import math
 import logging
 import collections
 import math
@@ -58,9 +61,6 @@ from pkg_resources import iter_entry_points
 
 
 # WIM
 
 
 # WIM
-from .wim import sdnconn
-from .wim.wimconn_dummy import DummyConnector
-from .wim.failing_connector import FailingConnector
 from .http_tools import errors as httperrors
 from .wim.engine import WimEngine
 from .wim.persistence import WimPersistence
 from .http_tools import errors as httperrors
 from .wim.engine import WimEngine
 from .wim.persistence import WimPersistence
@@ -110,12 +110,12 @@ def _load_plugin(name, type="vim"):
     except Exception as e:
         logger.critical("Cannot load osm_{}: {}".format(name, e))
         if name:
     except Exception as e:
         logger.critical("Cannot load osm_{}: {}".format(name, e))
         if name:
-            plugins[name] = FailingConnector("Cannot load osm_{}: {}".format(name, e))
+            plugins[name] = SdnFailingConnector("Cannot load osm_{}: {}".format(name, e))
     if name and name not in plugins:
         error_text = "Cannot load a module for {t} type '{n}'. The plugin 'osm_{n}' has not been" \
                      " registered".format(t=type, n=name)
         logger.critical(error_text)
     if name and name not in plugins:
         error_text = "Cannot load a module for {t} type '{n}'. The plugin 'osm_{n}' has not been" \
                      " registered".format(t=type, n=name)
         logger.critical(error_text)
-        plugins[name] = FailingConnector(error_text)
+        plugins[name] = SdnFailingConnector(error_text)
         # raise NfvoException("Cannot load a module for {t} type '{n}'. The plugin 'osm_{n}' has not been registered".
         #                     format(t=type, n=name), httperrors.Bad_Request)
 
         # raise NfvoException("Cannot load a module for {t} type '{n}'. The plugin 'osm_{n}' has not been registered".
         #                     format(t=type, n=name), httperrors.Bad_Request)
 
@@ -150,11 +150,13 @@ def get_process_id():
     # Try getting docker id. If fails, get pid
     try:
         with open("/proc/self/cgroup", "r") as f:
     # Try getting docker id. If fails, get pid
     try:
         with open("/proc/self/cgroup", "r") as f:
-            text_id_ = f.readline()
-            _, _, text_id = text_id_.rpartition("/")
-            text_id = text_id.replace("\n", "")[:12]
-            if text_id:
-                return text_id
+            for text_id_ in f.readlines():
+                if "docker/" not in text_id_:
+                    continue
+                _, _, text_id = text_id_.rpartition("/")
+                text_id = text_id.replace("\n", "")[:12]
+                if text_id:
+                    return text_id
     except Exception:
         pass
     # Return a random id
     except Exception:
         pass
     # Return a random id
@@ -191,9 +193,9 @@ def start_service(mydb, persistence=None, wim=None):
     try:
         worker_id = get_process_id()
         if "rosdn_dummy" not in plugins:
     try:
         worker_id = get_process_id()
         if "rosdn_dummy" not in plugins:
-            plugins["rosdn_dummy"] = DummyConnector
+            plugins["rosdn_dummy"] = SdnDummyConnector
         if "rovim_dummy" not in plugins:
         if "rovim_dummy" not in plugins:
-            plugins["rovim_dummy"] = vim_dummy
+            plugins["rovim_dummy"] = VimDummyConnector
         # starts ovim library
         ovim = Sdn(db, plugins)
 
         # starts ovim library
         ovim = Sdn(db, plugins)
 
@@ -230,14 +232,14 @@ def start_service(mydb, persistence=None, wim=None):
             try:
                 #if not tenant:
                 #    return -httperrors.Bad_Request, "You must provide a valid tenant name or uuid for VIM  %s" % ( vim["type"])
             try:
                 #if not tenant:
                 #    return -httperrors.Bad_Request, "You must provide a valid tenant name or uuid for VIM  %s" % ( vim["type"])
-                myvim = plugins[plugin_name].vimconnector(
+                myvim = plugins[plugin_name](
                     uuid=vim['datacenter_id'], name=vim['datacenter_name'],
                     tenant_id=vim['vim_tenant_id'], tenant_name=vim['vim_tenant_name'],
                     url=vim['vim_url'], url_admin=vim['vim_url_admin'],
                     user=vim['user'], passwd=vim['passwd'],
                     config=extra, persistent_info=vim_persistent_info[thread_id]
                 )
                     uuid=vim['datacenter_id'], name=vim['datacenter_name'],
                     tenant_id=vim['vim_tenant_id'], tenant_name=vim['vim_tenant_name'],
                     url=vim['vim_url'], url_admin=vim['vim_url_admin'],
                     user=vim['user'], passwd=vim['passwd'],
                     config=extra, persistent_info=vim_persistent_info[thread_id]
                 )
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 myvim = e
                 logger.error("Cannot launch thread for VIM {} '{}': {}".format(vim['datacenter_name'],
                                                                                vim['datacenter_id'], e))
                 myvim = e
                 logger.error("Cannot launch thread for VIM {} '{}': {}".format(vim['datacenter_name'],
                                                                                vim['datacenter_id'], e))
@@ -429,7 +431,7 @@ def get_vim(mydb, nfvo_tenant=None, datacenter_id=None, datacenter_name=None, da
                     persistent_info = {}
                 #if not tenant:
                 #    return -httperrors.Bad_Request, "You must provide a valid tenant name or uuid for VIM  %s" % ( vim["type"])
                     persistent_info = {}
                 #if not tenant:
                 #    return -httperrors.Bad_Request, "You must provide a valid tenant name or uuid for VIM  %s" % ( vim["type"])
-                vim_dict[vim['datacenter_id']] = plugins[plugin_name].vimconnector(
+                vim_dict[vim['datacenter_id']] = plugins[plugin_name](
                                 uuid=vim['datacenter_id'], name=vim['datacenter_name'],
                                 tenant_id=vim.get('vim_tenant_id',vim_tenant),
                                 tenant_name=vim.get('vim_tenant_name',vim_tenant_name),
                                 uuid=vim['datacenter_id'], name=vim['datacenter_name'],
                                 tenant_id=vim.get('vim_tenant_id',vim_tenant),
                                 tenant_name=vim.get('vim_tenant_name',vim_tenant_name),
@@ -442,7 +444,7 @@ def get_vim(mydb, nfvo_tenant=None, datacenter_id=None, datacenter_name=None, da
                     logger.error("Error at VIM  {}; {}: {}".format(vim["type"], type(e).__name__, str(e)))
                     continue
                 http_code = httperrors.Internal_Server_Error
                     logger.error("Error at VIM  {}; {}: {}".format(vim["type"], type(e).__name__, str(e)))
                     continue
                 http_code = httperrors.Internal_Server_Error
-                if isinstance(e, vimconn.vimconnException):
+                if isinstance(e, vimconn.VimConnException):
                     http_code = e.http_code
                 raise NfvoException("Error at VIM  {}; {}: {}".format(vim["type"], type(e).__name__, str(e)), http_code)
         return vim_dict
                     http_code = e.http_code
                 raise NfvoException("Error at VIM  {}; {}: {}".format(vim["type"], type(e).__name__, str(e)), http_code)
         return vim_dict
@@ -472,7 +474,7 @@ def rollback(mydb,  vims, rollback_list):
                     vim.delete_network(item["uuid"])
                 elif item["what"]=="vm":
                     vim.delete_vminstance(item["uuid"])
                     vim.delete_network(item["uuid"])
                 elif item["what"]=="vm":
                     vim.delete_vminstance(item["uuid"])
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 logger.error("Error in rollback. Not possible to delete VIM %s '%s'. Message: %s", item['what'], item["uuid"], str(e))
                 undeleted_items.append("{} {} from VIM {}".format(item['what'], item["uuid"], vim["name"]))
             except db_base_Exception as e:
                 logger.error("Error in rollback. Not possible to delete VIM %s '%s'. Message: %s", item['what'], item["uuid"], str(e))
                 undeleted_items.append("{} {} from VIM {}".format(item['what'], item["uuid"], vim["name"]))
             except db_base_Exception as e:
@@ -649,14 +651,14 @@ def create_or_use_image(mydb, vims, image_dict, rollback_list, only_create_at_vi
                 vim_images = vim.get_image_list(filter_dict)
                 #logger.debug('>>>>>>>> VIM images: %s', str(vim_images))
                 if len(vim_images) > 1:
                 vim_images = vim.get_image_list(filter_dict)
                 #logger.debug('>>>>>>>> VIM images: %s', str(vim_images))
                 if len(vim_images) > 1:
-                    raise vimconn.vimconnException("More than one candidate VIM image found for filter: {}".format(str(filter_dict)), httperrors.Conflict)
+                    raise vimconn.VimConnException("More than one candidate VIM image found for filter: {}".format(str(filter_dict)), httperrors.Conflict)
                 elif len(vim_images) == 0:
                 elif len(vim_images) == 0:
-                    raise vimconn.vimconnNotFoundException("Image not found at VIM with filter: '{}'".format(str(filter_dict)))
+                    raise vimconn.VimConnNotFoundException("Image not found at VIM with filter: '{}'".format(str(filter_dict)))
                 else:
                     #logger.debug('>>>>>>>> VIM image 0: %s', str(vim_images[0]))
                     image_vim_id = vim_images[0]['id']
 
                 else:
                     #logger.debug('>>>>>>>> VIM image 0: %s', str(vim_images[0]))
                     image_vim_id = vim_images[0]['id']
 
-        except vimconn.vimconnNotFoundException as e:
+        except vimconn.VimConnNotFoundException as e:
             #Create the image in VIM only if image_dict['location'] or image_dict['new_location'] is not None
             try:
                 #image_dict['location']=image_dict.get('new_location') if image_dict['location'] is None
             #Create the image in VIM only if image_dict['location'] or image_dict['new_location'] is not None
             try:
                 #image_dict['location']=image_dict.get('new_location') if image_dict['location'] is None
@@ -666,15 +668,15 @@ def create_or_use_image(mydb, vims, image_dict, rollback_list, only_create_at_vi
                     image_created="true"
                 else:
                     #If we reach this point, then the image has image name, and optionally checksum, and could not be found
                     image_created="true"
                 else:
                     #If we reach this point, then the image has image name, and optionally checksum, and could not be found
-                    raise vimconn.vimconnException(str(e))
-            except vimconn.vimconnException as e:
+                    raise vimconn.VimConnException(str(e))
+            except vimconn.VimConnException as e:
                 if return_on_error:
                     logger.error("Error creating image at VIM '%s': %s", vim["name"], str(e))
                     raise
                 image_vim_id = None
                 logger.warn("Error creating image at VIM '%s': %s", vim["name"], str(e))
                 continue
                 if return_on_error:
                     logger.error("Error creating image at VIM '%s': %s", vim["name"], str(e))
                     raise
                 image_vim_id = None
                 logger.warn("Error creating image at VIM '%s': %s", vim["name"], str(e))
                 continue
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             if return_on_error:
                 logger.error("Error contacting VIM to know if the image exists at VIM: %s", str(e))
                 raise
             if return_on_error:
                 logger.error("Error contacting VIM to know if the image exists at VIM: %s", str(e))
                 raise
@@ -812,7 +814,7 @@ def create_or_use_flavor(mydb, vims, flavor_dict, rollback_list, only_create_at_
             try:
                 vim.get_flavor(flavor_vim_id)
                 continue #flavor exist
             try:
                 vim.get_flavor(flavor_vim_id)
                 continue #flavor exist
-            except vimconn.vimconnException:
+            except vimconn.VimConnException:
                 pass
         #create flavor at vim
         logger.debug("nfvo.create_or_use_flavor() adding flavor to VIM %s", vim["name"])
                 pass
         #create flavor at vim
         logger.debug("nfvo.create_or_use_flavor() adding flavor to VIM %s", vim["name"])
@@ -820,14 +822,14 @@ def create_or_use_flavor(mydb, vims, flavor_dict, rollback_list, only_create_at_
             flavor_vim_id = None
             flavor_vim_id=vim.get_flavor_id_from_data(flavor_dict)
             flavor_created="false"
             flavor_vim_id = None
             flavor_vim_id=vim.get_flavor_id_from_data(flavor_dict)
             flavor_created="false"
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             pass
         try:
             if not flavor_vim_id:
                 flavor_vim_id = vim.new_flavor(flavor_dict)
                 rollback_list.append({"where":"vim", "vim_id": vim_id, "what":"flavor","uuid":flavor_vim_id})
                 flavor_created="true"
             pass
         try:
             if not flavor_vim_id:
                 flavor_vim_id = vim.new_flavor(flavor_dict)
                 rollback_list.append({"where":"vim", "vim_id": vim_id, "what":"flavor","uuid":flavor_vim_id})
                 flavor_created="true"
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             if return_on_error:
                 logger.error("Error creating flavor at VIM %s: %s.", vim["name"], str(e))
                 raise
             if return_on_error:
                 logger.error("Error creating flavor at VIM %s: %s.", vim["name"], str(e))
                 raise
@@ -1546,7 +1548,7 @@ def new_vnf(mydb, tenant_id, vnf_descriptor):
         # Step 8. Adding the VNF to the NFVO DB
         vnf_id = mydb.new_vnf_as_a_whole(tenant_id,vnf_name,vnf_descriptor,VNFCDict)
         return vnf_id
         # Step 8. Adding the VNF to the NFVO DB
         vnf_id = mydb.new_vnf_as_a_whole(tenant_id,vnf_name,vnf_descriptor,VNFCDict)
         return vnf_id
-    except (db_base_Exception, vimconn.vimconnException, KeyError) as e:
+    except (db_base_Exception, vimconn.VimConnException, KeyError) as e:
         _, message = rollback(mydb, vims, rollback_list)
         if isinstance(e, db_base_Exception):
             error_text = "Exception at database"
         _, message = rollback(mydb, vims, rollback_list)
         if isinstance(e, db_base_Exception):
             error_text = "Exception at database"
@@ -1682,7 +1684,7 @@ def new_vnf_v02(mydb, tenant_id, vnf_descriptor):
         # Step 8. Adding the VNF to the NFVO DB
         vnf_id = mydb.new_vnf_as_a_whole2(tenant_id,vnf_name,vnf_descriptor,VNFCDict)
         return vnf_id
         # Step 8. Adding the VNF to the NFVO DB
         vnf_id = mydb.new_vnf_as_a_whole2(tenant_id,vnf_name,vnf_descriptor,VNFCDict)
         return vnf_id
-    except (db_base_Exception, vimconn.vimconnException, KeyError) as e:
+    except (db_base_Exception, vimconn.VimConnException, KeyError) as e:
         _, message = rollback(mydb, vims, rollback_list)
         if isinstance(e, db_base_Exception):
             error_text = "Exception at database"
         _, message = rollback(mydb, vims, rollback_list)
         if isinstance(e, db_base_Exception):
             error_text = "Exception at database"
@@ -1811,10 +1813,10 @@ def delete_vnf(mydb,tenant_id,vnf_id,datacenter=None,vim_tenant=None):
                     continue
                 try:
                     myvim.delete_flavor(flavor_vim["vim_id"])
                     continue
                 try:
                     myvim.delete_flavor(flavor_vim["vim_id"])
-                except vimconn.vimconnNotFoundException:
+                except vimconn.VimConnNotFoundException:
                     logger.warn("VIM flavor %s not exist at datacenter %s", flavor_vim["vim_id"],
                                 flavor_vim["datacenter_vim_id"] )
                     logger.warn("VIM flavor %s not exist at datacenter %s", flavor_vim["vim_id"],
                                 flavor_vim["datacenter_vim_id"] )
-                except vimconn.vimconnException as e:
+                except vimconn.VimConnException as e:
                     logger.error("Not possible to delete VIM flavor %s from datacenter %s: %s %s",
                             flavor_vim["vim_id"], flavor_vim["datacenter_vim_id"], type(e).__name__, str(e))
                     undeletedItems.append("flavor {} from VIM {}".format(flavor_vim["vim_id"],
                     logger.error("Not possible to delete VIM flavor %s from datacenter %s: %s %s",
                             flavor_vim["vim_id"], flavor_vim["datacenter_vim_id"], type(e).__name__, str(e))
                     undeletedItems.append("flavor {} from VIM {}".format(flavor_vim["vim_id"],
@@ -1844,9 +1846,9 @@ def delete_vnf(mydb,tenant_id,vnf_id,datacenter=None,vim_tenant=None):
                 myvim=vims[ image_vim["datacenter_id"] ]
                 try:
                     myvim.delete_image(image_vim["vim_id"])
                 myvim=vims[ image_vim["datacenter_id"] ]
                 try:
                     myvim.delete_image(image_vim["vim_id"])
-                except vimconn.vimconnNotFoundException as e:
+                except vimconn.VimConnNotFoundException as e:
                     logger.warn("VIM image %s not exist at datacenter %s", image_vim["vim_id"], image_vim["datacenter_id"] )
                     logger.warn("VIM image %s not exist at datacenter %s", image_vim["vim_id"], image_vim["datacenter_id"] )
-                except vimconn.vimconnException as e:
+                except vimconn.VimConnException as e:
                     logger.error("Not possible to delete VIM image %s from datacenter %s: %s %s",
                             image_vim["vim_id"], image_vim["datacenter_id"], type(e).__name__, str(e))
                     undeletedItems.append("image {} from VIM {}".format(image_vim["vim_id"], image_vim["datacenter_id"] ))
                     logger.error("Not possible to delete VIM image %s from datacenter %s: %s %s",
                             image_vim["vim_id"], image_vim["datacenter_id"], type(e).__name__, str(e))
                     undeletedItems.append("image {} from VIM {}".format(image_vim["vim_id"], image_vim["datacenter_id"] ))
@@ -1908,7 +1910,7 @@ def get_hosts(mydb, nfvo_tenant_id):
 
         #print 'datacenters '+ json.dumps(datacenter, indent=4)
         return datacenter
 
         #print 'datacenters '+ json.dumps(datacenter, indent=4)
         return datacenter
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         raise NfvoException("Not possible to get_host_list from VIM: {}".format(str(e)), e.http_code)
 
 
         raise NfvoException("Not possible to get_host_list from VIM: {}".format(str(e)), e.http_code)
 
 
@@ -2873,7 +2875,7 @@ def start_scenario(mydb, tenant_id, scenario_id, instance_scenario_name, instanc
         instance_id = mydb.new_instance_scenario_as_a_whole(tenant_id,instance_scenario_name, instance_scenario_description, scenarioDict)
         return mydb.get_instance_scenario(instance_id)
 
         instance_id = mydb.new_instance_scenario_as_a_whole(tenant_id,instance_scenario_name, instance_scenario_description, scenarioDict)
         return mydb.get_instance_scenario(instance_id)
 
-    except (db_base_Exception, vimconn.vimconnException) as e:
+    except (db_base_Exception, vimconn.VimConnException) as e:
         _, message = rollback(mydb, vims, rollbackList)
         if isinstance(e, db_base_Exception):
             error_text = "Exception at database"
         _, message = rollback(mydb, vims, rollbackList)
         if isinstance(e, db_base_Exception):
             error_text = "Exception at database"
@@ -3780,11 +3782,11 @@ def create_instance(mydb, tenant_id, instance_dict):
         returned_instance = mydb.get_instance_scenario(instance_uuid)
         returned_instance["action_id"] = instance_action_id
         return returned_instance
         returned_instance = mydb.get_instance_scenario(instance_uuid)
         returned_instance["action_id"] = instance_action_id
         return returned_instance
-    except (NfvoException, vimconn.vimconnException, sdnconn.SdnConnectorError, db_base_Exception) as e:
+    except (NfvoException, vimconn.VimConnException, sdnconn.SdnConnectorError, db_base_Exception) as e:
         message = rollback(mydb, myvims, rollbackList)
         if isinstance(e, db_base_Exception):
             error_text = "database Exception"
         message = rollback(mydb, myvims, rollbackList)
         if isinstance(e, db_base_Exception):
             error_text = "database Exception"
-        elif isinstance(e, vimconn.vimconnException):
+        elif isinstance(e, vimconn.VimConnException):
             error_text = "VIM Exception"
         elif isinstance(e, sdnconn.SdnConnectorError):
             error_text = "WIM Exception"
             error_text = "VIM Exception"
         elif isinstance(e, sdnconn.SdnConnectorError):
             error_text = "WIM Exception"
@@ -4638,7 +4640,7 @@ def refresh_instance(mydb, nfvo_tenant, instanceDict, datacenter=None, vim_tenan
     #         try:
     #             vm_dict.update(myvims[datacenter_key].refresh_vms_status(vm_list[datacenter_key]) )
     #             failed = False
     #         try:
     #             vm_dict.update(myvims[datacenter_key].refresh_vms_status(vm_list[datacenter_key]) )
     #             failed = False
-    #         except vimconn.vimconnException as e:
+    #         except vimconn.VimConnException as e:
     #             logger.error("VIM exception %s %s", type(e).__name__, str(e))
     #             failed_message = str(e)
     #     if failed:
     #             logger.error("VIM exception %s %s", type(e).__name__, str(e))
     #             failed_message = str(e)
     #     if failed:
@@ -4700,7 +4702,7 @@ def refresh_instance(mydb, nfvo_tenant, instanceDict, datacenter=None, vim_tenan
     #         try:
     #             net_dict.update(myvims[datacenter_key].refresh_nets_status(net_list[datacenter_key]) )
     #             failed = False
     #         try:
     #             net_dict.update(myvims[datacenter_key].refresh_nets_status(net_list[datacenter_key]) )
     #             failed = False
-    #         except vimconn.vimconnException as e:
+    #         except vimconn.VimConnException as e:
     #             logger.error("VIM exception %s %s", type(e).__name__, str(e))
     #             failed_message = str(e)
     #     if failed:
     #             logger.error("VIM exception %s %s", type(e).__name__, str(e))
     #             failed_message = str(e)
     #     if failed:
@@ -5038,7 +5040,7 @@ def instance_action(mydb,nfvo_tenant,instance_id, action_dict):
                     else:
                         vm_result[ vm['uuid'] ] = {"vim_result": 200, "description": "ok", "name":vm['name']}
                         vm_ok +=1
                     else:
                         vm_result[ vm['uuid'] ] = {"vim_result": 200, "description": "ok", "name":vm['name']}
                         vm_ok +=1
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 vm_result[ vm['uuid'] ] = {"vim_result": e.http_code, "name":vm['name'], "description": str(e)}
                 vm_error+=1
 
                 vm_result[ vm['uuid'] ] = {"vim_result": e.http_code, "name":vm['name'], "description": str(e)}
                 vm_error+=1
 
@@ -5265,7 +5267,7 @@ def create_vim_account(mydb, nfvo_tenant, datacenter_id, name=None, vim_id=None,
                                                        vim_passwd=vim_password)
                 datacenter_name = myvim["name"]
                 vim_tenant = myvim.new_tenant(vim_tenant_name, "created by openmano for datacenter "+datacenter_name)
                                                        vim_passwd=vim_password)
                 datacenter_name = myvim["name"]
                 vim_tenant = myvim.new_tenant(vim_tenant_name, "created by openmano for datacenter "+datacenter_name)
-            except vimconn.vimconnException as e:
+            except vimconn.VimConnException as e:
                 raise NfvoException("Not possible to create vim_tenant {} at VIM: {}".format(vim_tenant_name, e),
                                     httperrors.Internal_Server_Error)
             datacenter_tenants_dict = {}
                 raise NfvoException("Not possible to create vim_tenant {} at VIM: {}".format(vim_tenant_name, e),
                                     httperrors.Internal_Server_Error)
             datacenter_tenants_dict = {}
@@ -5299,7 +5301,7 @@ def create_vim_account(mydb, nfvo_tenant, datacenter_id, name=None, vim_id=None,
         thread_id = datacenter_tenants_dict["uuid"]
         vim_threads["running"][thread_id] = new_thread
         return thread_id
         thread_id = datacenter_tenants_dict["uuid"]
         vim_threads["running"][thread_id] = new_thread
         return thread_id
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         raise NfvoException(str(e), httperrors.Bad_Request)
 
 
         raise NfvoException(str(e), httperrors.Bad_Request)
 
 
@@ -5378,7 +5380,7 @@ def delete_vim_account(mydb, tenant_id, vim_account_id, datacenter=None):
                 try:
                     datacenter_id, myvim = get_datacenter_by_name_uuid(mydb, tenant_id, datacenter)
                     myvim.delete_tenant(vim_tenant_dict['vim_tenant_id'])
                 try:
                     datacenter_id, myvim = get_datacenter_by_name_uuid(mydb, tenant_id, datacenter)
                     myvim.delete_tenant(vim_tenant_dict['vim_tenant_id'])
-                except vimconn.vimconnException as e:
+                except vimconn.VimConnException as e:
                     warning = "Not possible to delete vim_tenant_id {} from VIM: {} ".format(vim_tenant_dict['vim_tenant_id'], str(e))
                     logger.warn(warning)
         except db_base_Exception as e:
                     warning = "Not possible to delete vim_tenant_id {} from VIM: {} ".format(vim_tenant_dict['vim_tenant_id'], str(e))
                     logger.warn(warning)
         except db_base_Exception as e:
@@ -5400,14 +5402,14 @@ def datacenter_action(mydb, tenant_id, datacenter, action_dict):
     if 'check-connectivity' in action_dict:
         try:
             myvim.check_vim_connectivity()
     if 'check-connectivity' in action_dict:
         try:
             myvim.check_vim_connectivity()
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             #logger.error("nfvo.datacenter_action() Not possible to get_network_list from VIM: %s ", str(e))
             raise NfvoException(str(e), e.http_code)
     elif 'net-update' in action_dict:
         try:
             nets = myvim.get_network_list(filter_dict={'shared': True, 'admin_state_up': True, 'status': 'ACTIVE'})
             #print content
             #logger.error("nfvo.datacenter_action() Not possible to get_network_list from VIM: %s ", str(e))
             raise NfvoException(str(e), e.http_code)
     elif 'net-update' in action_dict:
         try:
             nets = myvim.get_network_list(filter_dict={'shared': True, 'admin_state_up': True, 'status': 'ACTIVE'})
             #print content
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             #logger.error("nfvo.datacenter_action() Not possible to get_network_list from VIM: %s ", str(e))
             raise NfvoException(str(e), httperrors.Internal_Server_Error)
         #update nets Change from VIM format to NFVO format
             #logger.error("nfvo.datacenter_action() Not possible to get_network_list from VIM: %s ", str(e))
             raise NfvoException(str(e), httperrors.Internal_Server_Error)
         #update nets Change from VIM format to NFVO format
@@ -5466,7 +5468,7 @@ def datacenter_new_netmap(mydb, tenant_id, datacenter, action_dict=None):
 
     try:
         vim_nets = myvim.get_network_list(filter_dict=filter_dict)
 
     try:
         vim_nets = myvim.get_network_list(filter_dict=filter_dict)
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         #logger.error("nfvo.datacenter_new_netmap() Not possible to get_network_list from VIM: %s ", str(e))
         raise NfvoException(str(e), httperrors.Internal_Server_Error)
     if len(vim_nets)>1 and action_dict:
         #logger.error("nfvo.datacenter_new_netmap() Not possible to get_network_list from VIM: %s ", str(e))
         raise NfvoException(str(e), httperrors.Internal_Server_Error)
     if len(vim_nets)>1 and action_dict:
@@ -5507,7 +5509,7 @@ def get_sdn_net_id(mydb, tenant_id, datacenter, network_id):
 
         datacenter_id, myvim = get_datacenter_by_name_uuid(mydb, tenant_id, datacenter)
         network = myvim.get_network_list(filter_dict=filter_dict)
 
         datacenter_id, myvim = get_datacenter_by_name_uuid(mydb, tenant_id, datacenter)
         network = myvim.get_network_list(filter_dict=filter_dict)
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         raise NfvoException("Not possible to get_sdn_net_id from VIM: {}".format(str(e)), e.http_code)
 
     # ensure the network is defined
         raise NfvoException("Not possible to get_sdn_net_id from VIM: {}".format(str(e)), e.http_code)
 
     # ensure the network is defined
@@ -5678,7 +5680,7 @@ def vim_action_get(mydb, tenant_id, datacenter, item, name):
                  datacenter)
         else:
             return {item: content}
                  datacenter)
         else:
             return {item: content}
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         print("vim_action Not possible to get_{}_list from VIM: {} ".format(item, str(e)))
         raise NfvoException("Not possible to get_{}_list from VIM: {}".format(item, str(e)), e.http_code)
 
         print("vim_action Not possible to get_{}_list from VIM: {} ".format(item, str(e)))
         raise NfvoException("Not possible to get_{}_list from VIM: {}".format(item, str(e)), e.http_code)
 
@@ -5742,7 +5744,7 @@ def vim_action_delete(mydb, tenant_id, datacenter, item, name):
             content = myvim.delete_image(item_id)
         else:
             raise NfvoException(item + "?", httperrors.Method_Not_Allowed)
             content = myvim.delete_image(item_id)
         else:
             raise NfvoException(item + "?", httperrors.Method_Not_Allowed)
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         #logger.error( "vim_action Not possible to delete_{} {}from VIM: {} ".format(item, name, str(e)))
         raise NfvoException("Not possible to delete_{} {} from VIM: {}".format(item, name, str(e)), e.http_code)
 
         #logger.error( "vim_action Not possible to delete_{} {}from VIM: {} ".format(item, name, str(e)))
         raise NfvoException("Not possible to delete_{} {} from VIM: {}".format(item, name, str(e)), e.http_code)
 
@@ -5804,7 +5806,7 @@ def vim_action_create(mydb, tenant_id, datacenter, item, descriptor):
             content = myvim.new_tenant(tenant["name"], tenant.get("description"))
         else:
             raise NfvoException(item + "?", httperrors.Method_Not_Allowed)
             content = myvim.new_tenant(tenant["name"], tenant.get("description"))
         else:
             raise NfvoException(item + "?", httperrors.Method_Not_Allowed)
-    except vimconn.vimconnException as e:
+    except vimconn.VimConnException as e:
         raise NfvoException("Not possible to create {} at VIM: {}".format(item, str(e)), e.http_code)
 
     return vim_action_get(mydb, tenant_id, datacenter, item, content)
         raise NfvoException("Not possible to create {} at VIM: {}".format(item, str(e)), e.http_code)
 
     return vim_action_get(mydb, tenant_id, datacenter, item, content)
diff --git a/RO/osm_ro/vim_dummy.py b/RO/osm_ro/vim_dummy.py
deleted file mode 100644 (file)
index 9636377..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##
-# Copyright 2020 Telefonica Investigacion y Desarrollo, S.A.U.
-#
-# 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.
-##
-
-"""
-Implements a Dummy vim plugin.
-"""
-
-import yaml
-from osm_ro import vimconn
-from uuid import uuid4
-from copy import deepcopy
-
-__author__ = "Alfonso Tierno"
-__date__  = "2020-04-20"
-
-
-class vimconnector(vimconn.vimconnector):
-    """Dummy vim connector that does nothing
-    Provide config with:
-        vm_ip: ip address to provide at VM creation. For some tests must be a valid reachable VM
-        ssh_key: private ssh key to use for inserting an authorized ssh key
-    """
-    def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
-                 config={}, persistent_info={}):
-        super().__init__(uuid, name, tenant_id, tenant_name, url, url_admin, user, passwd, log_level,
-                         config, persistent_info)
-        self.nets = {
-            "mgmt": {
-                "id": "mgmt",
-                "name": "mgmt",
-                "status": "ACTIVE",
-                "vim_info": '{status: ACTIVE}'
-            }
-        }
-        self.vms = {}
-        self.flavors = {}
-        self.tenants = {}
-        # preload some images
-        self.images = {
-            "90681b39-dc09-49b7-ba2e-2c00c6b33b76": {
-                "id": "90681b39-dc09-49b7-ba2e-2c00c6b33b76",
-                "name": "cirros034",
-                "checksum": "ee1eca47dc88f4879d8a229cc70a07c6"
-            },
-            "83a39656-65db-47dc-af03-b55289115a53": {
-                "id": "",
-                "name": "cirros040",
-                "checksum": "443b7623e27ecf03dc9e01ee93f67afe"
-            },
-            "208314f2-8eb6-4101-965d-fe2ffbaedf3c": {
-                "id": "208314f2-8eb6-4101-965d-fe2ffbaedf3c",
-                "name": "ubuntu18.04",
-                "checksum": "b6fc7b9b91bca32e989e1edbcdeecb95"
-            },
-            "c03321f8-4b6e-4045-a309-1b3878bd32c1": {
-                "id": "c03321f8-4b6e-4045-a309-1b3878bd32c1",
-                "name": "ubuntu16.04",
-                "checksum": "8f08442faebad2d4a99fedb22fca11b5"
-            },
-            "4f6399a2-3554-457e-916e-ada01f8b950b": {
-                "id": "4f6399a2-3554-457e-916e-ada01f8b950b",
-                "name": "ubuntu1604",
-                "checksum": "8f08442faebad2d4a99fedb22fca11b5"
-            },
-            "59ac0b79-5c7d-4e83-b517-4c6c6a8ac1d3": {
-                "id": "59ac0b79-5c7d-4e83-b517-4c6c6a8ac1d3",
-                "name": "hackfest3-mgmt",
-                "checksum": "acec1e5d5ad7be9be7e6342a16bcf66a"
-            },
-            "f8818a03-f099-4c18-b1c7-26b1324203c1": {
-                "id": "f8818a03-f099-4c18-b1c7-26b1324203c1",
-                "name": "hackfest-pktgen",
-                "checksum": "f8818a03-f099-4c18-b1c7-26b1324203c1"
-            },
-        }
-
-    def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
-        net_id = str(uuid4())
-        net = {
-            "id": net_id,
-            "name": net_name,
-            "net_type": net_type,
-            "status": "ACTIVE",
-        }
-        self.nets[net_id] = net
-        return net_id, net
-
-    def get_network_list(self, filter_dict=None):
-        nets = []
-        for net_id, net in self.nets.items():
-            if filter_dict and filter_dict.get("name"):
-                if net["name"] != filter_dict.get("name"):
-                    continue
-            if filter_dict and filter_dict.get("id"):
-                if net_id != filter_dict.get("id"):
-                    continue
-            nets.append(net)
-        return nets
-
-    def get_network(self, net_id):
-        if net_id not in self.nets:
-            raise vimconn.vimconnNotFoundException("network with id {} not found".format(net_id))
-        return self.nets[net_id]
-
-    def delete_network(self, net_id, created_items=None):
-        if net_id not in self.nets:
-            raise vimconn.vimconnNotFoundException("network with id {} not found".format(net_id))
-        return net_id
-        self.nets.pop(net_id)
-
-    def refresh_nets_status(self, net_list):
-        nets = {}
-        for net_id in net_list:
-            if net_id not in self.nets:
-                net = {"status": "DELETED"}
-            else:
-                net = self.nets[net_id].copy()
-                net["vim_info"] = yaml.dump({"status": "ACTIVE", "name": net["name"]},
-                                                 default_flow_style=True, width=256)
-            nets[net_id] = net
-
-        return nets
-
-    def get_flavor(self, flavor_id):
-        if flavor_id not in self.flavors:
-            raise vimconn.vimconnNotFoundException("flavor with id {} not found".format(flavor_id))
-        return self.flavors[flavor_id]
-
-    def new_flavor(self, flavor_data):
-        flavor_id = str(uuid4())
-        flavor = deepcopy(flavor_data)
-        flavor["id"] = flavor_id
-        if "name" not in flavor:
-            flavor["name"] = flavor_id
-        self.flavors[flavor_id] = flavor
-        return flavor_id
-
-    def delete_flavor(self, flavor_id):
-        if flavor_id not in self.flavors:
-            raise vimconn.vimconnNotFoundException("flavor with id {} not found".format(flavor_id))
-        return flavor_id
-        self.flavors.pop(flavor_id)
-
-    def get_flavor_id_from_data(self, flavor_dict):
-        for flavor_id, flavor_data in self.flavors.items():
-            for k in ("ram", "vcpus", "disk", "extended"):
-                if flavor_data.get(k) != flavor_dict.get(k):
-                    break
-            else:
-                return flavor_id
-        raise vimconn.vimconnNotFoundException("flavor with ram={}  cpu={} disk={} {} not found".format(
-            flavor_dict["ram"], flavor_dict["vcpus"], flavor_dict["disk"],
-            "and extended" if flavor_dict.get("extended") else ""))
-
-    def new_tenant(self, tenant_name, tenant_description):
-        tenant_id = str(uuid4())
-        tenant = {'name': tenant_name, 'description': tenant_description, 'id': tenant_id}
-        self.tenants[tenant_id] = tenant
-        return tenant_id
-
-    def delete_tenant(self, tenant_id):
-        if tenant_id not in self.tenants:
-            raise vimconn.vimconnNotFoundException("tenant with id {} not found".format(tenant_id))
-        return tenant_id
-        self.tenants.pop(tenant_id)
-
-    def get_tenant_list(self, filter_dict=None):
-        tenants = []
-        for tenant_id, tenant in self.tenants.items():
-            if filter_dict and filter_dict.get("name"):
-                if tenant["name"] != filter_dict.get("name"):
-                    continue
-            if filter_dict and filter_dict.get("id"):
-                if tenant_id != filter_dict.get("id"):
-                    continue
-            tenants.append(tenant)
-        return tenants
-
-    def new_image(self, image_dict):
-        image_id = str(uuid4())
-        image = deepcopy(image_dict)
-        image["id"] = image_id
-        if "name" not in image:
-            image["id"] = image_id
-        self.images[image_id] = image
-        return image_id
-
-    def delete_image(self, image_id):
-        if image_id not in self.images:
-            raise vimconn.vimconnNotFoundException("image with id {} not found".format(image_id))
-        return image_id
-        self.images.pop(image_id)
-
-    def get_image_list(self, filter_dict=None):
-        images = []
-        for image_id, image in self.images.items():
-            if filter_dict and filter_dict.get("name"):
-                if image["name"] != filter_dict.get("name"):
-                    continue
-            if filter_dict and filter_dict.get("checksum"):
-                if image["checksum"] != filter_dict.get("checksum"):
-                    continue
-            if filter_dict and filter_dict.get("id"):
-                if image_id != filter_dict.get("id"):
-                    continue
-            images.append(image)
-        return images
-
-    def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
-        availability_zone_index=None, availability_zone_list=None):
-        vm_id = str(uuid4())
-        interfaces = []
-        for iface_index, iface in enumerate(net_list):
-            iface["vim_id"] = str(iface_index)
-            interface = {
-                "ip_address": self.config.get("vm_ip") or "192.168.4.2",
-                "vim_interface_id": str(iface_index),
-                "vim_net_id": iface["net_id"],
-            }
-            interfaces.append(interface)
-        vm = {
-            "id": vm_id,
-            "name": name,
-            "status": "ACTIVE",
-            "description": description,
-            "interfaces": interfaces,
-            "image_id": image_id,
-            "flavor_id": flavor_id,
-        }
-        if image_id not in self.images:
-            self.logger.error("vm create, image_id '{}' not found. Skip".format(image_id))
-        if flavor_id not in self.flavors:
-            self.logger.error("vm create flavor_id '{}' not found. Skip".format(flavor_id))
-        self.vms[vm_id] = vm
-        return vm_id, vm
-
-    def get_vminstance(self, vm_id):
-        if vm_id not in self.vms:
-            raise vimconn.vimconnNotFoundException("vm with id {} not found".format(vm_id))
-        return self.vms[vm_id]
-
-    def delete_vminstance(self, vm_id, created_items=None):
-        if vm_id not in self.vms:
-            raise vimconn.vimconnNotFoundException("vm with id {} not found".format(vm_id))
-        return vm_id
-        self.vms.pop(vm_id)
-
-    def refresh_vms_status(self, vm_list):
-        vms = {}
-        for vm_id in vm_list:
-            if vm_id not in self.vms:
-                vm = {"status": "DELETED"}
-            else:
-                vm = deepcopy(self.vms[vm_id])
-                vm["vim_info"] = yaml.dump({"status": "ACTIVE", "name": vm["name"]},
-                                            default_flow_style=True, width=256)
-            vms[vm_id] = vm
-        return vms
-
-    def action_vminstance(self, vm_id, action_dict, created_items={}):
-        return None
-
-    def inject_user_key(self, ip_addr=None, user=None, key=None, ro_key=None, password=None):
-        if self.config.get("ssh_key"):
-            ro_key = self.config.get("ssh_key")
-        return super().inject_user_key(ip_addr=ip_addr, user=user, key=key, ro_key=ro_key, password=password)
index 3039bab..75ab863 100644 (file)
@@ -80,8 +80,8 @@ import threading
 import time
 import queue
 import logging
 import time
 import queue
 import logging
-from osm_ro import vimconn
-from osm_ro.wim.sdnconn import SdnConnectorError
+from osm_ro_plugin import vimconn
+from osm_ro_plugin.sdnconn import SdnConnectorError
 import yaml
 from osm_ro.db_base import db_base_Exception
 from http import HTTPStatus
 import yaml
 from osm_ro.db_base import db_base_Exception
 from http import HTTPStatus
@@ -156,12 +156,12 @@ class vim_thread(threading.Thread):
             raise SdnConnectorError(str(exc), http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value) from exc
 
     def _proccess_vim_exception(self, exc):
             raise SdnConnectorError(str(exc), http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value) from exc
 
     def _proccess_vim_exception(self, exc):
-        if isinstance(exc, vimconn.vimconnException):
+        if isinstance(exc, vimconn.VimConnException):
             raise
         else:
             self.logger.error("plugin={} throws a non vimconnException exception {}".format(self.plugin_name, exc),
                               exc_info=True)
             raise
         else:
             self.logger.error("plugin={} throws a non vimconnException exception {}".format(self.plugin_name, exc),
                               exc_info=True)
-            raise vimconn.vimconnException(str(exc), http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value) from exc
+            raise vimconn.VimConnException(str(exc), http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value) from exc
 
     def get_vim_sdn_connector(self):
         if self.datacenter_tenant_id:
 
     def get_vim_sdn_connector(self):
         if self.datacenter_tenant_id:
@@ -188,7 +188,7 @@ class vim_thread(threading.Thread):
                 # vim_config["wim_external_ports"] = [x for x in vim_port_mappings
                 #                                     if x["service_mapping_info"].get("wim")]
                 self.plugin_name = "rovim_" + vim["type"]
                 # vim_config["wim_external_ports"] = [x for x in vim_port_mappings
                 #                                     if x["service_mapping_info"].get("wim")]
                 self.plugin_name = "rovim_" + vim["type"]
-                self.vim = self.plugins[self.plugin_name].vimconnector(
+                self.vim = self.plugins[self.plugin_name](
                     uuid=vim['datacenter_id'], name=vim['datacenter_name'],
                     tenant_id=vim['vim_tenant_id'], tenant_name=vim['vim_tenant_name'],
                     url=vim['vim_url'], url_admin=vim['vim_url_admin'],
                     uuid=vim['datacenter_id'], name=vim['datacenter_name'],
                     tenant_id=vim['vim_tenant_id'], tenant_name=vim['vim_tenant_name'],
                     url=vim['vim_url'], url_admin=vim['vim_url_admin'],
@@ -408,7 +408,7 @@ class vim_thread(threading.Thread):
         try:
             vim_dict = self.vim.refresh_vms_status(vm_to_refresh_list)
             vim_info = vim_dict[vim_id]
         try:
             vim_dict = self.vim.refresh_vms_status(vm_to_refresh_list)
             vim_info = vim_dict[vim_id]
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task=several get-VM: vimconnException when trying to refresh vms " + str(e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task=several get-VM: vimconnException when trying to refresh vms " + str(e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
@@ -506,7 +506,7 @@ class vim_thread(threading.Thread):
         try:
             vim_dict = self.vim.refresh_nets_status(net_to_refresh_list)
             vim_info = vim_dict[vim_id]
         try:
             vim_dict = self.vim.refresh_nets_status(net_to_refresh_list)
             vim_info = vim_dict[vim_id]
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task=several get-net: vimconnException when trying to refresh nets " + str(e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task=several get-net: vimconnException when trying to refresh nets " + str(e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
@@ -644,7 +644,7 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "DELETE":
                     self.del_vm(task)
                 else:
                 elif task["action"] == "DELETE":
                     self.del_vm(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             elif task["item"] == 'instance_nets':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_net(task)
             elif task["item"] == 'instance_nets':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_net(task)
@@ -657,7 +657,7 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "FIND":
                     database_update = self.get_net(task)
                 else:
                 elif task["action"] == "FIND":
                     database_update = self.get_net(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             elif task["item"] == 'instance_wim_nets':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self.new_or_update_sdn_net(task)
             elif task["item"] == 'instance_wim_nets':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self.new_or_update_sdn_net(task)
@@ -670,7 +670,7 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "FIND":
                     database_update = self.get_sdn_net(task)
                 else:
                 elif task["action"] == "FIND":
                     database_update = self.get_sdn_net(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             elif task["item"] == 'instance_sfis':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_sfis(task)
             elif task["item"] == 'instance_sfis':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_sfis(task)
@@ -681,7 +681,7 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "DELETE":
                     self.del_sfi(task)
                 else:
                 elif task["action"] == "DELETE":
                     self.del_sfi(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             elif task["item"] == 'instance_sfs':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_sfs(task)
             elif task["item"] == 'instance_sfs':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_sfs(task)
@@ -692,7 +692,7 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "DELETE":
                     self.del_sf(task)
                 else:
                 elif task["action"] == "DELETE":
                     self.del_sf(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             elif task["item"] == 'instance_classifications':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_classifications(task)
             elif task["item"] == 'instance_classifications':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_classifications(task)
@@ -703,7 +703,7 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "DELETE":
                     self.del_classification(task)
                 else:
                 elif task["action"] == "DELETE":
                     self.del_classification(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             elif task["item"] == 'instance_sfps':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_sfps(task)
             elif task["item"] == 'instance_sfps':
                 if task["status"] in ('BUILD', 'DONE') and task["action"] in ("FIND", "CREATE"):
                     database_update = self._refres_sfps(task)
@@ -714,9 +714,9 @@ class vim_thread(threading.Thread):
                 elif task["action"] == "DELETE":
                     self.del_sfp(task)
                 else:
                 elif task["action"] == "DELETE":
                     self.del_sfp(task)
                 else:
-                    raise vimconn.vimconnException(self.name + "unknown task action {}".format(task["action"]))
+                    raise vimconn.VimConnException(self.name + "unknown task action {}".format(task["action"]))
             else:
             else:
-                raise vimconn.vimconnException(self.name + "unknown task item {}".format(task["item"]))
+                raise vimconn.VimConnException(self.name + "unknown task item {}".format(task["item"]))
                 # TODO
         except Exception as e:
             if not isinstance(e, VimThreadException):
                 # TODO
         except Exception as e:
             if not isinstance(e, VimThreadException):
@@ -798,7 +798,7 @@ class vim_thread(threading.Thread):
             self.task_queue.put(task, False)
             return None
         except queue.Full:
             self.task_queue.put(task, False)
             return None
         except queue.Full:
-            raise vimconn.vimconnException(self.name + ": timeout inserting a task")
+            raise vimconn.VimConnException(self.name + ": timeout inserting a task")
 
     def del_task(self, task):
         with self.task_lock:
 
     def del_task(self, task):
         with self.task_lock:
@@ -927,7 +927,7 @@ class vim_thread(threading.Thread):
             instance_element_update = {"status": "BUILD", "vim_vm_id": vim_vm_id, "error_msg": None}
             return instance_element_update
 
             instance_element_update = {"status": "BUILD", "vim_vm_id": vim_vm_id, "error_msg": None}
             return instance_element_update
 
-        except (vimconn.vimconnException, VimThreadException) as e:
+        except (vimconn.VimConnException, VimThreadException) as e:
             self.logger.error("task={} new-VM: {}".format(task_id, e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
             self.logger.error("task={} new-VM: {}".format(task_id, e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
@@ -955,9 +955,9 @@ class vim_thread(threading.Thread):
             task["error_msg"] = None
             return None
 
             task["error_msg"] = None
             return None
 
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             task["error_msg"] = self._format_vim_error_msg(str(e))
             task["error_msg"] = self._format_vim_error_msg(str(e))
-            if isinstance(e, vimconn.vimconnNotFoundException):
+            if isinstance(e, vimconn.VimConnNotFoundException):
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
@@ -1006,7 +1006,7 @@ class vim_thread(threading.Thread):
             instance_element_update = self._get_net_internal(task, filter_param)
             return instance_element_update
 
             instance_element_update = self._get_net_internal(task, filter_param)
             return instance_element_update
 
-        except (vimconn.vimconnException, VimThreadException) as e:
+        except (vimconn.VimConnException, VimThreadException) as e:
             self.logger.error("task={} get-net: {}".format(task_id, e))
             task["status"] = "FAILED"
             task["vim_id"] = None
             self.logger.error("task={} get-net: {}".format(task_id, e))
             task["status"] = "FAILED"
             task["vim_id"] = None
@@ -1072,7 +1072,7 @@ class vim_thread(threading.Thread):
             instance_element_update = {"vim_net_id": vim_net_id, "status": "BUILD",
                                        "created": True, "error_msg": None}
             return instance_element_update
             instance_element_update = {"vim_net_id": vim_net_id, "status": "BUILD",
                                        "created": True, "error_msg": None}
             return instance_element_update
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             self.logger.error("task={} new-net: Error {}: {}".format(task_id, action_text, e))
             task["status"] = "FAILED"
             task["vim_id"] = vim_net_id
             self.logger.error("task={} new-net: Error {}: {}".format(task_id, action_text, e))
             task["status"] = "FAILED"
             task["vim_id"] = vim_net_id
@@ -1099,9 +1099,9 @@ class vim_thread(threading.Thread):
             task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
             task["error_msg"] = None
             return None
             task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
             task["error_msg"] = None
             return None
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             task["error_msg"] = self._format_vim_error_msg(str(e))
             task["error_msg"] = self._format_vim_error_msg(str(e))
-            if isinstance(e, vimconn.vimconnNotFoundException):
+            if isinstance(e, vimconn.VimConnNotFoundException):
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
@@ -1251,7 +1251,7 @@ class vim_thread(threading.Thread):
             task["vim_id"] = wimconn_net_id
             instance_element_update = {"wim_internal_id": wimconn_net_id, "status": sdn_status,
                                        "created": True, "error_msg": task["error_msg"] or None}
             task["vim_id"] = wimconn_net_id
             instance_element_update = {"wim_internal_id": wimconn_net_id, "status": sdn_status,
                                        "created": True, "error_msg": task["error_msg"] or None}
-        except (vimconn.vimconnException, SdnConnectorError) as e:
+        except (vimconn.VimConnException, SdnConnectorError) as e:
             self.logger.error("task={} new-sdn-net: Error: {}".format(task_id, e))
             task["status"] = "FAILED"
             task["vim_id"] = wimconn_net_id
             self.logger.error("task={} new-sdn-net: Error: {}".format(task_id, e))
             task["status"] = "FAILED"
             task["vim_id"] = wimconn_net_id
@@ -1336,7 +1336,7 @@ class vim_thread(threading.Thread):
             instance_element_update = {"status": "ACTIVE", "vim_sfi_id": vim_sfi_id, "error_msg": None}
             return instance_element_update
 
             instance_element_update = {"status": "ACTIVE", "vim_sfi_id": vim_sfi_id, "error_msg": None}
             return instance_element_update
 
-        except (vimconn.vimconnException, VimThreadException) as e:
+        except (vimconn.VimConnException, VimThreadException) as e:
             self.logger.error("Error creating Service Function Instance, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
             self.logger.error("Error creating Service Function Instance, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
@@ -1353,9 +1353,9 @@ class vim_thread(threading.Thread):
             task["error_msg"] = None
             return None
 
             task["error_msg"] = None
             return None
 
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             task["error_msg"] = self._format_vim_error_msg(str(e))
             task["error_msg"] = self._format_vim_error_msg(str(e))
-            if isinstance(e, vimconn.vimconnNotFoundException):
+            if isinstance(e, vimconn.VimConnNotFoundException):
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
@@ -1385,7 +1385,7 @@ class vim_thread(threading.Thread):
             instance_element_update = {"status": "ACTIVE", "vim_sf_id": vim_sf_id, "error_msg": None}
             return instance_element_update
 
             instance_element_update = {"status": "ACTIVE", "vim_sf_id": vim_sf_id, "error_msg": None}
             return instance_element_update
 
-        except (vimconn.vimconnException, VimThreadException) as e:
+        except (vimconn.VimConnException, VimThreadException) as e:
             self.logger.error("Error creating Service Function, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
             self.logger.error("Error creating Service Function, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
@@ -1402,9 +1402,9 @@ class vim_thread(threading.Thread):
             task["error_msg"] = None
             return None
 
             task["error_msg"] = None
             return None
 
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             task["error_msg"] = self._format_vim_error_msg(str(e))
             task["error_msg"] = self._format_vim_error_msg(str(e))
-            if isinstance(e, vimconn.vimconnNotFoundException):
+            if isinstance(e, vimconn.VimConnNotFoundException):
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
@@ -1482,7 +1482,7 @@ class vim_thread(threading.Thread):
                                        "error_msg": None}
             return instance_element_update
 
                                        "error_msg": None}
             return instance_element_update
 
-        except (vimconn.vimconnException, VimThreadException) as e:
+        except (vimconn.VimConnException, VimThreadException) as e:
             self.logger.error("Error creating Classification, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
             self.logger.error("Error creating Classification, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
@@ -1499,9 +1499,9 @@ class vim_thread(threading.Thread):
             task["error_msg"] = None
             return None
 
             task["error_msg"] = None
             return None
 
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             task["error_msg"] = self._format_vim_error_msg(str(e))
             task["error_msg"] = self._format_vim_error_msg(str(e))
-            if isinstance(e, vimconn.vimconnNotFoundException):
+            if isinstance(e, vimconn.VimConnNotFoundException):
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
@@ -1537,7 +1537,7 @@ class vim_thread(threading.Thread):
             instance_element_update = {"status": "ACTIVE", "vim_sfp_id": vim_sfp_id, "error_msg": None}
             return instance_element_update
 
             instance_element_update = {"status": "ACTIVE", "vim_sfp_id": vim_sfp_id, "error_msg": None}
             return instance_element_update
 
-        except (vimconn.vimconnException, VimThreadException) as e:
+        except (vimconn.VimConnException, VimThreadException) as e:
             self.logger.error("Error creating Service Function, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
             self.logger.error("Error creating Service Function, task=%s: %s", task_id, str(e))
             error_text = self._format_vim_error_msg(str(e))
             task["error_msg"] = error_text
@@ -1554,9 +1554,9 @@ class vim_thread(threading.Thread):
             task["error_msg"] = None
             return None
 
             task["error_msg"] = None
             return None
 
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             task["error_msg"] = self._format_vim_error_msg(str(e))
             task["error_msg"] = self._format_vim_error_msg(str(e))
-            if isinstance(e, vimconn.vimconnNotFoundException):
+            if isinstance(e, vimconn.VimConnNotFoundException):
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
                 # If not found mark as Done and fill error_msg
                 task["status"] = "FINISHED"  # with FINISHED instead of DONE it will not be refreshing
                 return None
@@ -1573,7 +1573,7 @@ class vim_thread(threading.Thread):
         try:
             vim_dict = self.vim.refresh_sfps_status(sfp_to_refresh_list)
             vim_info = vim_dict[vim_id]
         try:
             vim_dict = self.vim.refresh_sfps_status(sfp_to_refresh_list)
             vim_info = vim_dict[vim_id]
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-sfp: vimconnException when trying to refresh sfps {}".format(task_id, e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-sfp: vimconnException when trying to refresh sfps {}".format(task_id, e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
@@ -1609,7 +1609,7 @@ class vim_thread(threading.Thread):
         try:
             vim_dict = self.vim.refresh_sfis_status(sfi_to_refresh_list)
             vim_info = vim_dict[vim_id]
         try:
             vim_dict = self.vim.refresh_sfis_status(sfi_to_refresh_list)
             vim_info = vim_dict[vim_id]
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-sfi: vimconnException when trying to refresh sfis {}".format(task_id, e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-sfi: vimconnException when trying to refresh sfis {}".format(task_id, e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
@@ -1645,7 +1645,7 @@ class vim_thread(threading.Thread):
         try:
             vim_dict = self.vim.refresh_sfs_status(sf_to_refresh_list)
             vim_info = vim_dict[vim_id]
         try:
             vim_dict = self.vim.refresh_sfs_status(sf_to_refresh_list)
             vim_info = vim_dict[vim_id]
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-sf: vimconnException when trying to refresh sfs {}".format(task_id, e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-sf: vimconnException when trying to refresh sfs {}".format(task_id, e))
             vim_info = {"status": "VIM_ERROR", "error_msg": str(e)}
@@ -1681,7 +1681,7 @@ class vim_thread(threading.Thread):
         try:
             vim_dict = self.vim.refresh_classifications_status(classification_to_refresh_list)
             vim_info = vim_dict[vim_id]
         try:
             vim_dict = self.vim.refresh_classifications_status(classification_to_refresh_list)
             vim_info = vim_dict[vim_id]
-        except vimconn.vimconnException as e:
+        except vimconn.VimConnException as e:
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-classification: vimconnException when trying to refresh classifications {}"
                 .format(task_id, e))
             # Mark all tasks at VIM_ERROR status
             self.logger.error("task={} get-classification: vimconnException when trying to refresh classifications {}"
                 .format(task_id, e))
diff --git a/RO/osm_ro/vimconn.py b/RO/osm_ro/vimconn.py
deleted file mode 100644 (file)
index 2cef7ef..0000000
+++ /dev/null
@@ -1,1009 +0,0 @@
-# -*- coding: utf-8 -*-
-
-##
-# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U.
-# This file is part of openmano
-# All Rights Reserved.
-#
-# 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.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact with: nfvlabs@tid.es
-##
-
-"""
-vimconn implement an Abstract class for the vim connector plugins
- with the definition of the method to be implemented.
-"""
-
-import logging
-import paramiko
-import socket
-from io import StringIO
-import yaml
-import sys
-from email.mime.multipart import MIMEMultipart
-from email.mime.text import MIMEText
-from osm_ro.utils import deprecated
-
-__author__ = "Alfonso Tierno, Igor D.C."
-__date__  = "$14-aug-2017 23:59:59$"
-
-#Error variables
-HTTP_Bad_Request = 400
-HTTP_Unauthorized = 401
-HTTP_Not_Found = 404
-HTTP_Method_Not_Allowed = 405
-HTTP_Request_Timeout = 408
-HTTP_Conflict = 409
-HTTP_Not_Implemented = 501
-HTTP_Service_Unavailable = 503
-HTTP_Internal_Server_Error = 500
-
-
-class vimconnException(Exception):
-    """Common and base class Exception for all vimconnector exceptions"""
-    def __init__(self, message, http_code=HTTP_Bad_Request):
-        Exception.__init__(self, message)
-        self.http_code = http_code
-
-
-class vimconnConnectionException(vimconnException):
-    """Connectivity error with the VIM"""
-    def __init__(self, message, http_code=HTTP_Service_Unavailable):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnUnexpectedResponse(vimconnException):
-    """Get an wrong response from VIM"""
-    def __init__(self, message, http_code=HTTP_Service_Unavailable):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnAuthException(vimconnException):
-    """Invalid credentials or authorization to perform this action over the VIM"""
-    def __init__(self, message, http_code=HTTP_Unauthorized):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnNotFoundException(vimconnException):
-    """The item is not found at VIM"""
-    def __init__(self, message, http_code=HTTP_Not_Found):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnConflictException(vimconnException):
-    """There is a conflict, e.g. more item found than one"""
-    def __init__(self, message, http_code=HTTP_Conflict):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnNotSupportedException(vimconnException):
-    """The request is not supported by connector"""
-    def __init__(self, message, http_code=HTTP_Service_Unavailable):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnNotImplemented(vimconnException):
-    """The method is not implemented by the connected"""
-    def __init__(self, message, http_code=HTTP_Not_Implemented):
-        vimconnException.__init__(self, message, http_code)
-
-
-class vimconnector():
-    """Abstract base class for all the VIM connector plugins
-    These plugins must implement a vimconnector class derived from this
-    and all these privated methods
-    """
-    def __init__(self, uuid, name, tenant_id, tenant_name, url, url_admin=None, user=None, passwd=None, log_level=None,
-                 config={}, persistent_info={}):
-        """
-        Constructor of VIM. Raise an exception is some needed parameter is missing, but it must not do any connectivity
-            checking against the VIM
-        :param uuid: internal id of this VIM
-        :param name: name assigned to this VIM, can be used for logging
-        :param tenant_id: 'tenant_id': (only one of them is mandatory) VIM tenant to be used
-        :param tenant_name: 'tenant_name': (only one of them is mandatory) VIM tenant to be used
-        :param url: url used for normal operations
-        :param url_admin: (optional), url used for administrative tasks
-        :param user: user to access
-        :param passwd: password
-        :param log_level: provided if it should use a different log_level than the general one
-        :param config: dictionary with extra VIM information. This contains a consolidate version of VIM config
-                    at VIM_ACCOUNT (attach)
-        :param persitent_info: dict where the class can store information that will be available among class
-                    destroy/creation cycles. This info is unique per VIM/credential. At first call it will contain an
-                    empty dict. Useful to store login/tokens information for speed up communication
-
-        """
-        self.id = uuid
-        self.name = name
-        self.url = url
-        self.url_admin = url_admin
-        self.tenant_id = tenant_id
-        self.tenant_name = tenant_name
-        self.user = user
-        self.passwd = passwd
-        self.config = config or {}
-        self.availability_zone = None
-        self.logger = logging.getLogger('openmano.vim')
-        if log_level:
-            self.logger.setLevel(getattr(logging, log_level))
-        if not self.url_admin:   # try to use normal url
-            self.url_admin = self.url
-
-    def __getitem__(self, index):
-        if index == 'tenant_id':
-            return self.tenant_id
-        if index == 'tenant_name':
-            return self.tenant_name
-        elif index == 'id':
-            return self.id
-        elif index == 'name':
-            return self.name
-        elif index == 'user':
-            return self.user
-        elif index == 'passwd':
-            return self.passwd
-        elif index == 'url':
-            return self.url
-        elif index == 'url_admin':
-            return self.url_admin
-        elif index == "config":
-            return self.config
-        else:
-            raise KeyError("Invalid key '{}'".format(index))
-
-    def __setitem__(self, index, value):
-        if index == 'tenant_id':
-            self.tenant_id = value
-        if index == 'tenant_name':
-            self.tenant_name = value
-        elif index == 'id':
-            self.id = value
-        elif index == 'name':
-            self.name = value
-        elif index == 'user':
-            self.user = value
-        elif index == 'passwd':
-            self.passwd = value
-        elif index == 'url':
-            self.url = value
-        elif index == 'url_admin':
-            self.url_admin = value
-        else:
-            raise KeyError("Invalid key '{}'".format(index))
-
-    @staticmethod
-    def _create_mimemultipart(content_list):
-        """Creates a MIMEmultipart text combining the content_list
-        :param content_list: list of text scripts to be combined
-        :return: str of the created MIMEmultipart. If the list is empty returns None, if the list contains only one
-        element MIMEmultipart is not created and this content is returned
-        """
-        if not content_list:
-            return None
-        elif len(content_list) == 1:
-            return content_list[0]
-        combined_message = MIMEMultipart()
-        for content in content_list:
-            if content.startswith('#include'):
-                mime_format = 'text/x-include-url'
-            elif content.startswith('#include-once'):
-                mime_format = 'text/x-include-once-url'
-            elif content.startswith('#!'):
-                mime_format = 'text/x-shellscript'
-            elif content.startswith('#cloud-config'):
-                mime_format = 'text/cloud-config'
-            elif content.startswith('#cloud-config-archive'):
-                mime_format = 'text/cloud-config-archive'
-            elif content.startswith('#upstart-job'):
-                mime_format = 'text/upstart-job'
-            elif content.startswith('#part-handler'):
-                mime_format = 'text/part-handler'
-            elif content.startswith('#cloud-boothook'):
-                mime_format = 'text/cloud-boothook'
-            else:  # by default
-                mime_format = 'text/x-shellscript'
-            sub_message = MIMEText(content, mime_format, sys.getdefaultencoding())
-            combined_message.attach(sub_message)
-        return combined_message.as_string()
-
-    def _create_user_data(self, cloud_config):
-        """
-        Creates a script user database on cloud_config info
-        :param cloud_config: dictionary with
-            'key-pairs': (optional) list of strings with the public key to be inserted to the default user
-            'users': (optional) list of users to be inserted, each item is a dict with:
-                'name': (mandatory) user name,
-                'key-pairs': (optional) list of strings with the public key to be inserted to the user
-            'user-data': (optional) can be a string with the text script to be passed directly to cloud-init,
-                or a list of strings, each one contains a script to be passed, usually with a MIMEmultipart file
-            'config-files': (optional). List of files to be transferred. Each item is a dict with:
-                'dest': (mandatory) string with the destination absolute path
-                'encoding': (optional, by default text). Can be one of:
-                    'b64', 'base64', 'gz', 'gz+b64', 'gz+base64', 'gzip+b64', 'gzip+base64'
-                'content' (mandatory): string with the content of the file
-                'permissions': (optional) string with file permissions, typically octal notation '0644'
-                'owner': (optional) file owner, string with the format 'owner:group'
-            'boot-data-drive': boolean to indicate if user-data must be passed using a boot drive (hard disk)
-        :return: config_drive, userdata. The first is a boolean or None, the second a string or None
-        """
-        config_drive = None
-        userdata = None
-        userdata_list = []
-        if isinstance(cloud_config, dict):
-            if cloud_config.get("user-data"):
-                if isinstance(cloud_config["user-data"], str):
-                    userdata_list.append(cloud_config["user-data"])
-                else:
-                    for u in cloud_config["user-data"]:
-                        userdata_list.append(u)
-            if cloud_config.get("boot-data-drive") is not None:
-                config_drive = cloud_config["boot-data-drive"]
-            if cloud_config.get("config-files") or cloud_config.get("users") or cloud_config.get("key-pairs"):
-                userdata_dict = {}
-                # default user
-                if cloud_config.get("key-pairs"):
-                    userdata_dict["ssh-authorized-keys"] = cloud_config["key-pairs"]
-                    userdata_dict["users"] = [{"default": None, "ssh-authorized-keys": cloud_config["key-pairs"]}]
-                if cloud_config.get("users"):
-                    if "users" not in userdata_dict:
-                        userdata_dict["users"] = ["default"]
-                    for user in cloud_config["users"]:
-                        user_info = {
-                            "name": user["name"],
-                            "sudo": "ALL = (ALL)NOPASSWD:ALL"
-                        }
-                        if "user-info" in user:
-                            user_info["gecos"] = user["user-info"]
-                        if user.get("key-pairs"):
-                            user_info["ssh-authorized-keys"] = user["key-pairs"]
-                        userdata_dict["users"].append(user_info)
-
-                if cloud_config.get("config-files"):
-                    userdata_dict["write_files"] = []
-                    for file in cloud_config["config-files"]:
-                        file_info = {
-                            "path": file["dest"],
-                            "content": file["content"]
-                        }
-                        if file.get("encoding"):
-                            file_info["encoding"] = file["encoding"]
-                        if file.get("permissions"):
-                            file_info["permissions"] = file["permissions"]
-                        if file.get("owner"):
-                            file_info["owner"] = file["owner"]
-                        userdata_dict["write_files"].append(file_info)
-                userdata_list.append("#cloud-config\n" + yaml.safe_dump(userdata_dict, indent=4,
-                                                                        default_flow_style=False))
-            userdata = self._create_mimemultipart(userdata_list)
-            self.logger.debug("userdata: %s", userdata)
-        elif isinstance(cloud_config, str):
-            userdata = cloud_config
-        return config_drive, userdata
-
-    def check_vim_connectivity(self):
-        """Checks VIM can be reached and user credentials are ok.
-        Returns None if success or raises vimconnConnectionException, vimconnAuthException, ...
-        """
-        # by default no checking until each connector implements it
-        return None
-
-    def new_tenant(self, tenant_name, tenant_description):
-        """Adds a new tenant to VIM with this name and description, this is done using admin_url if provided
-        "tenant_name": string max lenght 64
-        "tenant_description": string max length 256
-        returns the tenant identifier or raise exception
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def delete_tenant(self, tenant_id):
-        """Delete a tenant from VIM
-        tenant_id: returned VIM tenant_id on "new_tenant"
-        Returns None on success. Raises and exception of failure. If tenant is not found raises vimconnNotFoundException
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_tenant_list(self, filter_dict={}):
-        """Obtain tenants of VIM
-        filter_dict dictionary that can contain the following keys:
-            name: filter by tenant name
-            id: filter by tenant uuid/id
-            <other VIM specific>
-        Returns the tenant list of dictionaries, and empty list if no tenant match all the filers:
-            [{'name':'<name>, 'id':'<id>, ...}, ...]
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def new_network(self, net_name, net_type, ip_profile=None, shared=False, provider_network_profile=None):
-        """Adds a tenant network to VIM
-        Params:
-            'net_name': name of the network
-            'net_type': one of:
-                'bridge': overlay isolated network
-                'data':   underlay E-LAN network for Passthrough and SRIOV interfaces
-                'ptp':    underlay E-LINE network for Passthrough and SRIOV interfaces.
-            'ip_profile': is a dict containing the IP parameters of the network
-                'ip_version': can be "IPv4" or "IPv6" (Currently only IPv4 is implemented)
-                'subnet_address': ip_prefix_schema, that is X.X.X.X/Y
-                'gateway_address': (Optional) ip_schema, that is X.X.X.X
-                'dns_address': (Optional) comma separated list of ip_schema, e.g. X.X.X.X[,X,X,X,X]
-                'dhcp_enabled': True or False
-                'dhcp_start_address': ip_schema, first IP to grant
-                'dhcp_count': number of IPs to grant.
-            'shared': if this network can be seen/use by other tenants/organization
-            'provider_network_profile': (optional) contains {segmentation-id: vlan, provider-network: vim_netowrk}
-        Returns a tuple with the network identifier and created_items, or raises an exception on error
-            created_items can be None or a dictionary where this method can include key-values that will be passed to
-            the method delete_network. Can be used to store created segments, created l2gw connections, etc.
-            Format is vimconnector dependent, but do not use nested dictionaries and a value of None should be the same
-            as not present.
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_network_list(self, filter_dict={}):
-        """Obtain tenant networks of VIM
-        Params:
-            'filter_dict' (optional) contains entries to return only networks that matches ALL entries:
-                name: string  => returns only networks with this name
-                id:   string  => returns networks with this VIM id, this imply returns one network at most
-                shared: boolean >= returns only networks that are (or are not) shared
-                tenant_id: sting => returns only networks that belong to this tenant/project
-                ,#(not used yet) admin_state_up: boolean => returns only networks that are (or are not) in admin state active
-                #(not used yet) status: 'ACTIVE','ERROR',... => filter networks that are on this status
-        Returns the network list of dictionaries. each dictionary contains:
-            'id': (mandatory) VIM network id
-            'name': (mandatory) VIM network name
-            'status': (mandatory) can be 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
-            'network_type': (optional) can be 'vxlan', 'vlan' or 'flat'
-            'segmentation_id': (optional) in case network_type is vlan or vxlan this field contains the segmentation id
-            'error_msg': (optional) text that explains the ERROR status
-            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
-        List can be empty if no network map the filter_dict. Raise an exception only upon VIM connectivity,
-            authorization, or some other unspecific error
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_network(self, net_id):
-        """Obtain network details from the 'net_id' VIM network
-        Return a dict that contains:
-            'id': (mandatory) VIM network id, that is, net_id
-            'name': (mandatory) VIM network name
-            'status': (mandatory) can be 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
-            'error_msg': (optional) text that explains the ERROR status
-            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
-        Raises an exception upon error or when network is not found
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def delete_network(self, net_id, created_items=None):
-        """
-        Removes a tenant network from VIM and its associated elements
-        :param net_id: VIM identifier of the network, provided by method new_network
-        :param created_items: dictionary with extra items to be deleted. provided by method new_network
-        Returns the network identifier or raises an exception upon error or when network is not found
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def refresh_nets_status(self, net_list):
-        """Get the status of the networks
-        Params:
-            'net_list': a list with the VIM network id to be get the status
-        Returns a dictionary with:
-            'net_id':         #VIM id of this network
-                status:     #Mandatory. Text with one of:
-                    #  DELETED (not found at vim)
-                    #  VIM_ERROR (Cannot connect to VIM, authentication problems, VIM response error, ...)
-                    #  OTHER (Vim reported other status not understood)
-                    #  ERROR (VIM indicates an ERROR status)
-                    #  ACTIVE, INACTIVE, DOWN (admin down),
-                    #  BUILD (on building process)
-                error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
-                vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
-            'net_id2': ...
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_flavor(self, flavor_id):
-        """Obtain flavor details from the VIM
-        Returns the flavor dict details {'id':<>, 'name':<>, other vim specific }
-        Raises an exception upon error or if not found
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_flavor_id_from_data(self, flavor_dict):
-        """Obtain flavor id that match the flavor description
-        Params:
-            'flavor_dict': dictionary that contains:
-                'disk': main hard disk in GB
-                'ram': meomry in MB
-                'vcpus': number of virtual cpus
-                #TODO: complete parameters for EPA
-        Returns the flavor_id or raises a vimconnNotFoundException
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def new_flavor(self, flavor_data):
-        """Adds a tenant flavor to VIM
-            flavor_data contains a dictionary with information, keys:
-                name: flavor name
-                ram: memory (cloud type) in MBytes
-                vpcus: cpus (cloud type)
-                extended: EPA parameters
-                  - numas: #items requested in same NUMA
-                        memory: number of 1G huge pages memory
-                        paired-threads|cores|threads: number of paired hyperthreads, complete cores OR individual threads
-                        interfaces: # passthrough(PT) or SRIOV interfaces attached to this numa
-                          - name: interface name
-                            dedicated: yes|no|yes:sriov;  for PT, SRIOV or only one SRIOV for the physical NIC
-                            bandwidth: X Gbps; requested guarantee bandwidth
-                            vpci: requested virtual PCI address
-                disk: disk size
-                is_public:
-                 #TODO to concrete
-        Returns the flavor identifier"""
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def delete_flavor(self, flavor_id):
-        """Deletes a tenant flavor from VIM identify by its id
-        Returns the used id or raise an exception"""
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def new_image(self, image_dict):
-        """ Adds a tenant image to VIM
-        Returns the image id or raises an exception if failed
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def delete_image(self, image_id):
-        """Deletes a tenant image from VIM
-        Returns the image_id if image is deleted or raises an exception on error"""
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_image_id_from_path(self, path):
-        """Get the image id from image path in the VIM database.
-           Returns the image_id or raises a vimconnNotFoundException
-        """
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def get_image_list(self, filter_dict={}):
-        """Obtain tenant images from VIM
-        Filter_dict can be:
-            name: image name
-            id: image uuid
-            checksum: image checksum
-            location: image path
-        Returns the image list of dictionaries:
-            [{<the fields at Filter_dict plus some VIM specific>}, ...]
-            List can be empty
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def new_vminstance(self, name, description, start, image_id, flavor_id, net_list, cloud_config=None, disk_list=None,
-        availability_zone_index=None, availability_zone_list=None):
-        """Adds a VM instance to VIM
-        Params:
-            'start': (boolean) indicates if VM must start or created in pause mode.
-            'image_id','flavor_id': image and flavor VIM id to use for the VM
-            'net_list': list of interfaces, each one is a dictionary with:
-                'name': (optional) name for the interface.
-                'net_id': VIM network id where this interface must be connect to. Mandatory for type==virtual
-                'vpci': (optional) virtual vPCI address to assign at the VM. Can be ignored depending on VIM capabilities
-                'model': (optional and only have sense for type==virtual) interface model: virtio, e1000, ...
-                'mac_address': (optional) mac address to assign to this interface
-                'ip_address': (optional) IP address to assign to this interface
-                #TODO: CHECK if an optional 'vlan' parameter is needed for VIMs when type if VF and net_id is not provided,
-                    the VLAN tag to be used. In case net_id is provided, the internal network vlan is used for tagging VF
-                'type': (mandatory) can be one of:
-                    'virtual', in this case always connected to a network of type 'net_type=bridge'
-                     'PCI-PASSTHROUGH' or 'PF' (passthrough): depending on VIM capabilities it can be connected to a data/ptp network ot it
-                           can created unconnected
-                     'SR-IOV' or 'VF' (SRIOV with VLAN tag): same as PF for network connectivity.
-                     'VFnotShared'(SRIOV without VLAN tag) same as PF for network connectivity. VF where no other VFs
-                            are allocated on the same physical NIC
-                'bw': (optional) only for PF/VF/VFnotShared. Minimal Bandwidth required for the interface in GBPS
-                'port_security': (optional) If False it must avoid any traffic filtering at this interface. If missing
-                                or True, it must apply the default VIM behaviour
-                After execution the method will add the key:
-                'vim_id': must be filled/added by this method with the VIM identifier generated by the VIM for this
-                        interface. 'net_list' is modified
-            'cloud_config': (optional) dictionary with:
-                'key-pairs': (optional) list of strings with the public key to be inserted to the default user
-                'users': (optional) list of users to be inserted, each item is a dict with:
-                    'name': (mandatory) user name,
-                    'key-pairs': (optional) list of strings with the public key to be inserted to the user
-                'user-data': (optional) can be a string with the text script to be passed directly to cloud-init,
-                    or a list of strings, each one contains a script to be passed, usually with a MIMEmultipart file
-                'config-files': (optional). List of files to be transferred. Each item is a dict with:
-                    'dest': (mandatory) string with the destination absolute path
-                    'encoding': (optional, by default text). Can be one of:
-                        'b64', 'base64', 'gz', 'gz+b64', 'gz+base64', 'gzip+b64', 'gzip+base64'
-                    'content' (mandatory): string with the content of the file
-                    'permissions': (optional) string with file permissions, typically octal notation '0644'
-                    'owner': (optional) file owner, string with the format 'owner:group'
-                'boot-data-drive': boolean to indicate if user-data must be passed using a boot drive (hard disk)
-            'disk_list': (optional) list with additional disks to the VM. Each item is a dict with:
-                'image_id': (optional). VIM id of an existing image. If not provided an empty disk must be mounted
-                'size': (mandatory) string with the size of the disk in GB
-            availability_zone_index: Index of availability_zone_list to use for this this VM. None if not AV required
-            availability_zone_list: list of availability zones given by user in the VNFD descriptor.  Ignore if
-                availability_zone_index is None
-        Returns a tuple with the instance identifier and created_items or raises an exception on error
-            created_items can be None or a dictionary where this method can include key-values that will be passed to
-            the method delete_vminstance and action_vminstance. Can be used to store created ports, volumes, etc.
-            Format is vimconnector dependent, but do not use nested dictionaries and a value of None should be the same
-            as not present.
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def get_vminstance(self,vm_id):
-        """Returns the VM instance information from VIM"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def delete_vminstance(self, vm_id, created_items=None):
-        """
-        Removes a VM instance from VIM and its associated elements
-        :param vm_id: VIM identifier of the VM, provided by method new_vminstance
-        :param created_items: dictionary with extra items to be deleted. provided by method new_vminstance and/or method
-            action_vminstance
-        :return: None or the same vm_id. Raises an exception on fail
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def refresh_vms_status(self, vm_list):
-        """Get the status of the virtual machines and their interfaces/ports
-           Params: the list of VM identifiers
-           Returns a dictionary with:
-                vm_id:          #VIM id of this Virtual Machine
-                    status:     #Mandatory. Text with one of:
-                                #  DELETED (not found at vim)
-                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
-                                #  OTHER (Vim reported other status not understood)
-                                #  ERROR (VIM indicates an ERROR status)
-                                #  ACTIVE, PAUSED, SUSPENDED, INACTIVE (not running),
-                                #  BUILD (on building process), ERROR
-                                #  ACTIVE:NoMgmtIP (Active but any of its interface has an IP address
-                                #
-                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
-                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
-                    interfaces: list with interface info. Each item a dictionary with:
-                        vim_info:         #Text with plain information obtained from vim (yaml.safe_dump)
-                        mac_address:      #Text format XX:XX:XX:XX:XX:XX
-                        vim_net_id:       #network id where this interface is connected, if provided at creation
-                        vim_interface_id: #interface/port VIM id
-                        ip_address:       #null, or text with IPv4, IPv6 address
-                        compute_node:     #identification of compute node where PF,VF interface is allocated
-                        pci:              #PCI address of the NIC that hosts the PF,VF
-                        vlan:             #physical VLAN used for VF
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def action_vminstance(self, vm_id, action_dict, created_items={}):
-        """
-        Send and action over a VM instance. Returns created_items if the action was successfully sent to the VIM.
-        created_items is a dictionary with items that
-        :param vm_id: VIM identifier of the VM, provided by method new_vminstance
-        :param action_dict: dictionary with the action to perform
-        :param created_items: provided by method new_vminstance is a dictionary with key-values that will be passed to
-            the method delete_vminstance. Can be used to store created ports, volumes, etc. Format is vimconnector
-            dependent, but do not use nested dictionaries and a value of None should be the same as not present. This
-            method can modify this value
-        :return: None, or a console dict
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def get_vminstance_console(self, vm_id, console_type="vnc"):
-        """
-        Get a console for the virtual machine
-        Params:
-            vm_id: uuid of the VM
-            console_type, can be:
-                "novnc" (by default), "xvpvnc" for VNC types,
-                "rdp-html5" for RDP types, "spice-html5" for SPICE types
-        Returns dict with the console parameters:
-                protocol: ssh, ftp, http, https, ...
-                server:   usually ip address
-                port:     the http, ssh, ... port
-                suffix:   extra text, e.g. the http path and query string
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def inject_user_key(self, ip_addr=None, user=None, key=None, ro_key=None, password=None):
-        """
-        Inject a ssh public key in a VM
-        Params:
-            ip_addr: ip address of the VM
-            user: username (default-user) to enter in the VM
-            key: public key to be injected in the VM
-            ro_key: private key of the RO, used to enter in the VM if the password is not provided
-            password: password of the user to enter in the VM
-        The function doesn't return a value:
-        """
-        if not ip_addr or not user:
-            raise vimconnNotSupportedException("All parameters should be different from 'None'")
-        elif not ro_key and not password:
-            raise vimconnNotSupportedException("All parameters should be different from 'None'")
-        else:
-            commands = {'mkdir -p ~/.ssh/', 'echo "{}" >> ~/.ssh/authorized_keys'.format(key),
-                        'chmod 644 ~/.ssh/authorized_keys', 'chmod 700 ~/.ssh/'}
-            client = paramiko.SSHClient()
-            try:
-                if ro_key:
-                    pkey = paramiko.RSAKey.from_private_key(StringIO(ro_key))
-                else:
-                    pkey = None
-                client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-                client.connect(ip_addr, username=user, password=password, pkey=pkey, timeout=10)
-                for command in commands:
-                    (i, o, e) = client.exec_command(command, timeout=10)
-                    returncode = o.channel.recv_exit_status()
-                    output = o.read()
-                    outerror = e.read()
-                    if returncode != 0:
-                        text = "run_command='{}' Error='{}'".format(command, outerror)
-                        raise vimconnUnexpectedResponse("Cannot inject ssh key in VM: '{}'".format(text))
-                        return
-            except (socket.error, paramiko.AuthenticationException, paramiko.SSHException) as message:
-                raise vimconnUnexpectedResponse(
-                    "Cannot inject ssh key in VM: '{}' - {}".format(ip_addr, str(message)))
-                return
-
-# Optional methods
-
-    def new_tenant(self,tenant_name,tenant_description):
-        """Adds a new tenant to VIM with this name and description, this is done using admin_url if provided
-        "tenant_name": string max lenght 64
-        "tenant_description": string max length 256
-        returns the tenant identifier or raise exception
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def delete_tenant(self,tenant_id,):
-        """Delete a tenant from VIM
-        tenant_id: returned VIM tenant_id on "new_tenant"
-        Returns None on success. Raises and exception of failure. If tenant is not found raises vimconnNotFoundException
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def get_tenant_list(self, filter_dict=None):
-        """Obtain tenants of VIM
-        filter_dict dictionary that can contain the following keys:
-            name: filter by tenant name
-            id: filter by tenant uuid/id
-            <other VIM specific>
-        Returns the tenant list of dictionaries, and empty list if no tenant match all the filers:
-            [{'name':'<name>, 'id':'<id>, ...}, ...]
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    def new_classification(self, name, ctype, definition):
-        """Creates a traffic classification in the VIM
-        Params:
-            'name': name of this classification
-            'ctype': type of this classification
-            'definition': definition of this classification (type-dependent free-form text)
-        Returns the VIM's classification ID on success or raises an exception on failure
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_classification(self, classification_id):
-        """Obtain classification details of the VIM's classification with ID='classification_id'
-        Return a dict that contains:
-            'id': VIM's classification ID (same as classification_id)
-            'name': VIM's classification name
-            'type': type of this classification
-            'definition': definition of the classification
-            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
-            'error_msg': (optional) text that explains the ERROR status
-            other VIM specific fields: (optional) whenever possible
-        Raises an exception upon error or when classification is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_classification_list(self, filter_dict={}):
-        """Obtain classifications from the VIM
-        Params:
-            'filter_dict' (optional): contains the entries to filter the classifications on and only return those that match ALL:
-                id:   string => returns classifications with this VIM's classification ID, which implies a return of one classification at most
-                name: string => returns only classifications with this name
-                type: string => returns classifications of this type
-                definition: string => returns classifications that have this definition
-                tenant_id: string => returns only classifications that belong to this tenant/project
-        Returns a list of classification dictionaries, each dictionary contains:
-            'id': (mandatory) VIM's classification ID
-            'name': (mandatory) VIM's classification name
-            'type': type of this classification
-            'definition': definition of the classification
-            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
-        List can be empty if no classification matches the filter_dict. Raise an exception only upon VIM connectivity,
-            authorization, or some other unspecific error
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def refresh_classifications_status(self, classification_list):
-        '''Get the status of the classifications
-           Params: the list of classification identifiers
-           Returns a dictionary with:
-                vm_id:          #VIM id of this classifier
-                    status:     #Mandatory. Text with one of:
-                                #  DELETED (not found at vim)
-                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
-                                #  OTHER (Vim reported other status not understood)
-                                #  ERROR (VIM indicates an ERROR status)
-                                #  ACTIVE,
-                                #  CREATING (on building process)
-                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
-                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
-        '''
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def delete_classification(self, classification_id):
-        """Deletes a classification from the VIM
-        Returns the classification ID (classification_id) or raises an exception upon error or when classification is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def new_sfi(self, name, ingress_ports, egress_ports, sfc_encap=True):
-        """Creates a service function instance in the VIM
-        Params:
-            'name': name of this service function instance
-            'ingress_ports': set of ingress ports (VIM's port IDs)
-            'egress_ports': set of egress ports (VIM's port IDs)
-            'sfc_encap': boolean stating whether this specific instance supports IETF SFC Encapsulation
-        Returns the VIM's service function instance ID on success or raises an exception on failure
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_sfi(self, sfi_id):
-        """Obtain service function instance details of the VIM's service function instance with ID='sfi_id'
-        Return a dict that contains:
-            'id': VIM's sfi ID (same as sfi_id)
-            'name': VIM's sfi name
-            'ingress_ports': set of ingress ports (VIM's port IDs)
-            'egress_ports': set of egress ports (VIM's port IDs)
-            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
-            'error_msg': (optional) text that explains the ERROR status
-            other VIM specific fields: (optional) whenever possible
-        Raises an exception upon error or when service function instance is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_sfi_list(self, filter_dict={}):
-        """Obtain service function instances from the VIM
-        Params:
-            'filter_dict' (optional): contains the entries to filter the sfis on and only return those that match ALL:
-                id:   string  => returns sfis with this VIM's sfi ID, which implies a return of one sfi at most
-                name: string  => returns only service function instances with this name
-                tenant_id: string => returns only service function instances that belong to this tenant/project
-        Returns a list of service function instance dictionaries, each dictionary contains:
-            'id': (mandatory) VIM's sfi ID
-            'name': (mandatory) VIM's sfi name
-            'ingress_ports': set of ingress ports (VIM's port IDs)
-            'egress_ports': set of egress ports (VIM's port IDs)
-            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
-        List can be empty if no sfi matches the filter_dict. Raise an exception only upon VIM connectivity,
-            authorization, or some other unspecific error
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def delete_sfi(self, sfi_id):
-        """Deletes a service function instance from the VIM
-        Returns the service function instance ID (sfi_id) or raises an exception upon error or when sfi is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def refresh_sfis_status(self, sfi_list):
-        '''Get the status of the service function instances
-           Params: the list of sfi identifiers
-           Returns a dictionary with:
-                vm_id:          #VIM id of this service function instance
-                    status:     #Mandatory. Text with one of:
-                                #  DELETED (not found at vim)
-                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
-                                #  OTHER (Vim reported other status not understood)
-                                #  ERROR (VIM indicates an ERROR status)
-                                #  ACTIVE,
-                                #  CREATING (on building process)
-                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
-                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
-        '''
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def new_sf(self, name, sfis, sfc_encap=True):
-        """Creates (an abstract) service function in the VIM
-        Params:
-            'name': name of this service function
-            'sfis': set of service function instances of this (abstract) service function
-            'sfc_encap': boolean stating whether this service function supports IETF SFC Encapsulation
-        Returns the VIM's service function ID on success or raises an exception on failure
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_sf(self, sf_id):
-        """Obtain service function details of the VIM's service function with ID='sf_id'
-        Return a dict that contains:
-            'id': VIM's sf ID (same as sf_id)
-            'name': VIM's sf name
-            'sfis': VIM's sf's set of VIM's service function instance IDs
-            'sfc_encap': boolean stating whether this service function supports IETF SFC Encapsulation
-            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
-            'error_msg': (optional) text that explains the ERROR status
-            other VIM specific fields: (optional) whenever possible
-        Raises an exception upon error or when sf is not found
-        """
-
-    def get_sf_list(self, filter_dict={}):
-        """Obtain service functions from the VIM
-        Params:
-            'filter_dict' (optional): contains the entries to filter the sfs on and only return those that match ALL:
-                id:   string  => returns sfs with this VIM's sf ID, which implies a return of one sf at most
-                name: string  => returns only service functions with this name
-                tenant_id: string => returns only service functions that belong to this tenant/project
-        Returns a list of service function dictionaries, each dictionary contains:
-            'id': (mandatory) VIM's sf ID
-            'name': (mandatory) VIM's sf name
-            'sfis': VIM's sf's set of VIM's service function instance IDs
-            'sfc_encap': boolean stating whether this service function supports IETF SFC Encapsulation
-            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
-        List can be empty if no sf matches the filter_dict. Raise an exception only upon VIM connectivity,
-            authorization, or some other unspecific error
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def delete_sf(self, sf_id):
-        """Deletes (an abstract) service function from the VIM
-        Returns the service function ID (sf_id) or raises an exception upon error or when sf is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def refresh_sfs_status(self, sf_list):
-        '''Get the status of the service functions
-           Params: the list of sf identifiers
-           Returns a dictionary with:
-                vm_id:          #VIM id of this service function
-                    status:     #Mandatory. Text with one of:
-                                #  DELETED (not found at vim)
-                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
-                                #  OTHER (Vim reported other status not understood)
-                                #  ERROR (VIM indicates an ERROR status)
-                                #  ACTIVE,
-                                #  CREATING (on building process)
-                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
-                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)
-        '''
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def new_sfp(self, name, classifications, sfs, sfc_encap=True, spi=None):
-        """Creates a service function path
-        Params:
-            'name': name of this service function path
-            'classifications': set of traffic classifications that should be matched on to get into this sfp
-            'sfs': list of every service function that constitutes this path , from first to last
-            'sfc_encap': whether this is an SFC-Encapsulated chain (i.e using NSH), True by default
-            'spi': (optional) the Service Function Path identifier (SPI: Service Path Identifier) for this path
-        Returns the VIM's sfp ID on success or raises an exception on failure
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_sfp(self, sfp_id):
-        """Obtain service function path details of the VIM's sfp with ID='sfp_id'
-        Return a dict that contains:
-            'id': VIM's sfp ID (same as sfp_id)
-            'name': VIM's sfp name
-            'classifications': VIM's sfp's list of VIM's classification IDs
-            'sfs': VIM's sfp's list of VIM's service function IDs
-            'status': 'ACTIVE', 'INACTIVE', 'DOWN', 'BUILD', 'ERROR', 'VIM_ERROR', 'OTHER'
-            'error_msg': (optional) text that explains the ERROR status
-            other VIM specific fields: (optional) whenever possible
-        Raises an exception upon error or when sfp is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def get_sfp_list(self, filter_dict={}):
-        """Obtain service function paths from VIM
-        Params:
-            'filter_dict' (optional): contains the entries to filter the sfps on, and only return those that match ALL:
-                id:   string  => returns sfps with this VIM's sfp ID , which implies a return of one sfp at most
-                name: string  => returns only sfps with this name
-                tenant_id: string => returns only sfps that belong to this tenant/project
-        Returns a list of service function path dictionaries, each dictionary contains:
-            'id': (mandatory) VIM's sfp ID
-            'name': (mandatory) VIM's sfp name
-            'classifications': VIM's sfp's list of VIM's classification IDs
-            'sfs': VIM's sfp's list of VIM's service function IDs
-            other VIM specific fields: (optional) whenever possible using the same naming of filter_dict param
-        List can be empty if no sfp matches the filter_dict. Raise an exception only upon VIM connectivity,
-            authorization, or some other unspecific error
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-    def refresh_sfps_status(self, sfp_list):
-        '''Get the status of the service function path
-           Params: the list of sfp identifiers
-           Returns a dictionary with:
-                vm_id:          #VIM id of this service function path
-                    status:     #Mandatory. Text with one of:
-                                #  DELETED (not found at vim)
-                                #  VIM_ERROR (Cannot connect to VIM, VIM response error, ...)
-                                #  OTHER (Vim reported other status not understood)
-                                #  ERROR (VIM indicates an ERROR status)
-                                #  ACTIVE,
-                                #  CREATING (on building process)
-                    error_msg:  #Text with VIM error message, if any. Or the VIM connection ERROR
-                    vim_info:   #Text with plain information obtained from vim (yaml.safe_dump)F
-        '''
-        raise vimconnNotImplemented("Should have implemented this")
-
-    def delete_sfp(self, sfp_id):
-        """Deletes a service function path from the VIM
-        Returns the sfp ID (sfp_id) or raises an exception upon error or when sf is not found
-        """
-        raise vimconnNotImplemented( "SFC support not implemented" )
-
-# NOT USED METHODS in current version. Deprecated
-
-    @deprecated
-    def host_vim2gui(self, host, server_dict):
-        """Transform host dictionary from VIM format to GUI format,
-        and append to the server_dict
-        """
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def get_hosts_info(self):
-        """Get the information of deployed hosts
-        Returns the hosts content"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def get_hosts(self, vim_tenant):
-        """Get the hosts and deployed instances
-        Returns the hosts content"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def get_processor_rankings(self):
-        """Get the processor rankings in the VIM database"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def new_host(self, host_data):
-        """Adds a new host to VIM"""
-        """Returns status code of the VIM response"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def new_external_port(self, port_data):
-        """Adds a external port to VIM"""
-        """Returns the port identifier"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def new_external_network(self,net_name,net_type):
-        """Adds a external network to VIM (shared)"""
-        """Returns the network identifier"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-    @deprecated
-
-    @deprecated
-    def connect_port_network(self, port_id, network_id, admin=False):
-        """Connects a external port to a network"""
-        """Returns status code of the VIM response"""
-        raise vimconnNotImplemented( "Should have implemented this" )
-
-    @deprecated
-    def new_vminstancefromJSON(self, vm_data):
-        """Adds a VM instance to VIM"""
-        """Returns the instance identifier"""
-        raise vimconnNotImplemented( "Should have implemented this" )
index b7b2742..af3fde1 100755 (executable)
@@ -67,7 +67,7 @@ import sys
 from pyvcloud import Http
 
 import logging
 from pyvcloud import Http
 
 import logging
-from osm_ro import vimconn
+from osm_ro_plugin import vimconn
 import time
 import uuid
 import urllib3
 import time
 import uuid
 import urllib3
@@ -521,7 +521,7 @@ def upload_image(vim=None, image_file=None):
         if catalog_uuid is not None and validate_uuid4(catalog_uuid):
             print("Image uploaded and uuid {}".format(catalog_uuid))
             return True
         if catalog_uuid is not None and validate_uuid4(catalog_uuid):
             print("Image uploaded and uuid {}".format(catalog_uuid))
             return True
-    except vimconn.vimconnException as upload_exception:
+    except vimconn.VimConnException as upload_exception:
         print("Failed uploaded {} image".format(image_file))
         print("Error Reason: {}".format(upload_exception.message))
     return False
         print("Failed uploaded {} image".format(image_file))
         print("Error Reason: {}".format(upload_exception.message))
     return False
@@ -561,10 +561,10 @@ def boot_image(vim=None, image_name=None, vm_name=None):
             if vapp_dict is not None:
                 print_vapp(vapp_dict=vapp_dict)
         return True
             if vapp_dict is not None:
                 print_vapp(vapp_dict=vapp_dict)
         return True
-    except vimconn.vimconnNotFoundException as notFound:
+    except vimconn.VimConnNotFoundException as notFound:
         print("Failed boot {} image".format(image_name))
         print(notFound.message)
         print("Failed boot {} image".format(image_name))
         print(notFound.message)
-    except vimconn.vimconnException as vimconError:
+    except vimconn.VimConnException as vimconError:
         print("Failed boot {} image".format(image_name))
         print(vimconError.message)
     except:
         print("Failed boot {} image".format(image_name))
         print(vimconError.message)
     except:
@@ -651,7 +651,7 @@ def vmwarecli(command=None, action=None, namespace=None):
                            config={'admin_username': namespace.vcdamdin, 'admin_password': namespace.vcdadminpassword})
         vim.vca = vim.connect()
 
                            config={'admin_username': namespace.vcdamdin, 'admin_password': namespace.vcdadminpassword})
         vim.vca = vim.connect()
 
-    except vimconn.vimconnConnectionException:
+    except vimconn.VimConnConnectionException:
         print("Failed connect to vcloud director. Please check credential and hostname.")
         return
 
         print("Failed connect to vcloud director. Please check credential and hostname.")
         return
 
diff --git a/RO/osm_ro/wim/failing_connector.py b/RO/osm_ro/wim/failing_connector.py
deleted file mode 100644 (file)
index 6bbab35..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-# -*- coding: utf-8 -*-
-##
-# Copyright 2018 University of Bristol - High Performance Networks Research
-# Group
-# All Rights Reserved.
-#
-# Contributors: Anderson Bravalheri, Dimitrios Gkounis, Abubakar Siddique
-# Muqaddas, Navdeep Uniyal, Reza Nejabati and Dimitra Simeonidou
-#
-# 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.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact with: <highperformance-networks@bristol.ac.uk>
-#
-# Neither the name of the University of Bristol nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# This work has been performed in the context of DCMS UK 5G Testbeds
-# & Trials Programme and in the framework of the Metro-Haul project -
-# funded by the European Commission under Grant number 761727 through the
-# Horizon 2020 and 5G-PPP programmes.
-##
-
-"""In the case any error happens when trying to initiate the WIM Connector,
-we need a replacement for it, that will throw an error every time we try to
-execute any action
-"""
-import json
-from .sdnconn import SdnConnectorError
-
-
-class FailingConnector(object):
-    """Placeholder for a connector whose incitation failed,
-    This place holder will just raise an error every time an action is needed
-    from the connector.
-
-    This way we can make sure that all the other parts of the program will work
-    but the user will have all the information available to fix the problem.
-    """
-    def __init__(self, error_msg):
-        self.error_msg = error_msg
-
-    def __call__(self, wim, wim_account, config=None, logger=None):
-        return self
-
-    def vimconnector(self, *args, **kwargs):
-        raise Exception(self.error_msg)
-
-    def check_credentials(self):
-        raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)
-
-    def get_connectivity_service_status(self, service_uuid, _conn_info=None):
-        raise SdnConnectorError('Impossible to retrieve status for {}\n\n{}'
-                                .format(service_uuid, self.error_msg))
-
-    def create_connectivity_service(self, service_uuid, *args, **kwargs):
-        raise SdnConnectorError('Impossible to connect {}.\n{}\n{}\n{}'
-                                .format(service_uuid, self.error_msg,
-                                        json.dumps(args, indent=4),
-                                        json.dumps(kwargs, indent=4)))
-
-    def delete_connectivity_service(self, service_uuid, _conn_info=None):
-        raise SdnConnectorError('Impossible to disconnect {}\n\n{}'
-                                .format(service_uuid, self.error_msg))
-
-    def edit_connectivity_service(self, service_uuid, *args, **kwargs):
-        raise SdnConnectorError('Impossible to change connection {}.\n{}\n'
-                                '{}\n{}'
-                                .format(service_uuid, self.error_msg,
-                                        json.dumps(args, indent=4),
-                                        json.dumps(kwargs, indent=4)))
-
-    def clear_all_connectivity_services(self):
-        raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)
-
-    def get_all_active_connectivity_services(self):
-        raise SdnConnectorError('Impossible to use WIM:\n' + self.error_msg)
diff --git a/RO/osm_ro/wim/openflow_conn.py b/RO/osm_ro/wim/openflow_conn.py
deleted file mode 100644 (file)
index c7195bd..0000000
+++ /dev/null
@@ -1,464 +0,0 @@
-##
-# Copyright 2019 Telefonica Investigacion y Desarrollo, S.A.U.
-# All Rights Reserved.
-#
-# 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 http import HTTPStatus
-from osm_ro.wim.sdnconn import SdnConnectorBase, SdnConnectorError
-from uuid import uuid4
-
-"""
-Implement an Abstract class 'OpenflowConn' and an engine 'SdnConnectorOpenFlow' used for base class for SDN plugings
-that implements a pro-active opeflow rules.
-"""
-
-__author__ = "Alfonso Tierno"
-__date__ = "2019-11-11"
-
-
-class OpenflowConnException(Exception):
-    """Common and base class Exception for all vimconnector exceptions"""
-    def __init__(self, message, http_code=HTTPStatus.BAD_REQUEST.value):
-        Exception.__init__(self, message)
-        self.http_code = http_code
-
-
-class OpenflowConnConnectionException(OpenflowConnException):
-    """Connectivity error with the VIM"""
-    def __init__(self, message, http_code=HTTPStatus.SERVICE_UNAVAILABLE.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConnUnexpectedResponse(OpenflowConnException):
-    """Get an wrong response from VIM"""
-    def __init__(self, message, http_code=HTTPStatus.INTERNAL_SERVER_ERROR.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConnAuthException(OpenflowConnException):
-    """Invalid credentials or authorization to perform this action over the VIM"""
-    def __init__(self, message, http_code=HTTPStatus.UNAUTHORIZED.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConnNotFoundException(OpenflowConnException):
-    """The item is not found at VIM"""
-    def __init__(self, message, http_code=HTTPStatus.NOT_FOUND.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConnConflictException(OpenflowConnException):
-    """There is a conflict, e.g. more item found than one"""
-    def __init__(self, message, http_code=HTTPStatus.CONFLICT.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConnNotSupportedException(OpenflowConnException):
-    """The request is not supported by connector"""
-    def __init__(self, message, http_code=HTTPStatus.SERVICE_UNAVAILABLE.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConnNotImplemented(OpenflowConnException):
-    """The method is not implemented by the connected"""
-    def __init__(self, message, http_code=HTTPStatus.NOT_IMPLEMENTED.value):
-        OpenflowConnException.__init__(self, message, http_code)
-
-
-class OpenflowConn:
-    """
-    Openflow controller connector abstract implementeation.
-    """
-    def __init__(self, params):
-        self.name = "openflow_conector"
-        self.pp2ofi = {}  # From Physical Port to OpenFlow Index
-        self.ofi2pp = {}  # From OpenFlow Index to Physical Port
-        self.logger = logging.getLogger('openmano.sdn.openflow_conn')
-
-    def get_of_switches(self):
-        """"
-        Obtain a a list of switches or DPID detected by this controller
-        :return: list length, and a list where each element a tuple pair (DPID, IP address), text_error: if fails
-        """
-        raise OpenflowConnNotImplemented("Should have implemented this")
-
-    def obtain_port_correspondence(self):
-        """
-        Obtain the correspondence between physical and openflow port names
-        :return: dictionary: with physical name as key, openflow name as value, error_text: if fails
-        """
-        raise OpenflowConnNotImplemented("Should have implemented this")
-
-    def get_of_rules(self, translate_of_ports=True):
-        """
-        Obtain the rules inserted at openflow controller
-        :param translate_of_ports: if True it translates ports from openflow index to physical switch name
-        :return: list where each item is a  dictionary with the following content:
-                    priority: rule priority
-                    priority: rule priority
-                    name:         rule name (present also as the master dict key)
-                    ingress_port: match input port of the rule
-                    dst_mac:      match destination mac address of the rule, can be missing or None if not apply
-                    vlan_id:      match vlan tag of the rule, can be missing or None if not apply
-                    actions:      list of actions, composed by a pair tuples:
-                        (vlan, None/int): for stripping/setting a vlan tag
-                        (out, port):      send to this port
-                    switch:       DPID, all
-                 text_error if fails
-        """
-        raise OpenflowConnNotImplemented("Should have implemented this")
-
-    def del_flow(self, flow_name):
-        """
-        Delete all existing rules
-        :param flow_name: flow_name, this is the rule name
-        :return: None if ok, text_error if fails
-        """
-        raise OpenflowConnNotImplemented("Should have implemented this")
-
-    def new_flow(self, data):
-        """
-        Insert a new static rule
-        :param data: dictionary with the following content:
-                priority:     rule priority
-                name:         rule name
-                ingress_port: match input port of the rule
-                dst_mac:      match destination mac address of the rule, missing or None if not apply
-                vlan_id:      match vlan tag of the rule, missing or None if not apply
-                actions:      list of actions, composed by a pair tuples with these posibilities:
-                    ('vlan', None/int): for stripping/setting a vlan tag
-                    ('out', port):      send to this port
-        :return: None if ok, text_error if fails
-        """
-        raise OpenflowConnNotImplemented("Should have implemented this")
-
-    def clear_all_flows(self):
-        """"
-        Delete all existing rules
-        :return: None if ok, text_error if fails
-        """
-        raise OpenflowConnNotImplemented("Should have implemented this")
-
-
-class SdnConnectorOpenFlow(SdnConnectorBase):
-    """
-    This class is the base engine of SDN plugins base on openflow rules
-    """
-    flow_fields = ('priority', 'vlan', 'ingress_port', 'actions', 'dst_mac', 'src_mac', 'net_id')
-
-    def __init__(self, wim, wim_account, config=None, logger=None, of_connector=None):
-        self.logger = logger or logging.getLogger('openmano.sdn.openflow_conn')
-        self.of_connector = of_connector
-        self.of_controller_nets_with_same_vlan = config.get("of_controller_nets_with_same_vlan", False)
-
-    def check_credentials(self):
-        try:
-            self.openflow_conn.obtain_port_correspondence()
-        except OpenflowConnException as e:
-            raise SdnConnectorError(e, http_code=e.http_code)
-
-    def get_connectivity_service_status(self, service_uuid, conn_info=None):
-        conn_info = conn_info or {}
-        return {
-            "sdn_status": conn_info.get("status", "ERROR"),
-            "error_msg": conn_info.get("error_msg", "Variable conn_info not provided"),
-        }
-        # TODO check rules connectirng to of_connector
-
-    def create_connectivity_service(self, service_type, connection_points, **kwargs):
-        net_id = str(uuid4())
-        ports = []
-        for cp in connection_points:
-            port = {
-                "uuid": cp["service_endpoint_id"],
-                "vlan": cp.get("service_endpoint_encapsulation_info", {}).get("vlan"),
-                "mac": cp.get("service_endpoint_encapsulation_info", {}).get("mac"),
-                "switch_port": cp.get("service_endpoint_encapsulation_info", {}).get("switch_port"),
-            }
-            ports.append(port)
-        try:
-            created_items = self._set_openflow_rules(service_type, net_id, ports, created_items=None)
-            return net_id, created_items
-        except (SdnConnectorError, OpenflowConnException) as e:
-            raise SdnConnectorError(e, http_code=e.http_code)
-
-    def delete_connectivity_service(self, service_uuid, conn_info=None):
-        try:
-            service_type = "ELAN"
-            ports = []
-            self._set_openflow_rules(service_type, service_uuid, ports, created_items=conn_info)
-            return None
-        except (SdnConnectorError, OpenflowConnException) as e:
-            raise SdnConnectorError(e, http_code=e.http_code)
-
-    def edit_connectivity_service(self, service_uuid, conn_info=None, connection_points=None, **kwargs):
-        ports = []
-        for cp in connection_points:
-            port = {
-                "uuid": cp["service_endpoint_id"],
-                "vlan": cp.get("service_endpoint_encapsulation_info", {}).get("vlan"),
-                "mac": cp.get("service_endpoint_encapsulation_info", {}).get("mac"),
-                "switch_port": cp.get("service_endpoint_encapsulation_info", {}).get("switch_port"),
-            }
-            ports.append(port)
-        service_type = "ELAN"  # TODO. Store at conn_info for later use
-        try:
-            created_items = self._set_openflow_rules(service_type, service_uuid, ports, created_items=conn_info)
-            return created_items
-        except (SdnConnectorError, OpenflowConnException) as e:
-            raise SdnConnectorError(e, http_code=e.http_code)
-
-    def clear_all_connectivity_services(self):
-        """Delete all WAN Links corresponding to a WIM"""
-        pass
-
-    def get_all_active_connectivity_services(self):
-        """Provide information about all active connections provisioned by a
-        WIM
-        """
-        pass
-
-    def _set_openflow_rules(self, net_type, net_id, ports, created_items=None):
-        ifaces_nb = len(ports)
-        if not created_items:
-            created_items = {"status": None, "error_msg": None, "installed_rules_ids": []}
-        rules_to_delete = created_items.get("installed_rules_ids") or []
-        new_installed_rules_ids = []
-        error_list = []
-
-        try:
-            step = "Checking ports and network type compatibility"
-            if ifaces_nb < 2:
-                pass
-            elif net_type == 'ELINE':
-                if ifaces_nb > 2:
-                    raise SdnConnectorError("'ELINE' type network cannot connect {} interfaces, only 2".format(
-                        ifaces_nb))
-            elif net_type == 'ELAN':
-                if ifaces_nb > 2 and self.of_controller_nets_with_same_vlan:
-                    # check all ports are VLAN (tagged) or none
-                    vlan_tags = []
-                    for port in ports:
-                        if port["vlan"] not in vlan_tags:
-                            vlan_tags.append(port["vlan"])
-                    if len(vlan_tags) > 1:
-                        raise SdnConnectorError("This pluging cannot connect ports with diferent VLAN tags when flag "
-                                                "'of_controller_nets_with_same_vlan' is active")
-            else:
-                raise SdnConnectorError('Only ELINE or ELAN network types are supported for openflow')
-
-            # Get the existing flows at openflow controller
-            step = "Getting installed openflow rules"
-            existing_flows = self.of_connector.get_of_rules()
-            existing_flows_ids = [flow["name"] for flow in existing_flows]
-
-            # calculate new flows to be inserted
-            step = "Compute needed openflow rules"
-            new_flows = self._compute_net_flows(net_id, ports)
-
-            name_index = 0
-            for flow in new_flows:
-                # 1 check if an equal flow is already present
-                index = self._check_flow_already_present(flow, existing_flows)
-                if index >= 0:
-                    flow_id = existing_flows[index]["name"]
-                    self.logger.debug("Skipping already present flow %s", str(flow))
-                else:
-                    # 2 look for a non used name
-                    flow_name = flow["net_id"] + "." + str(name_index)
-                    while flow_name in existing_flows_ids:
-                        name_index += 1
-                        flow_name = flow["net_id"] + "." + str(name_index)
-                    flow['name'] = flow_name
-                    # 3 insert at openflow
-                    try:
-                        self.of_connector.new_flow(flow)
-                        flow_id = flow["name"]
-                        existing_flows_ids.append(flow_id)
-                    except OpenflowConnException as e:
-                        flow_id = None
-                        error_list.append("Cannot create rule for ingress_port={}, dst_mac={}: {}"
-                                          .format(flow["ingress_port"], flow["dst_mac"], e))
-
-                # 4 insert at database
-                if flow_id:
-                    new_installed_rules_ids.append(flow_id)
-                    if flow_id in rules_to_delete:
-                        rules_to_delete.remove(flow_id)
-
-            # delete not needed old flows from openflow
-            for flow_id in rules_to_delete:
-                # Delete flow
-                try:
-                    self.of_connector.del_flow(flow_id)
-                except OpenflowConnNotFoundException:
-                    pass
-                except OpenflowConnException as e:
-                    error_text = "Cannot remove rule '{}': {}".format(flow_id, e)
-                    error_list.append(error_text)
-                    self.logger.error(error_text)
-            created_items["installed_rules_ids"] = new_installed_rules_ids
-            if error_list:
-                created_items["error_msg"] = ";".join(error_list)[:1000]
-                created_items["error_msg"] = "ERROR"
-            else:
-                created_items["error_msg"] = None
-                created_items["status"] = "ACTIVE"
-            return created_items
-        except (SdnConnectorError, OpenflowConnException) as e:
-            raise SdnConnectorError("Error while {}: {}".format(step, e)) from e
-        except Exception as e:
-            error_text = "Error while {}: {}".format(step, e)
-            self.logger.critical(error_text, exc_info=True)
-            raise SdnConnectorError(error_text)
-
-    def _compute_net_flows(self, net_id, ports):
-        new_flows = []
-        new_broadcast_flows = {}
-        nb_ports = len(ports)
-
-        # Check switch_port information is right
-        for port in ports:
-            nb_ports += 1
-            if str(port['switch_port']) not in self.of_connector.pp2ofi:
-                raise SdnConnectorError("switch port name '{}' is not valid for the openflow controller".
-                                        format(port['switch_port']))
-        priority = 1000  # 1100
-
-        for src_port in ports:
-            # if src_port.get("groups")
-            vlan_in = src_port['vlan']
-
-            # BROADCAST:
-            broadcast_key = src_port['uuid'] + "." + str(vlan_in)
-            if broadcast_key in new_broadcast_flows:
-                flow_broadcast = new_broadcast_flows[broadcast_key]
-            else:
-                flow_broadcast = {'priority': priority,
-                                  'net_id': net_id,
-                                  'dst_mac': 'ff:ff:ff:ff:ff:ff',
-                                  "ingress_port": str(src_port['switch_port']),
-                                  'vlan_id': vlan_in,
-                                  'actions': []
-                                  }
-                new_broadcast_flows[broadcast_key] = flow_broadcast
-                if vlan_in is not None:
-                    flow_broadcast['vlan_id'] = str(vlan_in)
-
-            for dst_port in ports:
-                vlan_out = dst_port['vlan']
-                if src_port['switch_port'] == dst_port['switch_port'] and vlan_in == vlan_out:
-                    continue
-                flow = {
-                    "priority": priority,
-                    'net_id': net_id,
-                    "ingress_port": str(src_port['switch_port']),
-                    'vlan_id': vlan_in,
-                    'actions': []
-                }
-                # allow that one port have no mac
-                if dst_port['mac'] is None or nb_ports == 2:  # point to point or nets with 2 elements
-                    flow['priority'] = priority - 5  # less priority
-                else:
-                    flow['dst_mac'] = str(dst_port['mac'])
-
-                if vlan_out is None:
-                    if vlan_in:
-                        flow['actions'].append(('vlan', None))
-                else:
-                    flow['actions'].append(('vlan', vlan_out))
-                flow['actions'].append(('out', str(dst_port['switch_port'])))
-
-                if self._check_flow_already_present(flow, new_flows) >= 0:
-                    self.logger.debug("Skipping repeated flow '%s'", str(flow))
-                    continue
-
-                new_flows.append(flow)
-
-                # BROADCAST:
-                if nb_ports <= 2:  # point to multipoint or nets with more than 2 elements
-                    continue
-                out = (vlan_out, str(dst_port['switch_port']))
-                if out not in flow_broadcast['actions']:
-                    flow_broadcast['actions'].append(out)
-
-        # BROADCAST
-        for flow_broadcast in new_broadcast_flows.values():
-            if len(flow_broadcast['actions']) == 0:
-                continue  # nothing to do, skip
-            flow_broadcast['actions'].sort()
-            if 'vlan_id' in flow_broadcast:
-                previous_vlan = 0  # indicates that a packet contains a vlan, and the vlan
-            else:
-                previous_vlan = None
-            final_actions = []
-            action_number = 0
-            for action in flow_broadcast['actions']:
-                if action[0] != previous_vlan:
-                    final_actions.append(('vlan', action[0]))
-                    previous_vlan = action[0]
-                    if self.of_controller_nets_with_same_vlan and action_number:
-                        raise SdnConnectorError("Cannot interconnect different vlan tags in a network when flag "
-                                                "'of_controller_nets_with_same_vlan' is True.")
-                    action_number += 1
-                final_actions.append(('out', action[1]))
-            flow_broadcast['actions'] = final_actions
-
-            if self._check_flow_already_present(flow_broadcast, new_flows) >= 0:
-                self.logger.debug("Skipping repeated flow '%s'", str(flow_broadcast))
-                continue
-
-            new_flows.append(flow_broadcast)
-
-        # UNIFY openflow rules with the same input port and vlan and the same output actions
-        # These flows differ at the dst_mac; and they are unified by not filtering by dst_mac
-        # this can happen if there is only two ports. It is converted to a point to point connection
-        flow_dict = {}  # use as key vlan_id+ingress_port and as value the list of flows matching these values
-        for flow in new_flows:
-            key = str(flow.get("vlan_id")) + ":" + flow["ingress_port"]
-            if key in flow_dict:
-                flow_dict[key].append(flow)
-            else:
-                flow_dict[key] = [flow]
-        new_flows2 = []
-        for flow_list in flow_dict.values():
-            convert2ptp = False
-            if len(flow_list) >= 2:
-                convert2ptp = True
-                for f in flow_list:
-                    if f['actions'] != flow_list[0]['actions']:
-                        convert2ptp = False
-                        break
-            if convert2ptp:  # add only one unified rule without dst_mac
-                self.logger.debug("Convert flow rules to NON mac dst_address " + str(flow_list))
-                flow_list[0].pop('dst_mac')
-                flow_list[0]["priority"] -= 5
-                new_flows2.append(flow_list[0])
-            else:  # add all the rules
-                new_flows2 += flow_list
-        return new_flows2
-
-    def _check_flow_already_present(self, new_flow, flow_list):
-        '''check if the same flow is already present in the flow list
-        The flow is repeated if all the fields, apart from name, are equal
-        Return the index of matching flow, -1 if not match'''
-        for index, flow in enumerate(flow_list):
-            for f in self.flow_fields:
-                if flow.get(f) != new_flow.get(f):
-                    break
-            else:
-                return index
-        return -1
diff --git a/RO/osm_ro/wim/sdnconn.py b/RO/osm_ro/wim/sdnconn.py
deleted file mode 100644 (file)
index f24cedc..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-# -*- coding: utf-8 -*-
-##
-# Copyright 2018 University of Bristol - High Performance Networks Research
-# Group
-# All Rights Reserved.
-#
-# Contributors: Anderson Bravalheri, Dimitrios Gkounis, Abubakar Siddique
-# Muqaddas, Navdeep Uniyal, Reza Nejabati and Dimitra Simeonidou
-#
-# 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.
-#
-# For those usages not covered by the Apache License, Version 2.0 please
-# contact with: <highperformance-networks@bristol.ac.uk>
-#
-# Neither the name of the University of Bristol nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# This work has been performed in the context of DCMS UK 5G Testbeds
-# & Trials Programme and in the framework of the Metro-Haul project -
-# funded by the European Commission under Grant number 761727 through the
-# Horizon 2020 and 5G-PPP programmes.
-##
-"""The SDN connector is responsible for establishing both wide area network connectivity (WIM)
-and intranet SDN connectivity.
-
-It receives information from ports to be connected .
-"""
-import logging
-
-from ..http_tools.errors import HttpMappedError
-
-
-class SdnConnectorError(HttpMappedError):
-    """Base Exception for all connector related errors
-        provide the parameter 'http_code' (int) with the error code:
-            Bad_Request = 400
-            Unauthorized = 401  (e.g. credentials are not valid)
-            Not_Found = 404    (e.g. try to edit or delete a non existing connectivity service)
-            Forbidden = 403
-            Method_Not_Allowed = 405
-            Not_Acceptable = 406
-            Request_Timeout = 408  (e.g timeout reaching server, or cannot reach the server)
-            Conflict = 409
-            Service_Unavailable = 503
-            Internal_Server_Error = 500
-    """
-
-
-class SdnConnectorBase(object):
-    """Abstract base class for all the SDN connectors
-
-    Arguments:
-        wim (dict): WIM record, as stored in the database
-        wim_account (dict): WIM account record, as stored in the database
-        config
-    The arguments of the constructor are converted to object attributes.
-    An extra property, ``service_endpoint_mapping`` is created from ``config``.
-    """
-    def __init__(self, wim, wim_account, config=None, logger=None):
-        """
-
-        :param wim: (dict). Contains among others 'wim_url'
-        :param wim_account: (dict). Contains among others 'uuid' (internal id), 'name',
-            'sdn' (True if is intended for SDN-assist or False if intended for WIM), 'user', 'password'.
-        :param config: (dict or None): Particular information of plugin. These keys if present have a common meaning:
-            'mapping_not_needed': (bool) False by default or if missing, indicates that mapping is not needed.
-            'service_endpoint_mapping': (list) provides the internal endpoint mapping. The meaning is:
-                KEY                    meaning for WIM                 meaning for SDN assist
-                --------                --------                    --------
-                device_id                      pop_switch_dpid                 compute_id
-                device_interface_id            pop_switch_port                 compute_pci_address
-                service_endpoint_id        wan_service_endpoint_id     SDN_service_endpoint_id
-                service_mapping_info   wan_service_mapping_info    SDN_service_mapping_info
-                    contains extra information if needed. Text in Yaml format
-                switch_dpid                    wan_switch_dpid                 SDN_switch_dpid
-                switch_port                    wan_switch_port                 SDN_switch_port
-                datacenter_id           vim_account                 vim_account
-                id: (internal, do not use)
-                wim_id: (internal, do not use)
-        :param logger (logging.Logger): optional logger object. If none is passed 'openmano.sdn.sdnconn' is used.
-        """
-        self.logger = logger or logging.getLogger('openmano.sdnconn')
-
-        self.wim = wim
-        self.wim_account = wim_account
-        self.config = config or {}
-        self.service_endpoint_mapping = (
-            self.config.get('service_endpoint_mapping', []))
-
-    def check_credentials(self):
-        """Check if the connector itself can access the SDN/WIM with the provided url (wim.wim_url),
-            user (wim_account.user), and password (wim_account.password)
-
-        Raises:
-            SdnConnectorError: Issues regarding authorization, access to
-                external URLs, etc are detected.
-        """
-        raise NotImplementedError
-
-    def get_connectivity_service_status(self, service_uuid, conn_info=None):
-        """Monitor the status of the connectivity service established
-
-        Arguments:
-            service_uuid (str): UUID of the connectivity service
-            conn_info (dict or None): Information returned by the connector
-                during the service creation/edition and subsequently stored in
-                the database.
-
-        Returns:
-            dict: JSON/YAML-serializable dict that contains a mandatory key
-                ``sdn_status`` associated with one of the following values::
-
-                    {'sdn_status': 'ACTIVE'}
-                        # The service is up and running.
-
-                    {'sdn_status': 'INACTIVE'}
-                        # The service was created, but the connector
-                        # cannot determine yet if connectivity exists
-                        # (ideally, the caller needs to wait and check again).
-
-                    {'sdn_status': 'DOWN'}
-                        # Connection was previously established,
-                        # but an error/failure was detected.
-
-                    {'sdn_status': 'ERROR'}
-                        # An error occurred when trying to create the service/
-                        # establish the connectivity.
-
-                    {'sdn_status': 'BUILD'}
-                        # Still trying to create the service, the caller
-                        # needs to wait and check again.
-
-                Additionally ``error_msg``(**str**) and ``sdn_info``(**dict**)
-                keys can be used to provide additional status explanation or
-                new information available for the connectivity service.
-        """
-        raise NotImplementedError
-
-    def create_connectivity_service(self, service_type, connection_points, **kwargs):
-        """
-        Stablish SDN/WAN connectivity between the endpoints
-        :param service_type: (str): ``ELINE`` (L2), ``ELAN`` (L2), ``ETREE`` (L2), ``L3``.
-        :param connection_points:  (list): each point corresponds to
-            an entry point to be connected. For WIM: from the DC to the transport network.
-            For SDN: Compute/PCI to the transport network. One
-            connection point serves to identify the specific access and
-            some other service parameters, such as encapsulation type.
-            Each item of the list is a dict with:
-                "service_endpoint_id": (str)(uuid)  Same meaning that for 'service_endpoint_mapping' (see __init__)
-                    In case the config attribute mapping_not_needed is True, this value is not relevant. In this case
-                    it will contain the string "device_id:device_interface_id"
-                "service_endpoint_encapsulation_type": None, "dot1q", ...
-                "service_endpoint_encapsulation_info": (dict) with:
-                    "vlan": ..., (int, present if encapsulation is dot1q)
-                    "vni": ... (int, present if encapsulation is vxlan),
-                    "peers": [(ipv4_1), (ipv4_2)] (present if encapsulation is vxlan)
-                    "mac": ...
-                    "device_id": ..., same meaning that for 'service_endpoint_mapping' (see __init__)
-                    "device_interface_id": same meaning that for 'service_endpoint_mapping' (see __init__)
-                    "switch_dpid": ..., present if mapping has been found for this device_id,device_interface_id
-                    "swith_port": ... present if mapping has been found for this device_id,device_interface_id
-                    "service_mapping_info": present if mapping has been found for this device_id,device_interface_id
-        :param kwargs: For future versions:
-            bandwidth (int): value in kilobytes
-            latency (int): value in milliseconds
-            Other QoS might be passed as keyword arguments.
-        :return: tuple: ``(service_id, conn_info)`` containing:
-            - *service_uuid* (str): UUID of the established connectivity service
-            - *conn_info* (dict or None): Information to be stored at the database (or ``None``).
-                This information will be provided to the :meth:`~.edit_connectivity_service` and :obj:`~.delete`.
-                **MUST** be JSON/YAML-serializable (plain data structures).
-        :raises: SdnConnectorException: In case of error. Nothing should be created in this case.
-            Provide the parameter http_code
-        """
-        raise NotImplementedError
-
-    def delete_connectivity_service(self, service_uuid, conn_info=None):
-        """
-        Disconnect multi-site endpoints previously connected
-
-        :param service_uuid: The one returned by create_connectivity_service
-        :param conn_info: The one returned by last call to 'create_connectivity_service' or 'edit_connectivity_service'
-            if they do not return None
-        :return: None
-        :raises: SdnConnectorException: In case of error. The parameter http_code must be filled
-        """
-        raise NotImplementedError
-
-    def edit_connectivity_service(self, service_uuid, conn_info=None, connection_points=None, **kwargs):
-        """ Change an existing connectivity service.
-
-        This method's arguments and return value follow the same convention as
-        :meth:`~.create_connectivity_service`.
-
-        :param service_uuid: UUID of the connectivity service.
-        :param conn_info: (dict or None): Information previously returned by last call to create_connectivity_service
-            or edit_connectivity_service
-        :param connection_points: (list): If provided, the old list of connection points will be replaced.
-        :param kwargs: Same meaning that create_connectivity_service
-        :return: dict or None: Information to be updated and stored at the database.
-                When ``None`` is returned, no information should be changed.
-                When an empty dict is returned, the database record will be deleted.
-                **MUST** be JSON/YAML-serializable (plain data structures).
-        Raises:
-            SdnConnectorException: In case of error.
-        """
-
-    def clear_all_connectivity_services(self):
-        """Delete all WAN Links in a WIM.
-
-        This method is intended for debugging only, and should delete all the
-        connections controlled by the WIM/SDN, not only the  connections that
-        a specific RO is aware of.
-
-        Raises:
-            SdnConnectorException: In case of error.
-        """
-        raise NotImplementedError
-
-    def get_all_active_connectivity_services(self):
-        """Provide information about all active connections provisioned by a
-        WIM.
-
-        Raises:
-            SdnConnectorException: In case of error.
-        """
-        raise NotImplementedError
index 68ebf74..febbc31 100644 (file)
@@ -45,7 +45,7 @@ from .errors import (
     NoRecordFound,
     NoExternalPortFound
 )
     NoRecordFound,
     NoExternalPortFound
 )
-from .sdnconn import SdnConnectorError
+from osm_ro_plugin.sdnconn import SdnConnectorError
 
 INSTANCE_NET_STATUS_ERROR = ('DOWN', 'ERROR', 'VIM_ERROR',
                              'DELETED', 'SCHEDULED_DELETION')
 
 INSTANCE_NET_STATUS_ERROR = ('DOWN', 'ERROR', 'VIM_ERROR',
                              'DELETED', 'SCHEDULED_DELETION')
index bf35837..7d57d55 100644 (file)
@@ -59,9 +59,9 @@ from .errors import (
     InvalidParameters as Invalid,
     UndefinedAction,
 )
     InvalidParameters as Invalid,
     UndefinedAction,
 )
-from .failing_connector import FailingConnector
-from .sdnconn import SdnConnectorError
-from .wimconn_dummy import DummyConnector
+from osm_ro_plugin.sdn_failing import SdnFailingConnector
+from osm_ro_plugin.sdnconn import SdnConnectorError
+from osm_ro_plugin.sdn_dummy import SdnDummyConnector
 
 ACTIONS = {
     'instance_wim_nets': wan_link_actions.ACTIONS
 
 ACTIONS = {
     'instance_wim_nets': wan_link_actions.ACTIONS
@@ -69,7 +69,7 @@ ACTIONS = {
 
 CONNECTORS = {
     # "odl": wimconn_odl.OdlConnector,
 
 CONNECTORS = {
     # "odl": wimconn_odl.OdlConnector,
-    "dummy": DummyConnector,
+    "dummy": SdnDummyConnector,
     # Add extra connectors here not managed via plugins
 }
 
     # Add extra connectors here not managed via plugins
 }
 
@@ -111,7 +111,7 @@ class WimThread(threading.Thread):
         super(WimThread, self).__init__(name=name)
         self.plugins = plugins
         if "rosdn_dummy" not in self.plugins:
         super(WimThread, self).__init__(name=name)
         self.plugins = plugins
         if "rosdn_dummy" not in self.plugins:
-            self.plugins["rosdn_dummy"] = DummyConnector
+            self.plugins["rosdn_dummy"] = SdnDummyConnector
 
         self.name = name
         self.connector = None
 
         self.name = name
         self.connector = None
@@ -183,7 +183,7 @@ class WimThread(threading.Thread):
         error_msg_extra = ('Any task targeting WIM account {} ({}) will fail.'
                            .format(account_id, self.wim_account.get('name')))
         self.logger.warning(error_msg_extra)
         error_msg_extra = ('Any task targeting WIM account {} ({}) will fail.'
                            .format(account_id, self.wim_account.get('name')))
         self.logger.warning(error_msg_extra)
-        return FailingConnector(error_msg + '\n' + error_msg_extra)
+        return SdnFailingConnector(error_msg + '\n' + error_msg_extra)
 
     @contextmanager
     def avoid_exceptions(self):
 
     @contextmanager
     def avoid_exceptions(self):
@@ -388,7 +388,7 @@ class WimThread(threading.Thread):
                            self.process_list('refresh')):
                         sleep(self.WAITING_TIME)
 
                            self.process_list('refresh')):
                         sleep(self.WAITING_TIME)
 
-                    if isinstance(self.connector, FailingConnector):
+                    if isinstance(self.connector, SdnFailingConnector):
                         # Wait sometime to try instantiating the connector
                         # again and restart
                         # Increase the recovery time if restarting is not
                         # Wait sometime to try instantiating the connector
                         # again and restart
                         # Increase the recovery time if restarting is not
diff --git a/RO/osm_ro/wim/wimconn_dummy.py b/RO/osm_ro/wim/wimconn_dummy.py
deleted file mode 100644 (file)
index 3e15b64..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-# -*- coding: utf-8 -*-
-##
-# Copyright 2018 Telefonica
-# All Rights Reserved.
-#
-# 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.
-
-"""
-This WIM does nothing and allows using it for testing and when no WIM is needed
-"""
-
-import logging
-from uuid import uuid4
-from .sdnconn import SdnConnectorBase, SdnConnectorError
-from http import HTTPStatus
-__author__ = "Alfonso Tierno <alfonso.tiernosepulveda@telefonica.com>"
-
-
-class DummyConnector(SdnConnectorBase):
-    """Abstract base class for all the WIM connectors
-
-    Arguments:
-        wim (dict): WIM record, as stored in the database
-        wim_account (dict): WIM account record, as stored in the database
-        config (dict): optional persistent information related to an specific
-            connector.  Inside this dict, a special key,
-            ``service_endpoint_mapping`` provides the internal endpoint
-            mapping.
-        logger (logging.Logger): optional logger object. If none is passed
-            ``openmano.wim.wimconn`` is used.
-
-    The arguments of the constructor are converted to object attributes.
-    An extra property, ``service_endpoint_mapping`` is created from ``config``.
-    """
-    def __init__(self, wim, wim_account, config=None, logger=None):
-        self.logger = logger or logging.getLogger('openmano.sdnconn.dummy')
-        super(DummyConnector, self).__init__(wim, wim_account, config, self.logger)
-        self.logger.debug("__init: wim='{}' wim_account='{}'".format(wim, wim_account))
-        self.connections = {}
-        self.counter = 0
-
-    def check_credentials(self):
-        """Check if the connector itself can access the WIM.
-
-        Raises:
-            SdnConnectorError: Issues regarding authorization, access to
-                external URLs, etc are detected.
-        """
-        self.logger.debug("check_credentials")
-        return None
-
-    def get_connectivity_service_status(self, service_uuid, conn_info=None):
-        """Monitor the status of the connectivity service established
-
-        Arguments:
-            service_uuid (str): UUID of the connectivity service
-            conn_info (dict or None): Information returned by the connector
-                during the service creation/edition and subsequently stored in
-                the database.
-
-        Returns:
-            dict: JSON/YAML-serializable dict that contains a mandatory key
-                ``sdn_status`` associated with one of the following values::
-
-                Additionally ``error_msg``(**str**) and ``sdn_info``(**dict**)
-                keys can be used to provide additional status explanation or
-                new information available for the connectivity service.
-        """
-        self.logger.debug("get_connectivity_service_status: service_uuid='{}' conn_info='{}'".format(service_uuid,
-                                                                                                     conn_info))
-        return {'sdn_status': 'ACTIVE', 'sdn_info': self.connectivity.get(service_uuid)}
-
-    def create_connectivity_service(self, service_type, connection_points,
-                                    **kwargs):
-        """
-        Stablish WAN connectivity between the endpoints
-
-        """
-        self.logger.debug("create_connectivity_service: service_type='{}' connection_points='{}', kwargs='{}'".
-                          format(service_type, connection_points, kwargs))
-        _id = str(uuid4())
-        self.connections[_id] = connection_points.copy()
-        self.counter += 1
-        return _id, None
-
-    def delete_connectivity_service(self, service_uuid, conn_info=None):
-        """Disconnect multi-site endpoints previously connected
-
-        """
-        self.logger.debug("delete_connectivity_service: service_uuid='{}' conn_info='{}'".format(service_uuid,
-                                                                                                 conn_info))
-        if service_uuid not in self.connections:
-            raise SdnConnectorError("connectivity {} not found".format(service_uuid),
-                                    http_code=HTTPStatus.NOT_FOUND.value)
-        self.connections.pop(service_uuid, None)
-        return None
-
-    def edit_connectivity_service(self, service_uuid, conn_info=None,
-                                  connection_points=None, **kwargs):
-        """Change an existing connectivity service.
-
-        This method's arguments and return value follow the same convention as
-        :meth:`~.create_connectivity_service`.
-        """
-        self.logger.debug("edit_connectivity_service: service_uuid='{}' conn_info='{}', connection_points='{}'"
-                          "kwargs='{}'".format(service_uuid, conn_info, connection_points, kwargs))
-        if service_uuid not in self.connections:
-            raise SdnConnectorError("connectivity {} not found".format(service_uuid),
-                                    http_code=HTTPStatus.NOT_FOUND.value)
-        self.connections[service_uuid] = connection_points.copy()
-        return None
-
-    def clear_all_connectivity_services(self):
-        """Delete all WAN Links in a WIM.
-
-        This method is intended for debugging only, and should delete all the
-        connections controlled by the WIM, not only the WIM connections that
-        a specific RO is aware of.
-
-        """
-        self.logger.debug("clear_all_connectivity_services")
-        self.connections.clear()
-        return None
-
-    def get_all_active_connectivity_services(self):
-        """Provide information about all active connections provisioned by a
-        WIM.
-
-        Raises:
-            SdnConnectorException: In case of error.
-        """
-        self.logger.debug("get_all_active_connectivity_services")
-        return self.connections
index 6260296..b5129dc 100644 (file)
@@ -15,7 +15,7 @@
 X-Python3-Version : >= 3.5
 Maintainer: Gerardo Garcia <gerardo.garciadeblas@telefonica.com>
 Depends3 : python3-bottle, python3-jsonschema, python3-mysqldb, python3-paramiko, python3-yaml,
 X-Python3-Version : >= 3.5
 Maintainer: Gerardo Garcia <gerardo.garciadeblas@telefonica.com>
 Depends3 : python3-bottle, python3-jsonschema, python3-mysqldb, python3-paramiko, python3-yaml,
-           libmysqlclient-dev, mysql-client,
+           libmysqlclient-dev, mysql-client, python3-osm-ro-plugin,
            python3-requests, python3-netaddr,
            python3-osm-im,
 
            python3-requests, python3-netaddr,
            python3-osm-im,
 
index aea4749..d14f8d9 100755 (executable)
@@ -24,7 +24,11 @@ cp RO/deb_dist/python3-osm-ro_*.deb deb_dist/
 make -C RO-client clean package
 cp RO-client/deb_dist/python3-osm-roclient_*.deb deb_dist/
 
 make -C RO-client clean package
 cp RO-client/deb_dist/python3-osm-roclient_*.deb deb_dist/
 
-# VIM plugings:  vmware, openstack, AWS, fos, azure, Opennebula, 
+# RO plugin
+make -C RO-plugin clean package
+cp RO-plugin/deb_dist/python3-osm-ro-plugin_*.deb deb_dist/
+
+# VIM plugings:  vmware, openstack, AWS, fos, azure, Opennebula,
 for vim_plugin in RO-VIM-*
 do
     make -C $vim_plugin clean package
 for vim_plugin in RO-VIM-*
 do
     make -C $vim_plugin clean package
index 3d04c1f..a869031 100755 (executable)
 # contact with: nfvlabs@tid.es
 ##
 
 # contact with: nfvlabs@tid.es
 ##
 
-# Generates the debian packages; and then generates a docker image base on Dockerfile-devops and update a
-# running docker stack with the generated image
+[[ "$*" == *--help* ]] && echo \
+"This script tests docker build based on debian packages. It generates a docker image bases on Dockerfile-devops, " \
+"prints package information and if desired updates OSM RO docker with the generated image.
+Generated packages are stored at './temp' folder.
+Options:
+  --help        show this help
+  --no-cache    Use if found problems looking for packages
+  --update      Use to update OSM, RO docker with this image" && exit 0
+
+[[ "$*" == *--no-cache* ]] && no_cache="--no_cache" || no_cache=""
+[[ "$*" == *--update* ]] && update_osm="k8s" || update_osm=""
 
 HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
 export RO_BASE=$(dirname $HERE)
 
 HERE=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
 export RO_BASE=$(dirname $HERE)
@@ -29,11 +38,11 @@ rm -rf $HERE/temp/*
 find $RO_BASE  -name "*.pyc" -exec rm {} ";"
 mkdir -p $HERE/temp
 
 find $RO_BASE  -name "*.pyc" -exec rm {} ";"
 mkdir -p $HERE/temp
 
-echo -e "\n\n[STAGE 1] Builind dockerfile userd for the package generation"
+echo -e "\n\n[STAGE 1] Building dockerfile used for the package generation"
 docker build $RO_BASE -f $RO_BASE/Dockerfile  -t opensourcemano/ro_pkg
 sleep 2
 
 docker build $RO_BASE -f $RO_BASE/Dockerfile  -t opensourcemano/ro_pkg
 sleep 2
 
-echo "[STAGE 1.1] Generting packages inside docker ro_pkg"
+echo "[STAGE 1.1] Generating packages inside docker ro_pkg"
 docker run -d --name ro_pkg opensourcemano/ro_pkg bash -c 'sleep 3600'
 docker cp $RO_BASE ro_pkg:/RO
 docker exec ro_pkg bash -c 'cd /RO;  ./devops-stages/stage-build.sh'
 docker run -d --name ro_pkg opensourcemano/ro_pkg bash -c 'sleep 3600'
 docker cp $RO_BASE ro_pkg:/RO
 docker exec ro_pkg bash -c 'cd /RO;  ./devops-stages/stage-build.sh'
@@ -44,23 +53,33 @@ echo $deb_files
 echo -e "\n\n[STAGE 1.2] Print package information and copy to '$HERE/temp/'"
 # print package information and copy to "$HERE/temp/"
 for deb_file in $deb_files ; do
 echo -e "\n\n[STAGE 1.2] Print package information and copy to '$HERE/temp/'"
 # print package information and copy to "$HERE/temp/"
 for deb_file in $deb_files ; do
-   echo; echo; echo
-   echo $deb_file info:
-   echo "===========================" 
-   docker cp ro_pkg:/RO/deb_dist/$deb_file $HERE/temp/
-   dpkg -I $HERE/temp/$(basename $deb_file)
+    echo; echo; echo
+    echo $deb_file info:
+    echo "==========================="
+    docker cp ro_pkg:/RO/deb_dist/$deb_file $HERE/temp/
+    dpkg -I $HERE/temp/$(basename $deb_file)
 done
 
 # docker rm -f ro_pkg
 echo -e "\n\n[STAGE 2] Building docker image opensourcemano/ro:py3_devops based on debian packages"
 done
 
 # docker rm -f ro_pkg
 echo -e "\n\n[STAGE 2] Building docker image opensourcemano/ro:py3_devops based on debian packages"
-docker build $HERE -f $HERE/Dockerfile-devops  -t opensourcemano/ro:py3_devops ||
+docker build $HERE -f $HERE/Dockerfile-devops  -t opensourcemano/ro:py3_devops $no_cache ||
     ! echo "error generating devops dockerfile" >&2 || exit 1
     ! echo "error generating devops dockerfile" >&2 || exit 1
+
+[[ -z "$update_osm" ]] && exit 0
 sleep 2
 sleep 2
-# docker run -d --name ro_devops opensourcemano/ro:py3_devops
-# docker run -ti exec ro_devops ro tenant-list  || ! echo "Cannot exec ro client to get server tenants" >&2 || exit 1
 
 echo -e "\n\n[STAGE 3] Update service osm_ro with generated docker image"
 
 echo -e "\n\n[STAGE 3] Update service osm_ro with generated docker image"
-docker service update osm_ro --force --image opensourcemano/ro:py3_devops
-sleep 2
-docker container prune -f
+# try docker swarm. If fails try kebernetes
+if docker service update osm_ro --force --image opensourcemano/ro:py3_devops 2>/dev/null
+then
+    sleep 2
+    docker container prune -f
+elif kubectl -n osm patch deployment ro --patch \
+        '{"spec": {"template": {"spec": {"containers": [{"name": "ro", "image": "opensourcemano/ro:py3_devops"}]}}}}'
+then
+    kubectl -n osm scale deployment ro --replicas=0
+    kubectl -n osm scale deployment ro --replicas=1
+else
+    echo "Cannot update OSM" && exit 1
+fi
 docker service logs osm_ro
 docker service logs osm_ro