)
plugin_name = ""
vim = None
+ step = "Getting {}={} from db".format(target, _id)
try:
- step = "Getting {}={} from db".format(target, _id)
# TODO process for wim, sdnc, ...
vim = self.db.get_one(target_database, {"_id": _id})
}
def _format_in(self, kwargs):
+
+ error_text = ""
try:
indata = None
for connection_point in connection_points:
endpoint_id = connection_point.get(self.__SERVICE_ENDPOINT_PARAM)
- port = filter(
- lambda x: x.get(self.__WAN_SERVICE_ENDPOINT_PARAM) == endpoint_id,
- port_mapping,
+ port = list(
+ filter(
+ lambda x: x.get(self.__WAN_SERVICE_ENDPOINT_PARAM) == endpoint_id,
+ port_mapping,
+ )
)[0]
port_info = port.get(self.__WAN_MAPPING_INFO_PARAM)
selected_ports.append(port_info)
except AuthError:
# If there is an auth error retry just once
if retry_auth_error:
- return self._request(
- self, op, url, headers, data, retry_auth_error=False
- )
+ return self._request(op, url, headers, data, retry_auth_error=False)
def _request_noauth(self, op, url, headers, data=None):
# Method to execute http requests with error control
"virtual-network"
)
- def get_virtual_networks(self):
- return self.get_all_by_type("virtual-networks")
-
def get_virtual_network(self, network_id):
return self.get_by_uuid("virtual-network", network_id)
def get_vpgs(self):
return self.get_all_by_type(self.controller_url, "virtual-port-groups")
- def get_vpg(self, vpg_id):
- return self.get_by_uuid(self.controller_url, "virtual-port-group", vpg_id)
-
def get_vpg_by_name(self, vpg_name):
fq_name = ["default-global-system-config", self.fabric, vpg_name]
"virtual-machine-interface"
)
- def get_vmi(self, vmi_uuid):
- return self.get_by_uuid(
- self.controller_url, "virtual-machine-interface", vmi_uuid
- )
-
def delete_vmi(self, uuid):
self.logger.debug("delete vmi uuid: {}".format(uuid))
self.delete_by_uuid(self.controller_url, "virtual-machine-interface", uuid)
except Exception as e:
self.format_vimconn_exception(e)
- 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': memory in MB
- 'vcpus': number of virtual cpus
- #todo: complete parameters for EPA
- Returns the flavor_id or raises a vimconnNotFoundException
- """
- self.logger.debug("Getting flavor id from data")
-
- try:
- flavor = None
- for key, values in self.flavor_info.items():
- if (values["ram"], values["cpus"], values["disk"]) == (
- flavor_dict["ram"],
- flavor_dict["vcpus"],
- flavor_dict["disk"],
- ):
- flavor = (key, values)
- break
- elif (values["ram"], values["cpus"], values["disk"]) >= (
- flavor_dict["ram"],
- flavor_dict["vcpus"],
- flavor_dict["disk"],
- ):
- if not flavor:
- flavor = (key, values)
- else:
- if (flavor[1]["ram"], flavor[1]["cpus"], flavor[1]["disk"]) >= (
- values["ram"],
- values["cpus"],
- values["disk"],
- ):
- flavor = (key, values)
-
- if flavor:
- return flavor[0]
-
- raise vimconn.VimConnNotFoundException(
- "Cannot find flavor with this flavor ID/Name"
- )
- except Exception as e:
- self.format_vimconn_exception(e)
-
def new_image(self, image_dict):
"""Adds a tenant image to VIM
Params: image_dict
else:
raise vimconn.VimConnException(
"Failed to get instance_id for reservation",
- reservation,
http_code=vimconn.HTTP_Request_Timeout,
)
)
)
- # NOT USED FUNCTIONS
-
- def new_external_port(self, port_data):
- """Adds a external port to VIM
- Returns the port identifier"""
- # TODO openstack if needed
- return (
- -vimconn.HTTP_Internal_Server_Error,
- "osconnector.new_external_port() not implemented",
- )
-
- 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"""
- # TODO openstack if needed
- return (
- -vimconn.HTTP_Internal_Server_Error,
- "osconnector.connect_port_network() not implemented",
- )
-
- def new_user(self, user_name, user_passwd, tenant_id=None):
- """Adds a new user to openstack VIM
- Returns the user identifier"""
- self.logger.debug("osconnector: Adding a new user to VIM")
-
- try:
- self._reload_connection()
- user = self.keystone.users.create(
- user_name, password=user_passwd, default_project=tenant_id
- )
- # self.keystone.tenants.add_user(self.k_creds["username"], #role)
-
- return user.id
- except ksExceptions.ConnectionError as e:
- error_value = -vimconn.HTTP_Bad_Request
- error_text = (
- type(e).__name__
- + ": "
- + (str(e) if len(e.args) == 0 else str(e.args[0]))
- )
- except ksExceptions.ClientException as e: # TODO remove
- error_value = -vimconn.HTTP_Bad_Request
- error_text = (
- type(e).__name__
- + ": "
- + (str(e) if len(e.args) == 0 else str(e.args[0]))
- )
-
- # TODO insert exception vimconn.HTTP_Unauthorized
- # if reaching here is because an exception
- self.logger.debug("new_user " + error_text)
-
- return error_value, error_text
-
def delete_user(self, user_id):
"""Delete a user from openstack VIM
Returns the user identifier"""
rules_to_delete = created_items.get("installed_rules_ids") or []
new_installed_rules_ids = []
error_list = []
+ step = "Checking ports and network type compatibility"
try:
- step = "Checking ports and network type compatibility"
if ifaces_nb < 2:
pass
elif net_type == "ELINE":
TOX_ENV_LIST="$(echo $PACKAGES | sed "s/ /,/g")"
PROCESSES=$(expr `nproc --a` / 2)
-TOX_PARALLEL_NO_SPINNER=1 tox -e $TOX_ENV_LIST --parallel $PROCESSES
+TOX_PARALLEL_NO_SPINNER=1 tox -e $TOX_ENV_LIST
# Copying packages
# RO plugin
# limitations under the License.
set -e
echo "Launching tox"
-tox --parallel=auto
+tox
--- /dev/null
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# 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.
+#######################################################################################
+---
+other:
+ - |
+ Enabling Pylint in tox.ini, removing some unused and erroneous methods,
+ updating required libraries.
+
#######################################################################################
-e RO-plugin
# via -r requirements-test.in
-coverage==6.4.1
- # via
- # -r requirements-test.in
- # nose2
-mock==4.0.3
+coverage==7.0.5
# via -r requirements-test.in
-nose2==0.11.0
+mock==5.0.1
+ # via -r requirements-test.in
+nose2==0.12.0
# via -r requirements-test.in
-six==1.16.0
- # via nose2
# via msrestazure
appdirs==1.4.4
# via openstacksdk
-attrs==21.4.0
+atpublic==3.1.1
+ # via flufl-enum
+attrs==22.2.0
# via
# cmd2
# jsonschema
# azure-mgmt-compute
# azure-mgmt-network
# azure-mgmt-resource
-azure-core==1.24.1
+azure-core==1.26.2
# via
# azure-identity
# azure-mgmt-core
# msrest
-azure-identity==1.10.0
+azure-identity==1.12.0
# via -r RO-VIM-azure/requirements.in
-azure-mgmt-compute==27.1.0
+azure-mgmt-compute==29.0.0
# via -r RO-VIM-azure/requirements.in
-azure-mgmt-core==1.3.1
+azure-mgmt-core==1.3.2
# via
# azure-mgmt-compute
# azure-mgmt-network
# azure-mgmt-resource
-azure-mgmt-network==20.0.0
+azure-mgmt-network==22.2.0
# via -r RO-VIM-azure/requirements.in
-azure-mgmt-resource==21.1.0
+azure-mgmt-resource==22.0.0
# via -r RO-VIM-azure/requirements.in
-bcrypt==3.2.2
+bcrypt==4.0.1
# via paramiko
boto==2.49.0
# via -r RO-VIM-aws/requirements.in
-cachetools==5.2.0
+cachetools==5.2.1
# via google-auth
-certifi==2022.6.15
+certifi==2022.12.7
# via
# msrest
# requests
-cffi==1.15.0
+cffi==1.15.1
# via
- # bcrypt
# cryptography
# pynacl
-charset-normalizer==2.0.12
+charset-normalizer==3.0.1
# via requests
-cheroot==8.6.0
+cheroot==9.0.0
# via cherrypy
cherrypy==18.1.2
# via -r NG-RO/requirements.in
-cliff==3.10.1
+cliff==4.1.0
# via
# osc-lib
# python-neutronclient
# python-openstackclient
-cmd2==2.4.1
+cmd2==2.4.2
# via cliff
-cryptography==37.0.2
+cryptography==39.0.0
# via
# -r NG-RO/requirements.in
# adal
# paramiko
# pyjwt
# pyopenssl
-cvprac==1.2.0
+cvprac==1.2.2
# via -r RO-SDN-arista_cloudvision/requirements.in
debtcollector==2.5.0
# via
# via
# dogpile-cache
# openstacksdk
-dogpile-cache==1.1.6
+dogpile-cache==1.1.8
# via openstacksdk
-flufl-enum==4.1.1
+flufl-enum==5.0.1
# via pyvcloud
-google-api-core==2.8.2
+google-api-core==2.11.0
# via google-api-python-client
-google-api-python-client==2.51.0
+google-api-python-client==2.72.0
# via -r RO-VIM-gcp/requirements.in
-google-auth==2.8.0
+google-auth==2.16.0
# via
# -r RO-VIM-gcp/requirements.in
# google-api-core
# via google-api-python-client
google-cloud==0.34.0
# via -r RO-VIM-gcp/requirements.in
-googleapis-common-protos==1.56.3
+googleapis-common-protos==1.58.0
# via google-api-core
-httplib2==0.20.4
+httplib2==0.21.0
# via
# google-api-python-client
# google-auth-httplib2
humanfriendly==10.0
# via pyvcloud
-idna==3.3
+idna==3.4
# via requests
-importlib-metadata==4.11.4
- # via -r NG-RO/requirements.in
+importlib-metadata==6.0.0
+ # via
+ # -r NG-RO/requirements.in
+ # cliff
+importlib-resources==5.10.2
+ # via jsonschema
ipconflict==0.5.0
# via -r RO-VIM-aws/requirements.in
-iso8601==1.0.2
+iso8601==1.1.0
# via
# keystoneauth1
# openstacksdk
# python-openstackclient
isodate==0.6.1
# via msrest
-jaraco-functools==3.5.0
- # via
- # cheroot
- # tempora
+jaraco-functools==3.5.2
+ # via cheroot
jinja2==3.1.2
# via -r NG-RO/requirements.in
jmespath==1.0.1
# warlock
jsonpointer==2.3
# via jsonpatch
-jsonschema==3.2.0
+jsonschema==4.17.3
# via warlock
-keystoneauth1==4.6.0
+keystoneauth1==5.1.1
# via
# openstacksdk
# osc-lib
# python-novaclient
logutils==0.3.5
# via -r NG-RO/requirements.in
-lxml==4.9.0
+lxml==4.9.2
# via pyvcloud
markupsafe==2.1.1
# via jinja2
-more-itertools==8.13.0
+more-itertools==9.0.0
# via
# cheroot
# cherrypy
# jaraco-functools
-msal==1.18.0
+msal==1.20.0
# via
# azure-identity
# msal-extensions
# via
# openstacksdk
# oslo-utils
-oauthlib==3.2.0
+oauthlib==3.2.2
# via requests-oauthlib
-openstacksdk==0.99.0
+openstacksdk==0.103.0
# via
# os-client-config
# osc-lib
# via
# keystoneauth1
# openstacksdk
-osc-lib==2.6.0
+osc-lib==2.6.2
# via
# python-neutronclient
# python-openstackclient
-oslo-config==8.8.0
+oslo-config==9.1.0
# via
# oslo-log
# python-keystoneclient
-oslo-context==4.1.0
+oslo-context==5.0.0
# via oslo-log
oslo-i18n==5.1.0
# via
# python-neutronclient
# python-novaclient
# python-openstackclient
-oslo-log==5.0.0
+oslo-log==5.0.2
# via python-neutronclient
-oslo-serialization==4.3.0
+oslo-serialization==5.0.0
# via
# oslo-log
# python-keystoneclient
# python-neutronclient
# python-novaclient
-oslo-utils==6.0.0
+oslo-utils==6.1.0
# via
# osc-lib
# oslo-log
# python-neutronclient
# python-novaclient
# python-openstackclient
-packaging==21.3
+packaging==23.0
# via
# oslo-utils
# python-keystoneclient
-paramiko==2.11.0
+paramiko==2.12.0
# via
# -r RO-SDN-dpb/requirements.in
# -r RO-VIM-gcp/requirements.in
# -r RO-plugin/requirements.in
-pbr==5.9.0
+pbr==5.11.1
# via
- # cliff
# keystoneauth1
# openstacksdk
# os-service-types
# python-novaclient
# python-openstackclient
# stevedore
-portalocker==2.4.0
+pkgutil-resolve-name==1.3.10
+ # via jsonschema
+portalocker==2.6.0
# via msal-extensions
portend==3.1.0
# via cherrypy
-prettytable==3.3.0
+prettytable==3.6.0
# via
# -r RO-VIM-vmware/requirements.in
# cliff
# python-novaclient
progressbar==2.5
# via -r RO-VIM-vmware/requirements.in
-protobuf==4.21.1
+protobuf==4.21.12
# via
# google-api-core
# googleapis-common-protos
# via google-auth
pycparser==2.21
# via cffi
-pygments==2.12.0
+pygments==2.14.0
# via pyvcloud
pyinotify==0.9.6
# via oslo-log
-pyjwt[crypto]==2.4.0
+pyjwt[crypto]==2.6.0
# via
# adal
# msal
pynacl==1.5.0
# via paramiko
-pyopenssl==22.0.0
+pyopenssl==23.0.0
# via python-glanceclient
pyparsing==3.0.9
# via
- # cliff
# httplib2
# oslo-utils
- # packaging
pyperclip==1.8.2
# via cmd2
-pyrsistent==0.18.1
+pyrsistent==0.19.3
# via jsonschema
python-cinderclient==7.4.1
# via
# via
# adal
# oslo-log
-python-glanceclient==4.0.0
+python-glanceclient==4.2.0
# via -r RO-VIM-openstack/requirements.in
-python-keystoneclient==4.5.0
+python-keystoneclient==5.0.1
# via
# -r RO-VIM-openstack/requirements.in
# python-neutronclient
# python-openstackclient
-python-neutronclient==7.8.0
+python-neutronclient==8.2.1
# via -r RO-VIM-openstack/requirements.in
-python-novaclient==18.0.0
+python-novaclient==18.2.0
# via
# -r RO-VIM-openstack/requirements.in
# python-openstackclient
-python-openstackclient==5.8.0
+python-openstackclient==6.0.0
# via -r RO-VIM-openstack/requirements.in
-pytz==2022.1
+pytz==2022.7.1
# via
# oslo-serialization
# oslo-utils
# tempora
pyvcloud==19.1.1
# via -r RO-VIM-vmware/requirements.in
-pyvmomi==7.0.3
+pyvmomi==8.0.0.1.1
# via -r RO-VIM-vmware/requirements.in
pyyaml==5.4.1
# via
# openstacksdk
# oslo-config
# pyvcloud
-requests==2.28.0
+requests==2.28.2
# via
# -r NG-RO/requirements.in
# -r RO-SDN-arista_cloudvision/requirements.in
# python-keystoneclient
# python-neutronclient
# pyvcloud
- # pyvmomi
# requests-oauthlib
requests-oauthlib==1.3.1
# via msrest
# via openstacksdk
rfc3986==2.0.0
# via oslo-config
-rsa==4.8
+rsa==4.9
# via google-auth
-simplejson==3.17.6
+simplejson==3.18.1
# via
# osc-lib
# python-cinderclient
# google-auth
# google-auth-httplib2
# isodate
- # jsonschema
# keystoneauth1
# msrestazure
# munch
# python-dateutil
# python-keystoneclient
# pyvmomi
- # warlock
-stevedore==3.5.0
+stevedore==4.1.1
# via
# cliff
# dogpile-cache
# python-keystoneclient
# python-novaclient
# python-openstackclient
-tempora==5.0.1
+tempora==5.2.0
# via portend
-tqdm==4.64.0
+tqdm==4.64.1
# via ipconflict
-typing-extensions==4.2.0
+typing-extensions==4.4.0
# via azure-core
uritemplate==4.1.1
# via google-api-python-client
-urllib3==1.26.9
+urllib3==1.26.14
# via requests
uuid==1.30
# via -r RO-SDN-arista_cloudvision/requirements.in
-warlock==1.3.3
+warlock==2.0.1
# via python-glanceclient
-wcwidth==0.2.5
+wcwidth==0.2.6
# via
# cmd2
# prettytable
# python-glanceclient
zc-lockfile==2.0
# via cherrypy
-zipp==3.8.0
- # via importlib-metadata
+zipp==3.11.0
+ # via
+ # importlib-metadata
+ # importlib-resources
# The following packages are considered to be unsafe in a requirements file:
# setuptools
#######################################################################################
[tox]
-envlist = black, flake8, safety, cover
+envlist = black, cover, flake8, pylint, safety
[tox:jenkins]
toxworkdir = /tmp/.tox
pylint
skip_install = true
commands =
- - pylint -E NG-RO/osm_ng_ro
- - pylint -E RO-plugin/osm_ro_plugin
- - pylint -E RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision
- - pylint -E RO-SDN-dpb/osm_rosdn_dpb
- - pylint -E RO-SDN-dynpac/osm_rosdn_dynpac
- - pylint -E RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
- - pylint -E RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn
- - pylint -E RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail
- - pylint -E RO-SDN-odl_openflow/osm_rosdn_odlof
- - pylint -E RO-SDN-onos_openflow/osm_rosdn_onosof
- - pylint -E RO-SDN-onos_vpls/osm_rosdn_onos_vpls
- - pylint -E RO-VIM-aws/osm_rovim_aws
- - pylint -E RO-VIM-azure/osm_rovim_azure
- - pylint -E RO-VIM-openstack/osm_rovim_openstack
- - pylint -E RO-VIM-openvim/osm_rovim_openvim
- - pylint -E RO-VIM-vmware/osm_rovim_vmware
- - pylint -E RO-VIM-gcp/osm_rovim_gcp
+ pylint -E NG-RO/osm_ng_ro --disable=E1101
+ pylint -E RO-plugin/osm_ro_plugin --disable=E1101
+ pylint -E RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision --disable=all
+ pylint -E RO-SDN-dpb/osm_rosdn_dpb
+ pylint -E RO-SDN-dynpac/osm_rosdn_dynpac --disable=E1101
+ pylint -E RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
+ pylint -E RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn --disable=E1101
+ pylint -E RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail
+ pylint -E RO-SDN-odl_openflow/osm_rosdn_odlof
+ pylint -E RO-SDN-onos_openflow/osm_rosdn_onosof
+ pylint -E RO-SDN-onos_vpls/osm_rosdn_onos_vpls --disable=E1101
+ pylint -E RO-VIM-aws/osm_rovim_aws
+ pylint -E RO-VIM-azure/osm_rovim_azure --disable=all
+ pylint -E RO-VIM-openstack/osm_rovim_openstack --disable=E1101
+ pylint -E RO-VIM-openvim/osm_rovim_openvim --disable=all
+ pylint -E RO-VIM-vmware/osm_rovim_vmware --disable=all
+ pylint -E RO-VIM-gcp/osm_rovim_gcp --disable=E1101
#######################################################################################