diff options
31 files changed, 408 insertions, 230 deletions
diff --git a/newton/docker/Dockerfile b/newton/docker/Dockerfile index fb624cd4..83610a4f 100644 --- a/newton/docker/Dockerfile +++ b/newton/docker/Dockerfile @@ -10,7 +10,7 @@ ENV MSB_ADDR "127.0.0.1" ENV MSB_PORT "80" ENV AAI_ADDR "aai.api.simpledemo.openecomp.org" ENV AAI_PORT "8443" -ENV AAI_SCHEMA_VERSION "v11" +ENV AAI_SCHEMA_VERSION "v13" ENV AAI_USERNAME "AAI" ENV AAI_PASSWORD "AAI" diff --git a/newton/docker/build_image.sh b/newton/docker/build_image.sh index 203283d1..7b8401eb 100644 --- a/newton/docker/build_image.sh +++ b/newton/docker/build_image.sh @@ -6,8 +6,8 @@ cd ${DOCKER_BUILD_DIR} BUILD_ARGS="--no-cache" ORG="onap" -VERSION="1.0.0-SNAPSHOT" -STAGING="1.0.0-STAGING" +VERSION="1.1.2-SNAPSHOT" +STAGING="1.1.2-STAGING" PROJECT="multicloud" IMAGE="openstack-newton" DOCKER_REPOSITORY="nexus3.onap.org:10003" diff --git a/newton/newton/pub/config/log.yml b/newton/newton/pub/config/log.yml index 452d3b61..6e8ac2ed 100644 --- a/newton/newton/pub/config/log.yml +++ b/newton/newton/pub/config/log.yml @@ -24,11 +24,10 @@ handlers: backupCount: 10 formatters: standard: - format: "%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s" + format: "%(asctime)s|||||%(name)s||%(thread)||%(funcName)s||%(levelname)s||%(message)s" mdcFormat: - format: "%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:[%(mdc)s]: %(message)s" - mdcfmt: "{requestID}" + format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s \t" + mdcfmt: "{requestID} {invocationID} {serviceName} {serviceIP}" datefmt: "%Y-%m-%d %H:%M:%S" (): onaplogging.mdcformatter.MDCFormatter - diff --git a/newton/newton/registration/views/registration.py b/newton/newton/registration/views/registration.py index cc97e048..9f28cdff 100644 --- a/newton/newton/registration/views/registration.py +++ b/newton/newton/registration/views/registration.py @@ -15,6 +15,7 @@ import logging import json import uuid +import traceback from django.conf import settings from keystoneauth1.exceptions import HttpError diff --git a/newton/newton/settings.py b/newton/newton/settings.py index bb7bd042..a3fb9b41 100644 --- a/newton/newton/settings.py +++ b/newton/newton/settings.py @@ -107,7 +107,7 @@ MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-newton/v0" % ( AAI_ADDR = os.environ.get('AAI_ADDR', "aai.api.simpledemo.openecomp.org") AAI_PORT = os.environ.get('AAI_PORT', "8443") AAI_SERVICE_URL = 'https://%s:%s/aai' % (AAI_ADDR, AAI_PORT) -AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "v11") +AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "v13") AAI_USERNAME = os.environ.get('AAI_USERNAME', "AAI") AAI_PASSWORD = os.environ.get('AAI_PASSWORD', "AAI") diff --git a/newton/pom.xml b/newton/pom.xml index 1fda1076..1d23ad16 100644 --- a/newton/pom.xml +++ b/newton/pom.xml @@ -27,7 +27,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.multicloud.openstack</groupId> <artifactId>multicloud-openstack-newton</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.2-SNAPSHOT</version> <packaging>pom</packaging> <name>multicloud/openstack/newton</name> <description>multicloud for openstack newton</description> diff --git a/ocata/docker/Dockerfile b/ocata/docker/Dockerfile index e4d77728..1b8477f3 100644 --- a/ocata/docker/Dockerfile +++ b/ocata/docker/Dockerfile @@ -10,7 +10,7 @@ ENV MSB_ADDR "127.0.0.1" ENV MSB_PORT "80" ENV AAI_ADDR "aai.api.simpledemo.openecomp.org" ENV AAI_PORT "8443" -ENV AAI_SCHEMA_VERSION "v11" +ENV AAI_SCHEMA_VERSION "v13" ENV AAI_USERNAME "AAI" ENV AAI_PASSWORD "AAI" diff --git a/ocata/docker/build_image.sh b/ocata/docker/build_image.sh index e8bfdf2c..c85989d0 100644 --- a/ocata/docker/build_image.sh +++ b/ocata/docker/build_image.sh @@ -6,8 +6,8 @@ cd ${DOCKER_BUILD_DIR} BUILD_ARGS="--no-cache" ORG="onap" -VERSION="1.0.0-SNAPSHOT" -STAGING="1.0.0-STAGING" +VERSION="1.1.2-SNAPSHOT" +STAGING="1.1.2-STAGING" PROJECT="multicloud" IMAGE="openstack-ocata" DOCKER_REPOSITORY="nexus3.onap.org:10003" diff --git a/ocata/ocata/pub/config/log.yml b/ocata/ocata/pub/config/log.yml index 224864d1..bb6321fa 100644 --- a/ocata/ocata/pub/config/log.yml +++ b/ocata/ocata/pub/config/log.yml @@ -24,11 +24,10 @@ handlers: backupCount: 10 formatters: standard: - format: "%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s" + format: "%(asctime)s|||||%(name)s||%(thread)||%(funcName)s||%(levelname)s||%(message)s" mdcFormat: - format: "%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:[%(mdc)s]: %(message)s" - mdcfmt: "{requestID}" + format: "%(asctime)s|||||%(name)s||%(thread)s||%(funcName)s||%(levelname)s||%(message)s||||%(mdc)s \t" + mdcfmt: "{requestID} {invocationID} {serviceName} {serviceIP}" datefmt: "%Y-%m-%d %H:%M:%S" (): onaplogging.mdcformatter.MDCFormatter - diff --git a/ocata/ocata/registration/tests/test_registration.py b/ocata/ocata/registration/tests/test_registration.py index 50b7fda2..0d1cfab0 100644 --- a/ocata/ocata/registration/tests/test_registration.py +++ b/ocata/ocata/registration/tests/test_registration.py @@ -148,13 +148,13 @@ TEST_REGISTER_ENDPOINT_REQUEST = { MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE= { "flavors": [ { - "id": "1", "name": "micro", "vcpus": 1, "ram": "1MB", + "id": "1", "name": "micro", "vcpus": 1, "ram": "1024", "disk": "1G", "OS-FLV-EXT-DATA:ephemeral": False, "swap": True, "os-flavor-access:is_public": True, "OS-FLV-DISABLED:disabled": True, "link": [{"href": 1}] }, { - "id": "2", "name": "onap.mini", "vcpus": 2, "ram": "2", + "id": "2", "name": "onap.mini", "vcpus": 2, "ram": "2048", "disk": "2G", "OS-FLV-EXT-DATA:ephemeral": True, "swap": False, "os-flavor-access:is_public": True, "OS-FLV-DISABLED:disabled": True diff --git a/ocata/ocata/registration/views/registration.py b/ocata/ocata/registration/views/registration.py index 25ec0dbf..130b3f3c 100644 --- a/ocata/ocata/registration/views/registration.py +++ b/ocata/ocata/registration/views/registration.py @@ -54,10 +54,10 @@ class Registry(newton_registration.Registry): 'flavor-disabled': flavor['OS-FLV-DISABLED:disabled'], } - if flavor.get('link') and len(flavor['link']) > 0: - flavor_info['flavor-selflink'] = flavor['link'][0]['href'] or 'http://0.0.0.0', + if flavor.get('links') and len(flavor['links']) > 0: + flavor_info['flavor-selflink'] = flavor['links'][0]['href'] or 'http://0.0.0.0' else: - flavor_info['flavor-selflink'] = 'http://0.0.0.0', + flavor_info['flavor-selflink'] = 'http://0.0.0.0' # add hpa capabilities if (flavor['name'].find('onap.') == 0): @@ -65,7 +65,7 @@ class Registry(newton_registration.Registry): extraResp = self._get_list_resources(req_resouce, "compute", session, viminfo, vimid, "extra_specs") hpa_capabilities = self._get_hpa_capabilities(flavor, extraResp, viminfo) - flavor_info['hpa_capabilities'] = hpa_capabilities + flavor_info['hpa-capabilities'] = {'hpa-capability': hpa_capabilities} self._update_resoure( cloud_owner, cloud_region_id, flavor['id'], @@ -144,15 +144,15 @@ class Registry(newton_registration.Registry): basic_capability = {} feature_uuid = uuid.uuid4() - basic_capability['hpaCapabilityID'] = str(feature_uuid) - basic_capability['hpaFeature'] = 'basicCapabilities' - basic_capability['hardwareArchitecture'] = 'generic' - basic_capability['version'] = 'v1' + basic_capability['hpa-capability-id'] = str(feature_uuid) + basic_capability['hpa-feature'] = 'basicCapabilities' + basic_capability['architecture'] = 'generic' + basic_capability['hpa-version'] = 'v1' - basic_capability['attributes'] = [] - basic_capability['attributes'].append({'hpa-attribute-key': 'numVirtualCpu', + basic_capability['hpa-feature-attributes'] = [] + basic_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numVirtualCpu', 'hpa-attribute-value':{'value': str(flavor['vcpus']) }}) - basic_capability['attributes'].append({'hpa-attribute-key':'virtualMemSize', + basic_capability['hpa-feature-attributes'].append({'hpa-attribute-key':'virtualMemSize', 'hpa-attribute-value': {'value':str(flavor['ram']), 'unit':'MB'}}) return basic_capability @@ -162,17 +162,17 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:cpu_policy') or extra_specs.has_key('hw:cpu_thread_policy'): - cpupining_capability['hpaCapabilityID'] = str(feature_uuid) - cpupining_capability['hpaFeature'] = 'cpuPinning' - cpupining_capability['hardwareArchitecture'] = 'generic' - cpupining_capability['version'] = 'v1' + cpupining_capability['hpa-capability-id'] = str(feature_uuid) + cpupining_capability['hpa-feature'] = 'cpuPinning' + cpupining_capability['architecture'] = 'generic' + cpupining_capability['hpa-version'] = 'v1' - cpupining_capability['attributes'] = [] + cpupining_capability['hpa-feature-attributes'] = [] if extra_specs.has_key('hw:cpu_thread_policy'): - cpupining_capability['attributes'].append({'hpa-attribute-key': 'logicalCpuThreadPinningPolicy', + cpupining_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'logicalCpuThreadPinningPolicy', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_thread_policy'])}}) if extra_specs.has_key('hw:cpu_policy'): - cpupining_capability['attributes'].append({'hpa-attribute-key':'logicalCpuPinningPolicy', + cpupining_capability['hpa-feature-attributes'].append({'hpa-attribute-key':'logicalCpuPinningPolicy', 'hpa-attribute-value': {'value':str(extra_specs['hw:cpu_policy'])}}) return cpupining_capability @@ -182,20 +182,20 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:cpu_sockets') or extra_specs.has_key('hw:cpu_cores') or extra_specs.has_key('hw:cpu_threads'): - cputopology_capability['hpaCapabilityID'] = str(feature_uuid) - cputopology_capability['hpaFeature'] = 'cpuTopology' - cputopology_capability['hardwareArchitecture'] = 'generic' - cputopology_capability['version'] = 'v1' + cputopology_capability['hpa-capability-id'] = str(feature_uuid) + cputopology_capability['hpa-feature'] = 'cpuTopology' + cputopology_capability['architecture'] = 'generic' + cputopology_capability['hpa-version'] = 'v1' - cputopology_capability['attributes'] = [] + cputopology_capability['hpa-feature-attributes'] = [] if extra_specs.has_key('hw:cpu_sockets'): - cputopology_capability['attributes'].append({'hpa-attribute-key': 'numCpuSockets', + cputopology_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numCpuSockets', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_sockets'])}}) if extra_specs.has_key('hw:cpu_cores'): - cputopology_capability['attributes'].append({'hpa-attribute-key': 'numCpuCores', + cputopology_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numCpuCores', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_cores'])}}) if extra_specs.has_key('hw:cpu_threads'): - cputopology_capability['attributes'].append({'hpa-attribute-key': 'numCpuThreads', + cputopology_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numCpuThreads', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_threads'])}}) return cputopology_capability @@ -205,14 +205,27 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:mem_page_size'): - hugepages_capability['hpaCapabilityID'] = str(feature_uuid) - hugepages_capability['hpaFeature'] = 'hugePages' - hugepages_capability['hardwareArchitecture'] = 'generic' - hugepages_capability['version'] = 'v1' - - hugepages_capability['attributes'] = [] - hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize', - 'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size'])}}) + hugepages_capability['hpa-capability-id'] = str(feature_uuid) + hugepages_capability['hpa-feature'] = 'hugePages' + hugepages_capability['architecture'] = 'generic' + hugepages_capability['hpa-version'] = 'v1' + + hugepages_capability['hpa-feature-attributes'] = [] + if extra_specs['hw:mem_page_size'] == 'large': + hugepages_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': '2', + 'unit': 'MB'}}) + elif extra_specs['hw:mem_page_size'] == 'small': + hugepages_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': '4', + 'unit': 'KB'}}) + elif extra_specs['hw:mem_page_size'] == 'any': + self._logger.info("Currently HPA feature memoryPageSize did not support 'any' page!!") + else : + hugepages_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size']), + 'unit': 'KB'}}) + return hugepages_capability def _get_numa_capabilities(self, extra_specs): @@ -220,13 +233,13 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:numa_nodes'): - numa_capability['hpaCapabilityID'] = str(feature_uuid) - numa_capability['hpaFeature'] = 'numa' - numa_capability['hardwareArchitecture'] = 'generic' - numa_capability['version'] = 'v1' + numa_capability['hpa-capability-id'] = str(feature_uuid) + numa_capability['hpa-feature'] = 'numa' + numa_capability['architecture'] = 'generic' + numa_capability['hpa-version'] = 'v1' - numa_capability['attributes'] = [] - numa_capability['attributes'].append({'hpa-attribute-key': 'numaNodes', + numa_capability['hpa-feature-attributes'] = [] + numa_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numaNodes', 'hpa-attribute-value':{'value': str(extra_specs['hw:numa_nodes'])}}) for num in range(0, int(extra_specs['hw:numa_nodes'])): @@ -236,9 +249,9 @@ class Registry(newton_registration.Registry): numamem_key = "numaMem-%s" % num if extra_specs.has_key(numa_cpu_node) and extra_specs.has_key(numa_mem_node): - numa_capability['attributes'].append({'hpa-attribute-key': numacpu_key, + numa_capability['hpa-feature-attributes'].append({'hpa-attribute-key': numacpu_key, 'hpa-attribute-value':{'value': str(extra_specs[numa_cpu_node])}}) - numa_capability['attributes'].append({'hpa-attribute-key': numamem_key, + numa_capability['hpa-feature-attributes'].append({'hpa-attribute-key': numamem_key, 'hpa-attribute-value':{'value': str(extra_specs[numa_mem_node]),'unit':'MB'}}) return numa_capability @@ -247,17 +260,17 @@ class Registry(newton_registration.Registry): storage_capability = {} feature_uuid = uuid.uuid4() - storage_capability['hpaCapabilityID'] = str(feature_uuid) - storage_capability['hpaFeature'] = 'localStorage' - storage_capability['hardwareArchitecture'] = 'generic' - storage_capability['version'] = 'v1' + storage_capability['hpa-capability-id'] = str(feature_uuid) + storage_capability['hpa-feature'] = 'localStorage' + storage_capability['architecture'] = 'generic' + storage_capability['hpa-version'] = 'v1' - storage_capability['attributes'] = [] - storage_capability['attributes'].append({'hpa-attribute-key': 'diskSize', + storage_capability['hpa-feature-attributes'] = [] + storage_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'diskSize', 'hpa-attribute-value':{'value': str(flavor['disk']), 'unit':'GB'}}) - storage_capability['attributes'].append({'hpa-attribute-key': 'swapMemSize', + storage_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'swapMemSize', 'hpa-attribute-value':{'value': str(flavor['swap']), 'unit':'MB'}}) - storage_capability['attributes'].append({'hpa-attribute-key': 'ephemeralDiskSize', + storage_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'ephemeralDiskSize', 'hpa-attribute-value':{'value': str(flavor['OS-FLV-EXT-DATA:ephemeral']), 'unit':'GB'}}) return storage_capability @@ -266,13 +279,13 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:capabilities:cpu_info:features'): - instruction_capability['hpaCapabilityID'] = str(feature_uuid) - instruction_capability['hpaFeature'] = 'instructionSetExtensions' - instruction_capability['hardwareArchitecture'] = 'Intel64' - instruction_capability['version'] = 'v1' + instruction_capability['hpa-capability-id'] = str(feature_uuid) + instruction_capability['hpa-feature'] = 'instructionSetExtensions' + instruction_capability['architecture'] = 'Intel64' + instruction_capability['hpa-version'] = 'v1' - instruction_capability['attributes'] = [] - instruction_capability['attributes'].append({'hpa-attribute-key': 'instructionSetExtensions', + instruction_capability['hpa-feature-attributes'] = [] + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'instructionSetExtensions', 'hpa-attribute-value':{'value': str(extra_specs['hw:capabilities:cpu_info:features'])}}) return instruction_capability @@ -284,20 +297,20 @@ class Registry(newton_registration.Registry): value1 = extra_specs['pci_passthrough:alias'].split(':') value2 = value1[0].split('-') - instruction_capability['hpaCapabilityID'] = str(feature_uuid) - instruction_capability['hpaFeature'] = 'pciePassthrough' - instruction_capability['hardwareArchitecture'] = str(value2[2]) - instruction_capability['version'] = 'v1' - - - instruction_capability['attributes'] = [] - instruction_capability['attributes'].append({'hpa-attribute-key': 'pciCount', + instruction_capability['hpa-capability-id'] = str(feature_uuid) + instruction_capability['hpa-feature'] = 'pciePassthrough' + instruction_capability['architecture'] = str(value2[2]) + instruction_capability['hpa-version'] = 'v1' + + + instruction_capability['hpa-feature-attributes'] = [] + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciCount', 'hpa-attribute-value':{'value': str(value1[1])}}) - instruction_capability['attributes'].append({'hpa-attribute-key': 'pciVendorId', + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciVendorId', 'hpa-attribute-value':{'value': str(value2[3])}}) - instruction_capability['attributes'].append({'hpa-attribute-key': 'pciDeviceId', + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciDeviceId', 'hpa-attribute-value':{'value': str(value2[4])}}) - + return instruction_capability def _get_ovsdpdk_capabilities(self, viminfo): @@ -306,14 +319,14 @@ class Registry(newton_registration.Registry): cloud_extra_info_str = viminfo.get('cloud_extra_info') if cloud_extra_info_str : - cloud_dpdk_info = cloud_extra_info.get("ovsDpdk") + cloud_dpdk_info = cloud_extra_info_str.get("ovsDpdk") if cloud_dpdk_info : - ovsdpdk_capability['hpaCapabilityID'] = str(feature_uuid) - ovsdpdk_capability['hpaFeature'] = 'ovsDpdk' - ovsdpdk_capability['hardwareArchitecture'] = 'Intel64' - ovsdpdk_capability['version'] = 'v1' + ovsdpdk_capability['hpa-capability-id'] = str(feature_uuid) + ovsdpdk_capability['hpa-feature'] = 'ovsDpdk' + ovsdpdk_capability['architecture'] = 'Intel64' + ovsdpdk_capability['hpa-version'] = 'v1' - ovsdpdk_capability['attributes'] = [] - ovsdpdk_capability['attributes'].append({'hpa-attribute-key': str(cloud_dpdk_info.get("libname")), + ovsdpdk_capability['hpa-feature-attributes'] = [] + ovsdpdk_capability['hpa-feature-attributes'].append({'hpa-attribute-key': str(cloud_dpdk_info.get("libname")), 'hpa-attribute-value':{'value': str(cloud_dpdk_info.get("libversion"))}}) return ovsdpdk_capability diff --git a/ocata/ocata/settings.py b/ocata/ocata/settings.py index aea20e9b..5b1780a1 100644 --- a/ocata/ocata/settings.py +++ b/ocata/ocata/settings.py @@ -100,7 +100,7 @@ MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-ocata/v0" % ( AAI_ADDR = os.environ.get('AAI_ADDR', "aai.api.simpledemo.openecomp.org") AAI_PORT = os.environ.get('AAI_PORT', "8443") AAI_SERVICE_URL = 'https://%s:%s/aai' % (AAI_ADDR, AAI_PORT) -AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "v11") +AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "v13") AAI_USERNAME = os.environ.get('AAI_USERNAME', "AAI") AAI_PASSWORD = os.environ.get('AAI_PASSWORD', "AAI") diff --git a/ocata/pom.xml b/ocata/pom.xml index 29032167..7ef3c588 100644 --- a/ocata/pom.xml +++ b/ocata/pom.xml @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.multicloud.openstack</groupId> <artifactId>multicloud-openstack-ocata</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.2-SNAPSHOT</version> <packaging>pom</packaging> <name>multicloud/openstack/ocata</name> <description>multicloud for openstack ocata</description> diff --git a/ocata/vagrant/test/Dockerfile b/ocata/vagrant/test/Dockerfile index cc7d2b53..bc306c7a 100644 --- a/ocata/vagrant/test/Dockerfile +++ b/ocata/vagrant/test/Dockerfile @@ -4,7 +4,7 @@ ENV MSB_ADDR "127.0.0.1" ENV MSB_PORT "80" ENV AAI_ADDR "aai.api.simpledemo.openecomp.org" ENV AAI_PORT "8443" -ENV AAI_SCHEMA_VERSION "v11" +ENV AAI_SCHEMA_VERSION "v13" ENV AAI_USERNAME "AAI" ENV AAI_PASSWORD "AAI" @@ -26,7 +26,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.multicloud.openstack</groupId> <artifactId>multicloud-openstack-root</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.2-SNAPSHOT</version> <name>multicloud-openstack</name> <packaging>pom</packaging> <description>multicloud openstack</description> diff --git a/share/newton_base/openoapi/flavor.py b/share/newton_base/openoapi/flavor.py index d50b1941..1124aec4 100644 --- a/share/newton_base/openoapi/flavor.py +++ b/share/newton_base/openoapi/flavor.py @@ -51,7 +51,11 @@ class Flavors(APIView): extraSpecs.append(spec) def get(self, request, vimid="", tenantid="", flavorid=""): - logger.debug("Flavors--get::> %s" % request.data) + logger.info("vimid, tenantid, flavorid = %s,%s,%s" % (vimid, tenantid, flavorid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass + try: # prepare request resource to vim instance query = VimDriverUtils.get_query_part(request) @@ -109,9 +113,11 @@ class Flavors(APIView): } content.update(vim_dict) + logger.info("response with status = %s" % resp.status_code) return Response(data=content, status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) @@ -123,16 +129,22 @@ class Flavors(APIView): def _get_flavor_extra_specs(self, sess, flavorid): if flavorid: - logger.debug("Flavors--get_extra_specs::> %s" % flavorid) # prepare request resource to vim instance req_resouce = "/flavors/%s/os-extra_specs" % flavorid + logger.info("making request with URI:%s" % req_resouce) + resp = sess.get(req_resouce, endpoint_filter=self.service) + + logger.info("request returns with status %s" % resp.status_code) + if resp.status_code == status.HTTP_200_OK: + logger.debug("with content:%s" % resp.json()) + pass + return resp return {} def _get_flavor(self, sess, request, flavorid=""): - logger.debug("Flavors--get basic") if sess: # prepare request resource to vim instance req_resouce = "/flavors" @@ -145,11 +157,24 @@ class Flavors(APIView): if query: req_resouce += "?%s" % query - return sess.get(req_resouce, endpoint_filter=self.service) + logger.info("making request with URI:%s" % req_resouce) + + resp = sess.get(req_resouce, endpoint_filter=self.service) + + logger.info("request returns with status %s" % resp.status_code) + if resp.status_code == status.HTTP_200_OK: + logger.debug("with content:%s" % resp.json()) + pass + + return resp return {} def post(self, request, vimid="", tenantid="", flavorid=""): - logger.debug("Flavors--post::> %s" % request.data) + logger.info("vimid, tenantid, flavorid = %s,%s,%s" % (vimid, tenantid, flavorid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass + sess = None resp = None resp_body = None @@ -202,8 +227,7 @@ class Flavors(APIView): if extraSpecs: extra_specs={} self._convert_extra_specs(extraSpecs, extra_specs, False) -# logger.debug("extraSpecs:%s" % extraSpecs) -# logger.debug("extra_specs:%s" % extra_specs) + extraResp = self._create_flavor_extra_specs(sess, extra_specs, flavorid) if extraResp.status_code == 200: #combine the response body and return @@ -227,6 +251,7 @@ class Flavors(APIView): resp_body.update(vim_dict) return Response(data=resp_body, status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) if sess and resp and resp.status_code == 200: self._delete_flavor(sess, flavorid) @@ -244,7 +269,6 @@ class Flavors(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def _create_flavor(self, sess, request): - logger.debug("Flavors--create::> %s" % request.data) # prepare request resource to vim instance req_resouce = "/flavors" @@ -253,11 +277,18 @@ class Flavors(APIView): VimDriverUtils.replace_key_by_mapping(flavor, self.keys_mapping, True) req_body = json.JSONEncoder().encode({"flavor": flavor}) - return sess.post(req_resouce, data=req_body, + + logger.info("making request with URI:%s" % req_resouce) + logger.debug("with data:%s" % req_body) + + resp = sess.post(req_resouce, data=req_body, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + + return resp + def _create_flavor_extra_specs(self, sess, extraspecs, flavorid): - logger.debug("Flavors extra_specs--post::> %s" % extraspecs) # prepare request resource to vim instance req_resouce = "/flavors" if flavorid: @@ -269,11 +300,22 @@ class Flavors(APIView): req_body = json.JSONEncoder().encode({"extra_specs": extraspecs}) - return sess.post(req_resouce, data=req_body, + logger.info("making request with URI:%s" % req_resouce) + logger.debug("with data:%s" % req_body) + + resp = sess.post(req_resouce, data=req_body, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + + return resp + def delete(self, request, vimid="", tenantid="", flavorid=""): - logger.debug("Flavors--delete::> %s" % request.data) + logger.info("vimid, tenantid, flavorid = %s,%s,%s" % (vimid, tenantid, flavorid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass + try: # prepare request resource to vim instance vim = VimDriverUtils.get_vim_info(vimid) @@ -288,6 +330,7 @@ class Flavors(APIView): #return results return Response(status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) @@ -298,8 +341,6 @@ class Flavors(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def _delete_flavor_extra_specs(self, sess, flavorid): - logger.debug("Flavors--delete extra::> %s" % flavorid) - #delete extra specs one by one resp = self._get_flavor_extra_specs(sess, flavorid) extra_specs = resp.json() @@ -310,7 +351,6 @@ class Flavors(APIView): return resp def _delete_flavor_one_extra_spec(self, sess, flavorid, extra_spec_key): - logger.debug("Flavors--delete 1 extra::> %s" % extra_spec_key) # prepare request resource to vim instance try: req_resouce = "/flavors" @@ -322,7 +362,14 @@ class Flavors(APIView): content="internal bug in deleting flavor extra specs: %s" % extra_spec_key, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR) - return sess.delete(req_resouce, endpoint_filter=self.service) + logger.info("making request with URI:%s" % req_resouce) + + resp = sess.delete(req_resouce, endpoint_filter=self.service) + + logger.info("request returns with status %s" % resp.status_code) + + return resp + except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) return Response(data=e.response.json(), status=e.http_status) @@ -332,7 +379,6 @@ class Flavors(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def _delete_flavor(self, sess, flavorid): - logger.debug("Flavors--delete basic::> %s" % flavorid) # prepare request resource to vim instance req_resouce = "/flavors" if flavorid: @@ -342,4 +388,10 @@ class Flavors(APIView): content="internal bug in deleting flavor", status_code=500) - return sess.delete(req_resouce, endpoint_filter=self.service) + logger.info("making request with URI:%s" % req_resouce) + + resp = sess.delete(req_resouce, endpoint_filter=self.service) + + logger.info("request returns with status %s" % resp.status_code) + + return resp diff --git a/share/newton_base/openoapi/hosts.py b/share/newton_base/openoapi/hosts.py index 60debf54..2d50886f 100644 --- a/share/newton_base/openoapi/hosts.py +++ b/share/newton_base/openoapi/hosts.py @@ -38,7 +38,10 @@ class Hosts(APIView): ] def get(self, request, vimid="", tenantid="", hostname=""): - logger.debug("Hosts--get::> %s" % request.data) + logger.info("vimid, tenantid, hostname = %s,%s,%s" % (vimid, tenantid, hostname)) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: #prepare request resource to vim instance req_resouce = "/os-hosts" @@ -47,7 +50,14 @@ class Hosts(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + if resp.status_code == status.HTTP_200_OK: + logger.debug("with content:%s" % resp.json()) + pass + content = resp.json() vim_dict = { "vimName": vim["name"], @@ -72,8 +82,12 @@ class Hosts(APIView): self.host_keys_mapping) content["host"].append(res['resource']) + logger.info("response with status = %s" % resp.status_code) + return Response(data=content, status=resp.status_code) + except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) diff --git a/share/newton_base/openoapi/hypervisor.py b/share/newton_base/openoapi/hypervisor.py index 147fbc44..e9201307 100755 --- a/share/newton_base/openoapi/hypervisor.py +++ b/share/newton_base/openoapi/hypervisor.py @@ -37,14 +37,22 @@ class Hypervisors(APIView): ("container_format", "containerFormat")
]
-
+
def get(self, request, vimid="", tenantid="", hypervisorid=""):
- logger.debug("hypervisors--get::> %s" % request.data)
+ logger.info("vimid, tenantid, hypervisorid = %s,%s,%s" % (vimid, tenantid, hypervisorid))
+ if request.data:
+ logger.debug("With data = %s" % request.data)
+ pass
+
try:
query = VimDriverUtils.get_query_part(request)
content, status_code = self.get_hypervisors(query, vimid, tenantid, hypervisorid)
+
+ logger.info("response with status = %s" % resp.status_code)
+
return Response(data=content, status=status_code)
except VimDriverNewtonException as e:
+ logger.error("response with status = %s" % e.status_code)
return Response(data={'error': e.content}, status=e.status_code)
except HttpError as e:
logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
@@ -54,16 +62,24 @@ class Hypervisors(APIView): return Response(data={'error': str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
-
+
def get_hypervisors(self, query="", vimid="", tenantid="", hypervisorid=""):
- logger.debug("hypervisors--get::> %s" % hypervisorid)
req_resource = "/os-hypervisors"
vim = VimDriverUtils.get_vim_info(vimid)
vim["domain"] = "Default"
sess = VimDriverUtils.get_session(vim, tenantid)
+
+ logger.info("making request with URI:%s" % req_resouce)
+
resp = sess.get(req_resource, endpoint_filter = self.service)
+
+ logger.info("request returns with status %s" % resp.status_code)
+ if resp.status_code == status.HTTP_200_OK:
+ logger.debug("with content:%s" % resp.json())
+ pass
+
content = resp.json()
return content, resp.status_code
diff --git a/share/newton_base/openoapi/image.py b/share/newton_base/openoapi/image.py index 965b2c3f..7a18bdbd 100644 --- a/share/newton_base/openoapi/image.py +++ b/share/newton_base/openoapi/image.py @@ -49,7 +49,7 @@ class imageThread (threading.Thread): running_thread_lock.release() def transfer_image(self, vimid, tenantid, imageid, imagefd): - logger.debug("Images--transfer_image::> %s" % (imageid)) + logger.info("vimid, tenantid, imageid, imagefd = %s,%s,%s,%s" % (vimid, tenantid, imageid, imagefd)) try: # prepare request resource to vim instance req_resouce = "v2/images/%s/file" % imageid @@ -58,11 +58,12 @@ class imageThread (threading.Thread): sess = VimDriverUtils.get_session(vim, tenantid) #open imageurl + logger.info("making image put request with URI:%s" % req_resouce) resp = sess.put(req_resouce, endpoint_filter=self.service, data=imagefd.read(), headers={"Content-Type": "application/octet-stream", "Accept": ""}) - logger.debug("response status code of transfer_image %s" % resp.status_code) + logger.info("response status code of transfer_image %s" % resp.status_code) return None except HttpError as e: logger.error("transfer_image, HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) @@ -82,13 +83,14 @@ class Images(APIView): ] def get(self, request, vimid="", tenantid="", imageid=""): - logger.debug("Images--get::> %s" % request.data) + logger.info("vimid, tenantid, imageid = %s,%s,%s" % (vimid, tenantid, imageid)) try: # prepare request resource to vim instance query = VimDriverUtils.get_query_part(request) content, status_code = self.get_images(query, vimid, tenantid, imageid) return Response(data=content, status=status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) @@ -99,8 +101,7 @@ class Images(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def get_images(self, query="", vimid="", tenantid="", imageid=""): - logger.debug("Images--get_images::> %s" % imageid) - + logger.info("vimid, tenantid, imageid, query = %s,%s,%s,%s" % (vimid, tenantid, imageid, query)) # prepare request resource to vim instance req_resouce = "v2/images" if imageid: @@ -110,7 +111,14 @@ class Images(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + if resp.status_code == status.HTTP_200_OK: + logger.debug("with content:%s" % resp.json()) + pass + content = resp.json() vim_dict = { "vimName": vim["name"], @@ -134,7 +142,10 @@ class Images(APIView): return content, resp.status_code def post(self, request, vimid="", tenantid="", imageid=""): - logger.debug("Images--post::> %s" % request.data) + logger.info("vimid, tenantid, imageid = %s,%s,%s" % (vimid, tenantid, imageid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: #check if created already: check name query = "name=%s" % request.data["name"] @@ -173,6 +184,9 @@ class Images(APIView): self.keys_mapping, True) #req_body = json.JSONEncoder().encode({"image": image}) req_body = json.JSONEncoder().encode(image) + + logger.info("making request with URI:%s" % req_resouce) + logger.debug("with data:%s" % req_body) resp = sess.post(req_resouce, data=req_body, endpoint_filter=self.service) #resp_body = resp.json()["image"] @@ -197,9 +211,10 @@ class Images(APIView): tmp_thread.start() else: logger.debug("resp.status_code: %s" % resp.status_code) - + logger.info("request returns with status %s" % resp.status_code) return Response(data=resp_body, status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except urllib.error.URLError as e: return Response(data={'error': 'image is not accessible:%s' % str(e)}, @@ -213,7 +228,7 @@ class Images(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def delete(self, request, vimid="", tenantid="", imageid=""): - logger.debug("Images--delete::> %s" % request.data) + logger.info("vimid, tenantid, imageid = %s,%s,%s" % (vimid, tenantid, imageid)) try: # prepare request resource to vim instance req_resouce = "v2/images" @@ -222,9 +237,14 @@ class Images(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + + logger.info("making request with URI:%s" % req_resouce) resp = sess.delete(req_resouce, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + return Response(status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) diff --git a/share/newton_base/openoapi/limits.py b/share/newton_base/openoapi/limits.py index 3302fdba..5789dfd4 100644 --- a/share/newton_base/openoapi/limits.py +++ b/share/newton_base/openoapi/limits.py @@ -37,14 +37,19 @@ class Limits(APIView): 'interface': 'public'} def get(self, request, vimid="", tenantid=""): - logger.debug("Limits--get::> %s" % request.data) + logger.info("vimid, tenantid = %s,%s" % (vimid, tenantid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: #get limits first # prepare request resource to vim instance req_resouce = "/limits" vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) content = resp.json() content_all =content['limits']['absolute'] @@ -58,19 +63,25 @@ class Limits(APIView): #now get quota # prepare request resource to vim instance req_resouce = "/v2.0/quotas/%s" % tenantid + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service_network) + logger.info("request returns with status %s" % resp.status_code) content = resp.json() content_all.update(content['quota']) #now get volume limits # prepare request resource to vim instance req_resouce = "/limits" + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service_volume) + logger.info("request returns with status %s" % resp.status_code) content = resp.json() content_all.update(content['limits']['absolute']) + logger.info("response with status = %s" % resp.status_code) return Response(data=content_all, status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) diff --git a/share/newton_base/openoapi/network.py b/share/newton_base/openoapi/network.py index 253ac89f..b780ab42 100644 --- a/share/newton_base/openoapi/network.py +++ b/share/newton_base/openoapi/network.py @@ -39,13 +39,18 @@ class Networks(APIView): ] def get(self, request, vimid="", tenantid="", networkid=""): - logger.debug("Networks--get::> %s" % request.data) + logger.info("vimid, tenantid, networkid = %s,%s,%s" % (vimid, tenantid, networkid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: query = VimDriverUtils.get_query_part(request) content, status_code = self.get_networks(query, vimid, tenantid, networkid) + logger.info("response with status = %s" % status_code) return Response(data=content, status=status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) @@ -56,7 +61,6 @@ class Networks(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def get_networks(self, query, vimid="", tenantid="", networkid=""): - logger.debug("Networks--get_networks::> %s" % networkid) # prepare request resource to vim instance req_resouce = "v2.0/networks" @@ -68,7 +72,12 @@ class Networks(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + logger.info("making request with URI:%s" % req_resouce) resp = sess.get(req_resouce, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + if resp.status_code == status.HTTP_200_OK: + logger.debug("with content:%s" % resp.json()) + pass content = resp.json() vim_dict = { "vimName": vim["name"], @@ -92,7 +101,10 @@ class Networks(APIView): return content, resp.status_code def post(self, request, vimid="", tenantid="", networkid=""): - logger.debug("Networks--post::> %s" % request.data) + logger.info("vimid, tenantid, networkid = %s,%s,%s" % (vimid, tenantid, networkid)) + if request.data: + logger.debug("With data = %s" % request.data) + pass try: #check if created already: check name query = "name=%s" % request.data["name"] @@ -119,8 +131,13 @@ class Networks(APIView): VimDriverUtils.replace_key_by_mapping(network, self.keys_mapping, True) req_body = json.JSONEncoder().encode({"network": network}) + + logger.info("making request with URI:%s" % req_resouce) + logger.debug("with data:%s" % req_body) resp = sess.post(req_resouce, data=req_body, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + resp_body = resp.json()["network"] VimDriverUtils.replace_key_by_mapping(resp_body, self.keys_mapping) vim_dict = { @@ -132,6 +149,7 @@ class Networks(APIView): resp_body.update(vim_dict) return Response(data=resp_body, status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) @@ -142,7 +160,7 @@ class Networks(APIView): status=status.HTTP_500_INTERNAL_SERVER_ERROR) def delete(self, request, vimid="", tenantid="", networkid=""): - logger.debug("Networks--delete::> %s" % request.data) + logger.info("vimid, tenantid, networkid = %s,%s,%s" % (vimid, tenantid, networkid)) try: # prepare request resource to vim instance req_resouce = "v2.0/networks" @@ -154,9 +172,14 @@ class Networks(APIView): vim = VimDriverUtils.get_vim_info(vimid) sess = VimDriverUtils.get_session(vim, tenantid) + + logger.info("making delete request with URI:%s" % req_resouce) resp = sess.delete(req_resouce, endpoint_filter=self.service) + logger.info("request returns with status %s" % resp.status_code) + return Response(status=resp.status_code) except VimDriverNewtonException as e: + logger.error("response with status = %s" % e.status_code) return Response(data={'error': e.content}, status=e.status_code) except HttpError as e: logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json())) diff --git a/share/newton_base/openoapi/server.py b/share/newton_base/openoapi/server.py index 95eab2bf..d21917a4 100644 --- a/share/newton_base/openoapi/server.py +++ b/share/newton_base/openoapi/server.py @@ -336,13 +336,30 @@ class Servers(APIView): contextarray = server.pop("contextArray", None) volumearray = server.pop("volumeArray", None) + userdata = server.pop("userdata", None) if contextarray: - # now set "contextArray" array - personalities = [] + user_data = [] + strUserData = '' + source_content = "" + dest_path = "" for context in contextarray: - personalities.append({"path": context["fileName"], "contents": context["fileData"]}) - if len(personalities) > 0: - server["personality"] = personalities + if context["fileName"] == "source_path": + source_content = context["fileData"] + if context["fileName"] == "dest_path": + dest_path = context["fileData"] + if len(source_content) > 0: + user_data.append("#cloud-config\n") + user_data.append("write_files:\n") + user_data.append("- encoding: b64\n") + user_data.append(" content: " + source_content + "\n") + user_data.append(" owner: root:root\n") + user_data.append(" path: " + dest_path + "\n") + user_data.append(" permissions: '0644'\n") + user_data.append("\n") + user_data.append("runcmd:") + user_data.append("- " + userdata + "\n") + strUserData.join(user_data) + server["user_data"] = user_data VimDriverUtils.replace_key_by_mapping(server, self.keys_mapping, True) diff --git a/share/newton_base/openoapi/vport.py b/share/newton_base/openoapi/vport.py index 9656b5c0..e112d38c 100644 --- a/share/newton_base/openoapi/vport.py +++ b/share/newton_base/openoapi/vport.py @@ -147,12 +147,13 @@ class Vports(APIView): tmpip = port.pop("ip", None) tmpsubnet = port.pop("subnetId", None) if tmpip and tmpsubnet: - fixed_ip = { - "ip_address": tmpip, - "subnet_id": tmpsubnet, - } - port["fixed_ips"] = [] - port["fixed_ips"].append(fixed_ip) + port["fixed_ips"] = [] + for one_tmpip in tmpip.split(','): + fixed_ip = { + "ip_address": one_tmpip, + "subnet_id": tmpsubnet, + } + port["fixed_ips"].append(fixed_ip) VimDriverUtils.replace_key_by_mapping(port, self.keys_mapping, True) diff --git a/share/newton_base/registration/registration.py b/share/newton_base/registration/registration.py index e5a84501..7513fd79 100644 --- a/share/newton_base/registration/registration.py +++ b/share/newton_base/registration/registration.py @@ -151,10 +151,10 @@ class Registry(APIView): 'flavor-disabled': flavor['OS-FLV-DISABLED:disabled'], } - if flavor.get('link') and len(flavor['link']) > 0: - flavor_info['flavor-selflink'] = flavor['link'][0]['href'] or 'http://0.0.0.0', + if flavor.get('links') and len(flavor['links']) > 0: + flavor_info['flavor-selflink'] = flavor['links'][0]['href'] or 'http://0.0.0.0' else: - flavor_info['flavor-selflink'] = 'http://0.0.0.0', + flavor_info['flavor-selflink'] = 'http://0.0.0.0' self._update_resoure( cloud_owner, cloud_region_id, flavor['id'], @@ -623,8 +623,8 @@ class Registry(APIView): return def post(self, request, vimid=""): - self._logger.debug("Registration--post::data> %s" % request.data) - self._logger.debug("Registration--post::vimid > %s" % vimid) + self._logger.info("registration with vimid: %s" % vimid) + self._logger.debug("with data: %s" % request.data) try: # populate proxy identity url diff --git a/version.properties b/version.properties index 5782ea4f..d5a45f9e 100644 --- a/version.properties +++ b/version.properties @@ -18,7 +18,7 @@ major=1 minor=1 -patch=0 +patch=2 base_version=${major}.${minor}.${patch} diff --git a/windriver/docker/Dockerfile b/windriver/docker/Dockerfile index ac2e62ef..82e669e0 100644 --- a/windriver/docker/Dockerfile +++ b/windriver/docker/Dockerfile @@ -10,7 +10,7 @@ ENV MSB_ADDR "127.0.0.1" ENV MSB_PORT "80" ENV AAI_ADDR "aai.api.simpledemo.openecomp.org" ENV AAI_PORT "8443" -ENV AAI_SCHEMA_VERSION "v11" +ENV AAI_SCHEMA_VERSION "v13" ENV AAI_USERNAME "AAI" ENV AAI_PASSWORD "AAI" @@ -28,4 +28,4 @@ RUN apt-get update && \ pip install -r /opt/windriver/requirements.txt WORKDIR /opt/windriver -CMD /bin/sh -c /opt/windriver/run.sh
\ No newline at end of file +CMD /bin/sh -c /opt/windriver/run.sh diff --git a/windriver/docker/build_image.sh b/windriver/docker/build_image.sh index 85e80c22..18a9dac9 100644 --- a/windriver/docker/build_image.sh +++ b/windriver/docker/build_image.sh @@ -6,8 +6,8 @@ cd ${DOCKER_BUILD_DIR} BUILD_ARGS="--no-cache" ORG="onap" -VERSION="1.0.0-SNAPSHOT" -STAGING="1.0.0-STAGING" +VERSION="1.1.2-SNAPSHOT" +STAGING="1.1.2-STAGING" PROJECT="multicloud" IMAGE="openstack-windriver" DOCKER_REPOSITORY="nexus3.onap.org:10003" diff --git a/windriver/pom.xml b/windriver/pom.xml index 0b216c59..0ee06581 100644 --- a/windriver/pom.xml +++ b/windriver/pom.xml @@ -24,7 +24,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.onap.multicloud.openstack</groupId> <artifactId>multicloud-openstack-windriver</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.1.2-SNAPSHOT</version> <packaging>pom</packaging> <name>multicloud/openstack/windriver</name> <description>multicloud for openstack Wind River Titanium Cloud</description> diff --git a/windriver/titanium_cloud/registration/tests/test_registration.py b/windriver/titanium_cloud/registration/tests/test_registration.py index 23ee9689..5c31c4e8 100644 --- a/windriver/titanium_cloud/registration/tests/test_registration.py +++ b/windriver/titanium_cloud/registration/tests/test_registration.py @@ -122,13 +122,13 @@ TEST_REGISTER_ENDPOINT_REQUEST = { MOCK_GET_HPA_FLAVOR_LIST1_RESPONSE= { "flavors": [ { - "id": "1", "name": "micro", "vcpus": 1, "ram": "1MB", + "id": "1", "name": "micro", "vcpus": 1, "ram": "1024", "disk": "1G", "OS-FLV-EXT-DATA:ephemeral": False, "swap": True, "os-flavor-access:is_public": True, "OS-FLV-DISABLED:disabled": True, "link": [{"href": 1}] }, { - "id": "2", "name": "onap.mini", "vcpus": 2, "ram": "2MB", + "id": "2", "name": "onap.mini", "vcpus": 2, "ram": "2048", "disk": "2G", "OS-FLV-EXT-DATA:ephemeral": True, "swap": False, "os-flavor-access:is_public": True, "OS-FLV-DISABLED:disabled": True diff --git a/windriver/titanium_cloud/registration/views/registration.py b/windriver/titanium_cloud/registration/views/registration.py index b3b2f006..e7b56584 100644 --- a/windriver/titanium_cloud/registration/views/registration.py +++ b/windriver/titanium_cloud/registration/views/registration.py @@ -53,10 +53,10 @@ class Registry(newton_registration.Registry): 'flavor-disabled': flavor['OS-FLV-DISABLED:disabled'], } - if flavor.get('link') and len(flavor['link']) > 0: - flavor_info['flavor-selflink'] = flavor['link'][0]['href'] or 'http://0.0.0.0', + if flavor.get('links') and len(flavor['links']) > 0: + flavor_info['flavor-selflink'] = flavor['links'][0]['href'] or 'http://0.0.0.0' else: - flavor_info['flavor-selflink'] = 'http://0.0.0.0', + flavor_info['flavor-selflink'] = 'http://0.0.0.0' # add hpa capabilities if (flavor['name'].find('onap.') == 0): @@ -64,7 +64,7 @@ class Registry(newton_registration.Registry): extraResp = self._get_list_resources(req_resouce, "compute", session, viminfo, vimid, "extra_specs") hpa_capabilities = self._get_hpa_capabilities(flavor, extraResp) - flavor_info['hpa_capabilities'] = hpa_capabilities + flavor_info['hpa-capabilities'] = {'hpa-capability': hpa_capabilities} self._update_resoure( cloud_owner, cloud_region_id, flavor['id'], @@ -143,15 +143,15 @@ class Registry(newton_registration.Registry): basic_capability = {} feature_uuid = uuid.uuid4() - basic_capability['hpaCapabilityID'] = str(feature_uuid) - basic_capability['hpaFeature'] = 'basicCapabilities' - basic_capability['hardwareArchitecture'] = 'generic' - basic_capability['version'] = 'v1' + basic_capability['hpa-capability-id'] = str(feature_uuid) + basic_capability['hpa-feature'] = 'basicCapabilities' + basic_capability['architecture'] = 'generic' + basic_capability['hpa-version'] = 'v1' - basic_capability['attributes'] = [] - basic_capability['attributes'].append({'hpa-attribute-key': 'numVirtualCpu', + basic_capability['hpa-feature-attributes'] = [] + basic_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numVirtualCpu', 'hpa-attribute-value':{'value': str(flavor['vcpus']) }}) - basic_capability['attributes'].append({'hpa-attribute-key':'virtualMemSize', + basic_capability['hpa-feature-attributes'].append({'hpa-attribute-key':'virtualMemSize', 'hpa-attribute-value': {'value':str(flavor['ram']), 'unit':'MB'}}) return basic_capability @@ -161,17 +161,17 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:cpu_policy') or extra_specs.has_key('hw:cpu_thread_policy'): - cpupining_capability['hpaCapabilityID'] = str(feature_uuid) - cpupining_capability['hpaFeature'] = 'cpuPining' - cpupining_capability['hardwareArchitecture'] = 'generic' - cpupining_capability['version'] = 'v1' + cpupining_capability['hpa-capability-id'] = str(feature_uuid) + cpupining_capability['hpa-feature'] = 'cpuPining' + cpupining_capability['architecture'] = 'generic' + cpupining_capability['hpa-version'] = 'v1' - cpupining_capability['attributes'] = [] + cpupining_capability['hpa-feature-attributes'] = [] if extra_specs.has_key('hw:cpu_thread_policy'): - cpupining_capability['attributes'].append({'hpa-attribute-key': 'logicalCpuThreadPinningPolicy', + cpupining_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'logicalCpuThreadPinningPolicy', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_thread_policy'])}}) if extra_specs.has_key('hw:cpu_policy'): - cpupining_capability['attributes'].append({'hpa-attribute-key':'logicalCpuPinningPolicy', + cpupining_capability['hpa-feature-attributes'].append({'hpa-attribute-key':'logicalCpuPinningPolicy', 'hpa-attribute-value': {'value':str(extra_specs['hw:cpu_policy'])}}) return cpupining_capability @@ -181,20 +181,20 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:cpu_sockets') or extra_specs.has_key('hw:cpu_cores') or extra_specs.has_key('hw:cpu_threads'): - cputopology_capability['hpaCapabilityID'] = str(feature_uuid) - cputopology_capability['hpaFeature'] = 'cpuTopology' - cputopology_capability['hardwareArchitecture'] = 'generic' - cputopology_capability['version'] = 'v1' + cputopology_capability['hpa-capability-id'] = str(feature_uuid) + cputopology_capability['hpa-feature'] = 'cpuTopology' + cputopology_capability['architecture'] = 'generic' + cputopology_capability['hpa-version'] = 'v1' - cputopology_capability['attributes'] = [] + cputopology_capability['hpa-feature-attributes'] = [] if extra_specs.has_key('hw:cpu_sockets'): - cputopology_capability['attributes'].append({'hpa-attribute-key': 'numCpuSockets', + cputopology_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numCpuSockets', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_sockets'])}}) if extra_specs.has_key('hw:cpu_cores'): - cputopology_capability['attributes'].append({'hpa-attribute-key': 'numCpuCores', + cputopology_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numCpuCores', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_cores'])}}) if extra_specs.has_key('hw:cpu_threads'): - cputopology_capability['attributes'].append({'hpa-attribute-key': 'numCpuThreads', + cputopology_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numCpuThreads', 'hpa-attribute-value':{'value': str(extra_specs['hw:cpu_threads'])}}) return cputopology_capability @@ -204,14 +204,26 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:mem_page_size'): - hugepages_capability['hpaCapabilityID'] = str(feature_uuid) - hugepages_capability['hpaFeature'] = 'hugePages' - hugepages_capability['hardwareArchitecture'] = 'generic' - hugepages_capability['version'] = 'v1' - - hugepages_capability['attributes'] = [] - hugepages_capability['attributes'].append({'hpa-attribute-key': 'memoryPageSize', - 'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size'])}}) + hugepages_capability['hpa-capability-id'] = str(feature_uuid) + hugepages_capability['hpa-feature'] = 'hugePages' + hugepages_capability['architecture'] = 'generic' + hugepages_capability['hpa-version'] = 'v1' + + hugepages_capability['hpa-feature-attributes'] = [] + if extra_specs['hw:mem_page_size'] == 'large': + hugepages_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': '2', + 'unit': 'MB'}}) + elif extra_specs['hw:mem_page_size'] == 'small': + hugepages_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': '4', + 'unit': 'KB'}}) + elif extra_specs['hw:mem_page_size'] == 'any': + self._logger.info("Currently HPA feature memoryPageSize did not support 'any' page!!") + else : + hugepages_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'memoryPageSize', + 'hpa-attribute-value':{'value': str(extra_specs['hw:mem_page_size']), + 'unit': 'KB'}}) return hugepages_capability def _get_numa_capabilities(self, extra_specs): @@ -219,13 +231,13 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:numa_nodes'): - numa_capability['hpaCapabilityID'] = str(feature_uuid) - numa_capability['hpaFeature'] = 'numa' - numa_capability['hardwareArchitecture'] = 'generic' - numa_capability['version'] = 'v1' + numa_capability['hpa-capability-id'] = str(feature_uuid) + numa_capability['hpa-feature'] = 'numa' + numa_capability['architecture'] = 'generic' + numa_capability['hpa-version'] = 'v1' - numa_capability['attributes'] = [] - numa_capability['attributes'].append({'hpa-attribute-key': 'numaNodes', + numa_capability['hpa-feature-attributes'] = [] + numa_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'numaNodes', 'hpa-attribute-value':{'value': str(extra_specs['hw:numa_nodes'])}}) for num in range(0, int(extra_specs['hw:numa_nodes'])): @@ -235,9 +247,9 @@ class Registry(newton_registration.Registry): numamem_key = "numaMem-%s" % num if extra_specs.has_key(numa_cpu_node) and extra_specs.has_key(numa_mem_node): - numa_capability['attributes'].append({'hpa-attribute-key': numacpu_key, + numa_capability['hpa-feature-attributes'].append({'hpa-attribute-key': numacpu_key, 'hpa-attribute-value':{'value': str(extra_specs[numa_cpu_node])}}) - numa_capability['attributes'].append({'hpa-attribute-key': numamem_key, + numa_capability['hpa-feature-attributes'].append({'hpa-attribute-key': numamem_key, 'hpa-attribute-value':{'value': str(extra_specs[numa_mem_node]),'unit':'MB'}}) return numa_capability @@ -246,17 +258,17 @@ class Registry(newton_registration.Registry): storage_capability = {} feature_uuid = uuid.uuid4() - storage_capability['hpaCapabilityID'] = str(feature_uuid) - storage_capability['hpaFeature'] = 'localStorage' - storage_capability['hardwareArchitecture'] = 'generic' - storage_capability['version'] = 'v1' + storage_capability['hpa-capability-id'] = str(feature_uuid) + storage_capability['hpa-feature'] = 'localStorage' + storage_capability['architecture'] = 'generic' + storage_capability['hpa-version'] = 'v1' - storage_capability['attributes'] = [] - storage_capability['attributes'].append({'hpa-attribute-key': 'diskSize', + storage_capability['hpa-feature-attributes'] = [] + storage_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'diskSize', 'hpa-attribute-value':{'value': str(flavor['disk']), 'unit':'GB'}}) - storage_capability['attributes'].append({'hpa-attribute-key': 'swapMemSize', + storage_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'swapMemSize', 'hpa-attribute-value':{'value': str(flavor['swap']), 'unit':'MB'}}) - storage_capability['attributes'].append({'hpa-attribute-key': 'ephemeralDiskSize', + storage_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'ephemeralDiskSize', 'hpa-attribute-value':{'value': str(flavor['OS-FLV-EXT-DATA:ephemeral']), 'unit':'GB'}}) return storage_capability @@ -265,13 +277,13 @@ class Registry(newton_registration.Registry): feature_uuid = uuid.uuid4() if extra_specs.has_key('hw:capabilities:cpu_info:features'): - instruction_capability['hpaCapabilityID'] = str(feature_uuid) - instruction_capability['hpaFeature'] = 'instructionSetExtensions' - instruction_capability['hardwareArchitecture'] = 'Intel64' - instruction_capability['version'] = 'v1' + instruction_capability['hpa-capability-id'] = str(feature_uuid) + instruction_capability['hpa-feature'] = 'instructionSetExtensions' + instruction_capability['architecture'] = 'Intel64' + instruction_capability['hpa-version'] = 'v1' - instruction_capability['attributes'] = [] - instruction_capability['attributes'].append({'hpa-attribute-key': 'instructionSetExtensions', + instruction_capability['hpa-feature-attributes'] = [] + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'instructionSetExtensions', 'hpa-attribute-value':{'value': str(extra_specs['hw:capabilities:cpu_info:features'])}}) return instruction_capability @@ -283,32 +295,32 @@ class Registry(newton_registration.Registry): value1 = extra_specs['pci_passthrough:alias'].split(':') value2 = value1[0].split('-') - instruction_capability['hpaCapabilityID'] = str(feature_uuid) - instruction_capability['hpaFeature'] = 'pciePassthrough' - instruction_capability['hardwareArchitecture'] = str(value2[2]) - instruction_capability['version'] = 'v1' - - - instruction_capability['attributes'] = [] - instruction_capability['attributes'].append({'hpa-attribute-key': 'pciCount', + instruction_capability['hpa-capability-id'] = str(feature_uuid) + instruction_capability['hpa-feature'] = 'pciePassthrough' + instruction_capability['architecture'] = str(value2[2]) + instruction_capability['hpa-version'] = 'v1' + + + instruction_capability['hpa-feature-attributes'] = [] + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciCount', 'hpa-attribute-value':{'value': str(value1[1])}}) - instruction_capability['attributes'].append({'hpa-attribute-key': 'pciVendorId', + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciVendorId', 'hpa-attribute-value':{'value': str(value2[3])}}) - instruction_capability['attributes'].append({'hpa-attribute-key': 'pciDeviceId', + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'pciDeviceId', 'hpa-attribute-value':{'value': str(value2[4])}}) - + return instruction_capability def _get_ovsdpdk_capabilities(self, extra_specs): instruction_capability = {} feature_uuid = uuid.uuid4() - instruction_capability['hpaCapabilityID'] = str(feature_uuid) - instruction_capability['hpaFeature'] = 'ovsDpdk' - instruction_capability['hardwareArchitecture'] = 'Intel64' - instruction_capability['version'] = 'v1' + instruction_capability['hpa-capability-id'] = str(feature_uuid) + instruction_capability['hpa-feature'] = 'ovsDpdk' + instruction_capability['architecture'] = 'Intel64' + instruction_capability['hpa-version'] = 'v1' - instruction_capability['attributes'] = [] - instruction_capability['attributes'].append({'hpa-attribute-key': 'dataProcessingAccelerationLibrary', + instruction_capability['hpa-feature-attributes'] = [] + instruction_capability['hpa-feature-attributes'].append({'hpa-attribute-key': 'dataProcessingAccelerationLibrary', 'hpa-attribute-value':{'value': str('v17.02')}}) return instruction_capability diff --git a/windriver/titanium_cloud/settings.py b/windriver/titanium_cloud/settings.py index c3da724f..296d8e75 100644 --- a/windriver/titanium_cloud/settings.py +++ b/windriver/titanium_cloud/settings.py @@ -104,7 +104,7 @@ MULTICLOUD_PREFIX = "http://%s:%s/api/multicloud-titanium_cloud/v0" % ( AAI_ADDR = os.environ.get('AAI_ADDR', "aai.api.simpledemo.openecomp.org") AAI_PORT = os.environ.get('AAI_PORT', "8443") AAI_SERVICE_URL = 'https://%s:%s/aai' % (AAI_ADDR, AAI_PORT) -AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "v11") +AAI_SCHEMA_VERSION = os.environ.get('AAI_SCHEMA_VERSION', "v13") AAI_USERNAME = os.environ.get('AAI_USERNAME', "AAI") AAI_PASSWORD = os.environ.get('AAI_PASSWORD', "AAI") |