pdb.set_trace()
+def find_in_list(the_list, condition_lambda):
+ for item in the_list:
+ if condition_lambda(item):
+ return item
+ else:
+ return None
+
+
class vimconnector(vimconn.VimConnector):
# Translate azure provisioning state to OSM provision state
if "flavors_pattern" in config:
self._config["flavors_pattern"] = config["flavors_pattern"]
+ def _find_in_capabilities(self, capabilities, name):
+ cap = find_in_list(capabilities, lambda c: c["name"] == name)
+ if cap:
+ return cap.get("value")
+ else:
+ return None
+
def _reload_connection(self):
"""
Called before any operation, checks python azure clients
try:
self._reload_connection()
vm_sizes_list = [
- vm_size.serialize()
+ vm_size.as_dict()
for vm_size in self.conn_compute.resource_skus.list(
- "location={}".format(self.region)
+ "location eq '{}'".format(self.region)
)
]
numberInterfaces = len(filter_dict.get("interfaces", [])) or 0
# Filter
- if self._config.get("flavors_pattern"):
- filtered_sizes = [
- size
- for size in vm_sizes_list
- if size["capabilities"]["vCPUs"] >= cpus
- and size["capabilities"]["MemoryGB"] >= memMB / 1024
- and size["capabilities"]["MaxNetworkInterfaces"] >= numberInterfaces
- and re.search(self._config.get("flavors_pattern"), size["name"])
- ]
- else:
- filtered_sizes = [
- size
- for size in vm_sizes_list
- if size["capabilities"]["vCPUs"] >= cpus
- and size["capabilities"]["MemoryGB"] >= memMB / 1024
- and size["capabilities"]["MaxNetworkInterfaces"] >= numberInterfaces
- ]
+ filtered_sizes = []
+ for size in vm_sizes_list:
+ if size["resource_type"] == "virtualMachines":
+ size_cpus = int(
+ self._find_in_capabilities(size["capabilities"], "vCPUs")
+ )
+ size_memory = float(
+ self._find_in_capabilities(size["capabilities"], "MemoryGB")
+ )
+ size_interfaces = self._find_in_capabilities(
+ size["capabilities"], "MaxNetworkInterfaces"
+ )
+ if size_interfaces:
+ size_interfaces = int(size_interfaces)
+ else:
+ self.logger.debug(
+ "Flavor with no defined MaxNetworkInterfaces: {}".format(
+ size["name"]
+ )
+ )
+ continue
+ if (
+ size_cpus >= cpus
+ and size_memory >= memMB / 1024
+ and size_interfaces >= numberInterfaces
+ ):
+ if self._config.get("flavors_pattern"):
+ if re.search(
+ self._config.get("flavors_pattern"), size["name"]
+ ):
+ new_size = {
+ e["name"]: e["value"] for e in size["capabilities"]
+ }
+ new_size["name"] = size["name"]
+ filtered_sizes.append(new_size)
+ else:
+ new_size = {
+ e["name"]: e["value"] for e in size["capabilities"]
+ }
+ new_size["name"] = size["name"]
+ filtered_sizes.append(new_size)
# Sort
listedFilteredSizes = sorted(
filtered_sizes,
key=lambda k: (
- k["numberOfCores"],
- k["memoryInMB"],
- k["resourceDiskSizeInMB"],
+ int(k["vCPUs"]),
+ float(k["MemoryGB"]),
+ int(k["MaxNetworkInterfaces"]),
+ int(k["MaxResourceVolumeMB"]),
),
)
try:
self._reload_connection()
vm_sizes_list = [
- vm_size.serialize()
+ vm_size.as_dict()
for vm_size in self.conn_compute.resource_skus.list(
- "location={}".format(self.region)
+ "location eq '{}'".format(self.region)
)
]
logger.debug("Network_list: {}".format(network_list))
logger.debug("List flavors")
- flavors = azure.get_flavor_id_from_data({"vcpu": "2"})
+ flavors = azure.get_flavor_id_from_data({"vcpus": 2})
logger.debug("flavors: {}".format(flavors))
"""
logger.debug("Vmachine: {}".format(vmachine))
"""
+ """
logger.debug("List images")
image = azure.get_image_list({"name": "Canonical:UbuntuServer:16.04"})
# image = azure.get_image_list({"name": "Canonical:UbuntuServer:18.04-LTS"})
logger.debug("image: {}".format(image))
+ """
"""
# Create network and test machine
#######################################################################################
adal==1.2.7
# via msrestazure
-aenum==3.0.0
+aenum==3.1.0
# via pyone
alabaster==0.7.12
# via sphinx
-alembic==1.5.8
+alembic==1.6.5
# via
# neutron
# oslo.db
# via openstacksdk
argparse==1.4.0
# via unittest2
-attrs==20.3.0
+attrs==21.2.0
# via
# cmd2
# jsonschema
# azure-mgmt-core
azure-identity==1.6.0
# via -r RO-VIM-azure/requirements.in
-azure-mgmt-compute==20.0.0
+azure-mgmt-compute==21.0.0
# via -r RO-VIM-azure/requirements.in
azure-mgmt-core==1.2.2
# via
# via -r RO-VIM-azure/requirements.in
azure-mgmt-resource==18.0.0
# via -r RO-VIM-azure/requirements.in
-babel==2.9.0
+babel==2.9.1
# via sphinx
bcrypt==3.2.0
# via paramiko
beautifulsoup4==4.9.3
# via webtest
-bitarray==2.0.1
+bitarray==2.1.0
# via pyangbind
boto==2.49.0
# via -r RO-VIM-aws/requirements.in
-cachetools==4.2.1
+cachetools==4.2.2
# via oslo.messaging
certifi==2020.12.5
# via
# via cherrypy
cherrypy==18.1.2
# via -r NG-RO/requirements.in
-cliff==3.7.0
+cliff==3.8.0
# via
# osc-lib
# python-designateclient
# paramiko
# pyjwt
# pyopenssl
-cvprac==1.0.5
+cvprac==1.0.6
# via -r RO-SDN-arista_cloudvision/requirements.in
debtcollector==2.2.0
# via
# python-designateclient
# python-keystoneclient
# python-neutronclient
-decorator==5.0.7
+decorator==5.0.9
# via
# dogpile.cache
# neutron
# via pyone
dnspython==1.16.0
# via eventlet
-docutils==0.16
+docutils==0.17.1
# via sphinx
-dogpile.cache==1.1.2
+dogpile.cache==1.1.3
# via
# openstacksdk
# oslo.cache
enum34==1.1.10
# via pyangbind
-eventlet==0.30.2
+eventlet==0.31.0
# via
# neutron
# os-ken
# neutron
# oslo.messaging
# tooz
-greenlet==1.0.0
+greenlet==1.1.0
# via
# eventlet
# oslo.privsep
# via requests
imagesize==1.2.0
# via sphinx
-importlib-metadata==4.0.1
- # via
- # -r NG-RO/requirements.in
- # cmd2
- # jsonschema
- # kombu
- # openstacksdk
- # oslo.config
- # osprofiler
- # sqlalchemy
- # stevedore
-importlib-resources==5.1.2
- # via netaddr
+importlib-metadata==4.3.1
+ # via -r NG-RO/requirements.in
iso8601==0.1.14
# via
# keystoneauth1
# via
# cheroot
# tempora
-jinja2==2.11.3
+jinja2==3.0.1
# via
# neutron
# oslo.middleware
# python-novaclient
keystonemiddleware==9.2.0
# via neutron
-kombu==5.0.2
+kombu==5.1.0
# via oslo.messaging
linecache2==1.0.0
# via traceback2
# via
# alembic
# pecan
-markupsafe==1.1.1
+markupsafe==2.0.1
# via
# jinja2
# mako
-more-itertools==8.7.0
+more-itertools==8.8.0
# via
# cheroot
# cherrypy
# via requests-oauthlib
oca==4.10.0
# via -r RO-VIM-opennebula/requirements.in
-openstacksdk==0.56.0
+openstacksdk==0.57.0
# via
# neutron
# os-client-config
# openstacksdk
os-traits==2.5.0
# via neutron-lib
-os-vif==2.4.0
+os-vif==2.5.0
# via neutron
-osc-lib==2.3.1
+osc-lib==2.4.0
# via
# python-designateclient
# python-neutronclient
# python-openstackclient
-oslo.cache==2.7.0
+oslo.cache==2.8.0
# via
# keystonemiddleware
# neutron
# oslo.service
# oslo.versionedobjects
# osprofiler
-oslo.config==8.5.0
+oslo.config==8.7.0
# via
# keystonemiddleware
# neutron
# oslo.versionedobjects
# pycadf
# python-keystoneclient
-oslo.context==3.2.0
+oslo.context==3.3.0
# via
# keystonemiddleware
# neutron
# oslo.middleware
# oslo.policy
# oslo.versionedobjects
-oslo.db==8.5.0
+oslo.db==9.0.0
# via
# neutron
# neutron-lib
# python-neutronclient
# python-novaclient
# python-openstackclient
-oslo.log==4.4.0
+oslo.log==4.5.0
# via
# keystonemiddleware
# neutron
# oslo.service
# oslo.versionedobjects
# python-neutronclient
-oslo.messaging==12.7.1
+oslo.messaging==12.8.0
# via
# neutron
# neutron-lib
# via
# neutron
# oslo.messaging
-oslo.policy==3.7.0
+oslo.policy==3.8.0
# via
# neutron
# neutron-lib
# neutron
# neutron-lib
# oslo.messaging
-oslo.upgradecheck==1.3.0
+oslo.upgradecheck==1.4.0
# via neutron
-oslo.utils==4.8.0
+oslo.utils==4.9.0
# via
# keystonemiddleware
# neutron
# neutron
# os-ken
# ovsdbapp
-ovsdbapp==1.9.0
+ovsdbapp==1.10.0
# via
# networking-l2gw
# neutron
# via keystonemiddleware
pycparser==2.20
# via cffi
-pygments==2.8.1
+pygments==2.9.0
# via
# pyvcloud
# sphinx
pyinotify==0.9.6
# via oslo.log
-pyjwt[crypto]==2.0.1
+pyjwt[crypto]==2.1.0
# via
# adal
# msal
pynacl==1.4.0
# via paramiko
-pyone==6.0.0
+pyone==6.0.2
# via -r RO-VIM-opennebula/requirements.in
pyopenssl==20.0.1
# via
pyperclip==1.8.2
# via cmd2
pyroute2==0.5.18
- # via
- # neutron
- # os-vif
pyrsistent==0.17.3
# via jsonschema
python-cinderclient==7.4.0
# adal
# alembic
# oslo.log
-python-designateclient==4.2.0
+python-designateclient==4.3.0
# via neutron
python-editor==1.0.4
# via alembic
# python-openstackclient
python-mimeparse==1.6.0
# via testtools
-python-neutronclient==7.3.0
+python-neutronclient==7.4.0
# via
# -r RO-VIM-openstack/requirements.in
# networking-l2gw
# neutron
-python-novaclient==17.4.0
+python-novaclient==17.5.0
# via
# -r RO-VIM-openstack/requirements.in
# neutron
# sphinx
requestsexceptions==1.4.0
# via openstacksdk
-rfc3986==1.4.0
+rfc3986==1.5.0
# via oslo.config
routes==2.5.1
# via
# pyone
# pyopenssl
# python-dateutil
- # python-designateclient
# python-keystoneclient
# pyvmomi
# routes
# webtest
snowballstemmer==2.1.0
# via sphinx
-sortedcontainers==2.3.0
+sortedcontainers==2.4.0
# via ovs
soupsieve==2.2.1
# via beautifulsoup4
-sphinx==3.5.4
+sphinx==4.0.2
# via -r RO-VIM-fos/requirements.in
sphinxcontrib-applehelp==1.0.2
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via sphinx
-sphinxcontrib-htmlhelp==1.0.3
+sphinxcontrib-htmlhelp==2.0.0
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
# via sphinx
-sphinxcontrib-serializinghtml==1.1.4
+sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sqlalchemy-migrate==0.13.0
# via oslo.db
-sqlalchemy==1.4.11
+sqlalchemy==1.4.17
# via
# alembic
# neutron
# via sqlalchemy-migrate
tempora==4.0.2
# via portend
-tenacity==7.0.0
+tenacity==6.3.1
# via
# neutron
# tooz
# testscenarios
tinyrpc==1.0.4
# via os-ken
-tooz==2.8.0
+tooz==2.9.0
# via neutron
traceback2==1.4.0
# via
# testtools
# unittest2
-typing-extensions==3.7.4.3
- # via importlib-metadata
unittest2==1.1.0
# via testtools
-urllib3==1.26.4
+urllib3==1.26.5
# via requests
uuid==1.30
# via -r RO-SDN-arista_cloudvision/requirements.in
vine==5.0.0
- # via amqp
+ # via
+ # amqp
+ # kombu
voluptuous==0.12.1
# via tooz
waitress==2.0.0
zenoh==0.3.0
# via -r RO-VIM-fos/requirements.in
zipp==3.4.1
- # via
- # importlib-metadata
- # importlib-resources
+ # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# setuptools