diff options
Diffstat (limited to 'ocata')
-rw-r--r-- | ocata/docker/Dockerfile | 2 | ||||
-rw-r--r-- | ocata/docker/build_image.sh | 4 | ||||
-rw-r--r-- | ocata/ocata/pub/config/log.yml | 7 | ||||
-rw-r--r-- | ocata/ocata/registration/tests/test_registration.py | 4 | ||||
-rw-r--r-- | ocata/ocata/registration/views/registration.py | 161 | ||||
-rw-r--r-- | ocata/ocata/settings.py | 2 | ||||
-rw-r--r-- | ocata/pom.xml | 2 | ||||
-rw-r--r-- | ocata/vagrant/test/Dockerfile | 2 |
8 files changed, 98 insertions, 86 deletions
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" |