diff options
author | Denes Nemeth <denes.nemeth@nokia.com> | 2018-02-12 20:55:54 +0100 |
---|---|---|
committer | Denes Nemeth <denes.nemeth@nokia.com> | 2018-02-23 11:44:45 +0100 |
commit | b17042b955489d8a023d09abad5436ff9b900dc3 (patch) | |
tree | 1e4392ac04a2fb1ed8d17075d504cf6594acaf16 /nokiav2/docs/sample | |
parent | d4982f7b1777e9cdae9a4cc7d0d104263889ac69 (diff) |
Updating Nokia driver
Change-Id: I950afe6acbdb359cd67a448024f006a45e8fc293
Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com>
Issue-ID: VFC-728
Diffstat (limited to 'nokiav2/docs/sample')
5 files changed, 103 insertions, 0 deletions
diff --git a/nokiav2/docs/sample/aai.create.customer.request.json b/nokiav2/docs/sample/aai.create.customer.request.json new file mode 100644 index 00000000..35773843 --- /dev/null +++ b/nokiav2/docs/sample/aai.create.customer.request.json @@ -0,0 +1,21 @@ +{ + "global-customer-id": "123456", + "subscriber-name": "CbamCustomer", + "subscriber-type": "INFRA", + "service-subscriptions": { + "service-subscription": [ + { + "service-type": "Database", + "relationship-list": { + "relationship": [{ + "related-to": "tenant", + "relationship-data": [ + {"relationship-key": "cloud-region.cloud-owner", "relationship-value": "Nokia"}, + {"relationship-key": "cloud-region.cloud-region-id", "relationship-value": "RegionOne"}, + {"relationship-key": "tenant.tenant-id", "relationship-value": "2ca57d2dbeda4e8a84739319bab769f4"} + ] + }] + } + } + ]} +}
\ No newline at end of file diff --git a/nokiav2/docs/sample/aai.create.tenant.request.json b/nokiav2/docs/sample/aai.create.tenant.request.json new file mode 100644 index 00000000..afe2f546 --- /dev/null +++ b/nokiav2/docs/sample/aai.create.tenant.request.json @@ -0,0 +1,6 @@ + { + "cloud-owner": "Nokia", + "cloud-region-id": "RegionOne", + "tenant-id": "2ca57d2dbeda4e8a84739319bab769f4", + "tenant-name": "VFC" + }
\ No newline at end of file diff --git a/nokiav2/docs/sample/cbam.collectConnectionPoints.js b/nokiav2/docs/sample/cbam.collectConnectionPoints.js new file mode 100644 index 00000000..f5cfc675 --- /dev/null +++ b/nokiav2/docs/sample/cbam.collectConnectionPoints.js @@ -0,0 +1,71 @@ +var collectConnectionPoints = function(resourceModel, diff) { + return collectPorts(resourceModel, diff) +}; + +function collectPorts(resourceModel, diff){ + pathToResource = {} + collectResources('', resourceModel, pathToResource, true); + transformedPorts = [] + Object.keys(pathToResource).forEach(function (path) { + var port = pathToResource[path]; + transformedPort = {} + transformedPort.name = port.attributes.name; + transformedPort.providerId = port.attributes.id; + transformedPort.cpId = path; + var managedPort = false; + if(port.hasOwnProperty('externalConnectionPoint')){ + transformedPort.ecpdId = port.externalConnectionPoint; + managedPort = true; + } + if(port.hasOwnProperty('connectionPoint')){ + transformedPort.cpdId = port.connectionPoint; + managedPort = true; + } + transformedPort.tenantId = port.attributes.tenant_id; + transformedPort.ipAddress = port.attributes.fixed_ips[0].ip_address; + transformedPort.macAddress = port.attributes.mac_address; + transformedPort.serverProviderId = port.attributes.device_id; + transformedPort.networkProviderId = port.attributes.network_id; + transformedPort.changeType = 'untouched'; + var added = contains(diff.add, path); + var removed = contains(diff.remove, path); + if(added && removed){ + transformedPort.changeType = "MODIFIED"; + } + else{ + if(removed){ + transformedPort.changeType = "REMOVED"; + } + if(added){ + transformedPort.changeType = "ADDED"; + } + } + if('untouched' != transformedPort.changeType && managedPort){ + transformedPorts.push(transformedPort) + } + }) + return transformedPorts; +}; + +function contains(resourceChanges, path){ + var keys = Object.keys(resourceChanges); + return keys.indexOf(path) !== -1; +} + +function collectResources(path, root, pathToResouceMap, onResources){ + root && Object.keys(root).forEach(function(item) { + if(item == 'resource_type' && root[item] == 'OS::Neutron::Port'){ + pathToResouceMap[path] = root + } + else if(typeof root[item] === "object"){ + var newItem = onResources ? "" : item; + var newPath = path; + if('' != newItem && path != ''){ + newPath += "."; + } + newPath += newItem; + collectResources(newPath, root[item], pathToResouceMap, !onResources) + } + }); +}; + diff --git a/nokiav2/docs/sample/cbam.post.collectConnectionPoints.js b/nokiav2/docs/sample/cbam.post.collectConnectionPoints.js new file mode 100644 index 00000000..c70d36ed --- /dev/null +++ b/nokiav2/docs/sample/cbam.post.collectConnectionPoints.js @@ -0,0 +1,4 @@ +return { + "cbam_post" : collectConnectionPoints($.resource_model, $.model_diff), + "cbam_pre" : $.operation_result.cbam_pre + } diff --git a/nokiav2/docs/sample/cbam.pre.collectConnectionPoints.js b/nokiav2/docs/sample/cbam.pre.collectConnectionPoints.js new file mode 100644 index 00000000..64153a20 --- /dev/null +++ b/nokiav2/docs/sample/cbam.pre.collectConnectionPoints.js @@ -0,0 +1 @@ +return { "cbam_pre" : collectConnectionPoints($.resource_model, $.model_diff) } |