diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-04-16 16:05:51 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-16 16:05:51 +0000 |
commit | e5f139e3c865eb429dc11a987ad7a01b759c6692 (patch) | |
tree | 031a1cf40bc502fd8c506204e98bb48d934e7a70 /examples | |
parent | 28e6481e51deef346c00d37631df4b07ebce333c (diff) | |
parent | 5262c350a449c02d91b558976c37850d6340ad81 (diff) |
Merge "ONAP BBS: Apex Nomadic ONT Policy Implementation"
Diffstat (limited to 'examples')
20 files changed, 1741 insertions, 0 deletions
diff --git a/examples/examples-onap-bbs/pom.xml b/examples/examples-onap-bbs/pom.xml new file mode 100644 index 000000000..c45d808f7 --- /dev/null +++ b/examples/examples-onap-bbs/pom.xml @@ -0,0 +1,148 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 Ericsson. All rights reserved. + Copyright (C) 2019 Huawei. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SPDX-License-Identifier: Apache-2.0 + ============LICENSE_END========================================================= +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.policy.apex-pdp.examples</groupId> + <artifactId>examples</artifactId> + <version>2.1.0-SNAPSHOT</version> + </parent> + + <artifactId>examples-onap-bbs</artifactId> + <name>${project.artifactId}</name> + <description>Specific code for the APEX ONAP BBS Example</description> + + <properties> + <policymodel.name>NomadicONTPolicyModel</policymodel.name> + <apex-domains-onap-bbs-dir>${project.basedir}/src</apex-domains-onap-bbs-dir> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.policy.apex-pdp.auth</groupId> + <artifactId>cli-editor</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.services</groupId> + <artifactId>services-engine</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.containers</groupId> + <artifactId>jersey-container-grizzly2-http</artifactId> + <version>${version.jersey}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + <version>${version.jersey}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId> + <artifactId>plugins-context-schema-avro</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId> + <artifactId>plugins-executor-javascript</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> + <artifactId>plugins-event-carrier-restrequestor</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId> + <artifactId>plugins-event-carrier-restclient</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>aai</artifactId> + <version>${version.policy.models}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>appclcm</artifactId> + <version>${version.policy.models}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> + <artifactId>events</artifactId> + <version>${version.policy.models}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- Generate the APEX Policy JSON from the APEX CLI command --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-policy</id> + <phase>compile</phase> + <goals> + <goal>java</goal> + </goals> + <configuration> + <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass> + <classpathScope>compile</classpathScope> + <arguments> + <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument> + <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument> + <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument> + <argument>--working-dir=${project.basedir}</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>apexSite</id> + <activation> + <property> + <name>apexSite</name> + </property> + </activation> + <properties> + <adsite-examples-onap-bbs-dir>${project.basedir}/src</adsite-examples-onap-bbs-dir> + </properties> + <distributionManagement> + <site> + <id>${project.artifactId}-site</id> + <url>${apex.adsite.prefix}/modules/${project.parent.artifactId}/${project.artifactId}/</url> + </site> + </distributionManagement> + </profile> + </profiles> +</project> diff --git a/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/NomadicONTPolicyModel_config.json b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/NomadicONTPolicyModel_config.json new file mode 100644 index 000000000..eef2d99a6 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/NomadicONTPolicyModel_config.json @@ -0,0 +1,77 @@ +{ + "engineServiceParameters": { + "name": "NomadicONTPolicyModelEngine", + "version": "0.0.1", + "id": 101, + "instanceCount": 4, + "deploymentPort": 12345, + "policyModelFileName": "/home/apexuser/examples/models/ONAPBBS/NomadicONTPolicyModel.json", + "engineParameters": { + "executorParameters": { + "MVEL": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters" + }, + "JAVASCRIPT": { + "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters" + } + }, + "contextParameters": { + "parameterClassName": "org.onap.policy.apex.context.parameters.ContextParameters", + "schemaParameters": { + "Avro": { + "parameterClassName": "org.onap.policy.apex.plugins.context.schema.avro.AvroSchemaHelperParameters" + }, + "Java": { + "parameterClassName": "org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters", + "jsonAdapters": { + "Instant": { + "adaptedClass": "java.time.Instant", + "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" + }, + "APPC_LCM_REQUEST": { + "adaptedClass": "org.onap.policy.appclcm.LcmRequest", + "adaptorClass": "org.onap.policy.appclcm.util.Serialization$RequestAdapter" + }, + "APPC_LCM_RESPONSE": { + "adaptedClass": "org.onap.policy.appclcm.LcmResponse", + "adaptorClass": "org.onap.policy.appclcm.util.Serialization$ResponseAdapter" + } + } + } + } + } + } + }, + "eventOutputParameters": { + "FirstProducer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "standardIo": true + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON" + } + } + }, + "eventInputParameters": { + "SecondConsumer": { + "carrierTechnologyParameters": { + "carrierTechnology": "FILE", + "parameters": { + "fileName": "examples/events/ONAPBBS/EventsIn.json.txt" + } + }, + "eventProtocolParameters": { + "eventProtocol": "JSON", + "parameters": { + "nameAlias": "policyName", + "versionAlias": "version", + "sourceAlias": "from", + "pojoField": "VirtualControlLoopEvent" + } + } + } + } +} diff --git a/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/config.txt b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/config.txt new file mode 100644 index 000000000..56b6821f7 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/examples/config/ONAPBBS/config.txt @@ -0,0 +1,2 @@ +AAI_URL=192.167.1.3:8080 +SDNC_URL=192.167.1.3:8080
\ No newline at end of file diff --git a/examples/examples-onap-bbs/src/main/resources/examples/events/ONAPBBS/EventsIn.json.txt b/examples/examples-onap-bbs/src/main/resources/examples/events/ONAPBBS/EventsIn.json.txt new file mode 100644 index 000000000..900bb0681 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/examples/events/ONAPBBS/EventsIn.json.txt @@ -0,0 +1,42 @@ +{ + "closedLoopEventClient":"DCAE.BBS_event_processor_mSInstance", + "policyVersion":"1.0.0.5", + "policyName":"Nomadic_ONT", + "policyScope":"reRegPolicyScope", + "target_type":"VM", + "AAI":{ + "attachmentPoint":"olt11-1-1", + "service-information.hsia-cfs-service-instance-id":"1923eaa8-8ab7-49ef-b4c2-e185efbbe832", + "cvlan":"1005", + "svlan":"100", + "remoteId":"some-remote-id" + }, + "closedLoopAlarmStart":1553067455, + "closedLoopEventStatus":"ONSET", + "closedLoopControlName":"reRegControlName", + "version":"1.0.0", + "target":"vserver.vserver-name", + "requestID":"407a6515-4b10-46ad-a249-efe529a36c69", + "from":"DCAE" +} +{ + "closedLoopEventClient":"DCAE.BBS_event_processor_mSInstance", + "policyVersion":"1.0.0.5", + "policyName":"CPE_Authentication", + "policyScope":"reRegPolicyScope", + "target_type":"VM", + "AAI":{ + "attachmentPoint":"olt11-1-1", + "service-information.hsia-cfs-service-instance-id":"1923eaa8-8ab7-49ef-b4c2-e185efbbe832", + "cvlan":"1005", + "svlan":"100", + "remoteId":"some-remote-id" + }, + "closedLoopAlarmStart":1553067455, + "closedLoopEventStatus":"ONSET", + "closedLoopControlName":"reRegControlName", + "version":"1.0.0", + "target":"vserver.vserver-name", + "requestID":"407a6515-4b10-46ad-a249-efe529a36c69", + "from":"DCAE" +}
\ No newline at end of file diff --git a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js new file mode 100644 index 000000000..f488c27bf --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceAssignedTask.js @@ -0,0 +1,210 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.apache.avro.Schema); +importClass(java.io.BufferedReader); +importClass(java.io.IOException); +importClass(java.nio.file.Files); +importClass(java.nio.file.Paths); + +executor.logger.info("Begin Execution AAIServiceAssignedTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var requestID = executor.inFields.get("requestID"); +var serviceInstanceId = executor.inFields.get("serviceInstanceId"); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); +executor.logger.info(vcpeClosedLoopStatus); + +var jsonObj; +var aaiUpdateResult = true; + +/* Get AAI URL from Configuration file. */ +var AAI_URL = "localhost:8080"; +var CUSTOMER_ID = requestID; +var BBS_CFS_SERVICE_TYPE = "BBS-CFS-Access_Test"; +var SERVICE_INSTANCE_UUID = serviceInstanceId; +var service_instance_id; +var resource_version; +var relationship_list; +var orchStatus; +try { + var br = Files.newBufferedReader(Paths.get("/home/apexuser/examples/config/ONAPBBS/config.txt")); + // read line by line + var line; + while ((line = br.readLine()) != null) { + if (line.startsWith("AAI_URL")) { + var str = line.split("="); + AAI_URL = str[str.length - 1]; + break; + } + } +} catch (err) { + executor.logger.info("Failed to retrieve data " + err); +} + +executor.logger.info("AAI_URL=>" + AAI_URL); + +/* Get service instance Id from AAI */ +try { + //var urlGet = "https://" + AAI_URL + "/aai/v14/business/customers/customer/" + CUSTOMER_ID + "/service-subscriptions/service-subscription/" + BBS_CFS_SERVICE_TYPE + "/service-instances/service-instance/" + SERVICE_INSTANCE_UUID + var urlGet = "http://" + AAI_URL + "/RestConfServer/rest/operations/policy/su1/getService"; + executor.logger.info("Query url" + urlGet); + + result = httpGet(urlGet).data; + executor.logger.info("Data received From " + urlGet + " " + result.toString()); + jsonObj = JSON.parse(result); + + + /* Retrieve the service instance id */ + service_instance_id = jsonObj['service-instance-id']; + resource_version = jsonObj['resource-version']; + relationship_list = jsonObj['relationship-list']; + executor.logger.info("After Parse " + JSON.stringify(jsonObj, null, 4)); + + if (result == "") { + aaiUpdateResult = false; + } +}catch (err) { + executor.logger.info("Failed to retrieve data " + err); + aaiUpdateResult = false; +} + +/* BBS Policy updates orchestration status of {{bbs-cfs-service-instance-UUID}} [ active --> assigned ] */ +orchStatus = { + "service-instance-id": service_instance_id, + "resource-version": resource_version, + "orchestration-status": "assigned", + "relationship-list": relationship_list + }; +try { + if (aaiUpdateResult == true) { + executor.logger.info("ready to putAfter Parse " + JSON.stringify(orchStatus, null, 4)); + + //var urlPut = "https://" + AAI_URL + "/aai/v14/business/customers/customer/" + CUSTOMER_ID + "/service-subscriptions/service-subscription/" + BBS_CFS_SERVICE_TYPE + "/service-instances/service-instance/" + SERVICE_INSTANCE_UUID; + var urlPut = "http://" + AAI_URL + "/RestConfServer/rest/operations/policy/su1/putOrchStatus"; + result = httpPut(urlPut, JSON.stringify(orchStatus)).data; + executor.logger.info("Data received From " + urlPut + " " +result.toString()); + jsonObj = JSON.parse(result); + executor.logger.info("After Parse " + JSON.stringify(jsonObj, null, 4)); + + /* If failure to retrieve data proceed to Failure */ + if (result == "") { + aaiUpdateResult = false; + } + } +}catch (err) { + executor.logger.info("Failed to retrieve data " + err); + aaiUpdateResult = false; +} + +/* BBS Policy fetches from AAI {{bbs-cfs-service-instance-UUID}} relationship-list, including: CPE PNF ID, AccessConnectivity VF ID, InternetProfile VF ID */ +try { + if (aaiUpdateResult == true) { + var urlGet2 = "http://" + AAI_URL + "/RestConfServer/rest/operations/policy/su1/getHsia"; + //var urlGet2 = "https://"+ AAI_URL + "/aai/v11/business/customers/customer/" + CUSTOMER_ID + "/service-subscriptions/service-subscription/" + BBS_CFS_SERVICE_TYPE +"/service-instances/service-instance/"+ SERVICE_INSTANCE_UUID + "?depth=all" + result = httpGet(urlGet2).data; + executor.logger.info("Data received From " + urlGet2 + " " +result.toString()); + jsonObj = JSON.parse(result); + executor.logger.info("After Parse " + JSON.stringify(jsonObj, null, 4)); + + /* If failure to retrieve data proceed to Failure */ + if ((result == "") || (jsonObj['orchestration-status'] != 'assigned')) { + executor.logger.info("Failed to get assigned status "); + aaiUpdateResult = false; + } + } +}catch (err) { + executor.logger.info("Failed to retrieve data " + err); + aaiUpdateResult = false; +} +/* If Success then Fill output schema */ +if (aaiUpdateResult === true) { + vcpeClosedLoopStatus.put("result", "SUCCESS"); + vcpeClosedLoopStatus.put("aai_message", JSON.stringify(orchStatus)); +} else { + vcpeClosedLoopStatus.put("result", "FAILURE"); +} + +executor.outFields.put("requestID", requestID); +executor.outFields.put("attachmentPoint", attachmentPoint); +executor.outFields.put("serviceInstanceId", executor.inFields.get("serviceInstanceId")); + +var returnValue = executor.isTrue; +executor.logger.info("==========>" + executor.outFields); +executor.logger.info("End Execution AAIServiceAssignedTask.js"); + + +/* Utility functions Begin */ +function httpGet(theUrl){ + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "GET"; + return asResponse(con); +} + +function httpPost(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "POST"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asResponse(con); +} + +function httpPut(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "PUT"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asResponse(con); +} + +function asResponse(con){ + var d = read(con.inputStream); + return {data : d, statusCode : con.resultCode}; +} + +function write(outputStream, data){ + var wr = new java.io.DataOutputStream(outputStream); + wr.writeBytes(data); + wr.flush(); + wr.close(); +} + +function read(inputStream){ + var inReader = new java.io.BufferedReader(new java.io.InputStreamReader(inputStream)); + var inputLine; + var result = new java.lang.StringBuffer(); + + while ((inputLine = inReader.readLine()) != null) { + result.append(inputLine); + } + inReader.close(); + return result.toString(); +} + +/* Utility functions End */ + diff --git a/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js new file mode 100644 index 000000000..e4f22369c --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/AAIServiceCreateTask.js @@ -0,0 +1,158 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +load("nashorn:mozilla_compat.js"); +importClass(org.apache.avro.Schema); +importClass(java.io.BufferedReader); +importClass(java.io.IOException); +importClass(java.nio.file.Files); +importClass(java.nio.file.Paths); + +executor.logger.info("Begin Execution AAIServiceCreateTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var requestID = executor.inFields.get("requestID"); +var serviceInstanceId = executor.inFields.get("serviceInstanceId"); + +//Get the AAI URL from configuraiotn file +var AAI_URL = "localhost:8080"; +var CUSTOMER_ID = requestID; +var BBS_CFS_SERVICE_TYPE = "BBS-CFS-Access_Test"; +var SERVICE_INSTANCE_UUID = serviceInstanceId; + +try { + var br = Files.newBufferedReader(Paths.get("/home/apexuser/examples/config/ONAPBBS/config.txt")); + // read line by line + var line; + while ((line = br.readLine()) != null) { + if (line.startsWith("AAI_URL")) { + var str = line.split("="); + AAI_URL = str[str.length - 1]; + break; + } + + } +} catch (err) { + executor.logger.info("Failed to retrieve data " + err); +} +executor.logger.info("AAI_URL=>" + AAI_URL); + + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var requestID = executor.inFields.get("requestID"); +var serviceInstanceId = executor.inFields.get("serviceInstanceId"); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); +executor.logger.info(vcpeClosedLoopStatus); + +var jsonObj = JSON.parse(vcpeClosedLoopStatus.get("aai_message")); + +jsonObj['orchestration-status'] = "created"; +executor.logger.info(" string" + JSON.stringify(jsonObj, null, 4)); + +var aaiUpdateResult = true; + + +/*BBS Policy updates {{bbs-cfs-service-instance-UUID}} orchestration-status [ assigned --> created ]*/ +try { + //var urlPut = "https://" + AAI_URL + "/aai/v14/business/customers/customer/" + CUSTOMER_ID + "/service-subscriptions/service-subscription/" + BBS_CFS_SERVICE_TYPE + "/service-instances/service-instance/" + SERVICE_INSTANCE_UUID; + var urlPut = "http://" + AAI_URL + "/RestConfServer/rest/operations/policy/su2/aaiUpdate"; + result = httpPut(urlPut, JSON.stringify(jsonObj)).data; + executor.logger.info("Data received From " + urlPut + " " +result.toString()); + repos = JSON.parse(result); + executor.logger.info("After Parse " + result.toString()); + + if (result == "") { + aaiUpdateResult = false; + } +}catch (err) { + executor.logger.info("Failed to retrieve data " + err); + aaiUpdateResult = false; +} + +/* If Success then Fill output schema */ +if (aaiUpdateResult === true) { + vcpeClosedLoopStatus.put("result", "SUCCESS"); +} else { + vcpeClosedLoopStatus.put("result", "FAILURE"); +} + + +executor.outFields.put("requestID", requestID); +executor.outFields.put("attachmentPoint", attachmentPoint); +executor.outFields.put("serviceInstanceId", executor.inFields.get("serviceInstanceId")); + +var returnValue = executor.isTrue; +executor.logger.info("==========>" + executor.outFields); +executor.logger.info("End Execution AAIServiceCreateTask.js"); + + +function httpGet(theUrl){ + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "GET"; + return asResponse(con); +} + +function httpPost(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "POST"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asResponse(con); +} + +function httpPut(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "PUT"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asResponse(con); +} + +function asResponse(con){ + var d = read(con.inputStream); + return {data : d, statusCode : con.resultCode}; +} + +function write(outputStream, data){ + var wr = new java.io.DataOutputStream(outputStream); + wr.writeBytes(data); + wr.flush(); + wr.close(); +} + +function read(inputStream){ + var inReader = new java.io.BufferedReader(new java.io.InputStreamReader(inputStream)); + var inputLine; + var result = new java.lang.StringBuffer(); + + while ((inputLine = inReader.readLine()) != null) { + result.append(inputLine); + } + inReader.close(); + return result.toString(); +} + + diff --git a/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js b/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js new file mode 100644 index 000000000..ee646fa36 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info("Begin Execution ErrorServiceUpdateOneLogTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +var returnValue = executor.isTrue; +executor.logger.info("Begin Execution ErrorServiceUpdateOneLogTask.js"); diff --git a/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js b/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js new file mode 100644 index 000000000..19a61cabd --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js @@ -0,0 +1,28 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info("Begin Execution ErrorResourceUpdateLogTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +executor.logger.info(executor.outFields); + +var returnValue = executor.isTrue; +executor.logger.info("End Execution ErrorResourceUpdateLogTask.js"); diff --git a/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js b/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js new file mode 100644 index 000000000..06b11acd5 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js @@ -0,0 +1,99 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +load("nashorn:mozilla_compat.js"); + +executor.logger.info("Begin Execution GetBBSCloseLoopEventTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); +var returnValue = executor.isTrue; + +//**************************************************************************// + +var clEventType = Java.type("org.onap.policy.controlloop.VirtualControlLoopEvent"); +var clEvent = executor.inFields.get("VirtualControlLoopEvent"); +executor.logger.info(clEvent.toString()); +executor.logger.info(clEvent.getClosedLoopControlName()); + +var requestID = clEvent.getRequestId(); +executor.logger.info("requestID = " + requestID); +var attachmentPoint = null; +var vcpeClosedLoopStatus = null; +var serviceInstanceId = null; + +if (clEvent.getAai().get("attachmentPoint") != null) { + attachmentPoint = clEvent.getAai().get("attachmentPoint"); + executor.logger.info("attachmentPoint = " + attachmentPoint); + vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); + serviceInstanceId = clEvent.getAai().get("service-information.hsia-cfs-service-instance-id"); + executor.logger.info("serviceInstanceId = " + serviceInstanceId); + + if (vcpeClosedLoopStatus == null) { + executor.logger.info("Creating context information for new ONT Device \"" + attachmentPoint.toString() + "\""); + + vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").getSchemaHelper().createNewInstance(); + + vcpeClosedLoopStatus.put("closedLoopControlName", clEvent.getClosedLoopControlName()); + vcpeClosedLoopStatus.put("closedLoopAlarmStart", clEvent.getClosedLoopAlarmStart().toEpochMilli()); + vcpeClosedLoopStatus.put("closedLoopEventClient", clEvent.getClosedLoopEventClient()); + vcpeClosedLoopStatus.put("closedLoopEventStatus", clEvent.getClosedLoopEventStatus().toString()); + vcpeClosedLoopStatus.put("version", clEvent.getVersion()); + vcpeClosedLoopStatus.put("requestID", clEvent.getRequestId().toString()); + vcpeClosedLoopStatus.put("target_type", clEvent.getTargetType().toString()); + vcpeClosedLoopStatus.put("target", clEvent.getTarget()); + vcpeClosedLoopStatus.put("from", clEvent.getFrom()); + vcpeClosedLoopStatus.put("policyScope", "Nomadic ONT"); + vcpeClosedLoopStatus.put("policyName", clEvent.getPolicyName()); + vcpeClosedLoopStatus.put("policyVersion", "1.0.0"); + vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis()); + vcpeClosedLoopStatus.put("message", ""); + vcpeClosedLoopStatus.put("result", "SUCCESS"); + var aaiInfo = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").getSchemaHelper().createNewSubInstance("VCPE_AAI_Type"); + + aaiInfo.put("attachmentPoint", clEvent.getAai().get("attachmentPoint")); + aaiInfo.put("cvlan", clEvent.getAai().get("cvlan")); + aaiInfo.put("service_information_hsia_cfs_service_instance_id", clEvent.getAai().get("service-information.hsia-cfs-service-instance-id")); + aaiInfo.put("svlan", clEvent.getAai().get("svlan")); + aaiInfo.put("remoteId", clEvent.getAai().get("remoteId")); + + + vcpeClosedLoopStatus.put("AAI", aaiInfo); + + if (clEvent.getClosedLoopAlarmEnd() != null) { + vcpeClosedLoopStatus.put("closedLoopAlarmEnd", clEvent.getClosedLoopAlarmEnd().toEpochMilli()); + } else { + vcpeClosedLoopStatus.put("closedLoopAlarmEnd", java.lang.Long.valueOf(0)); + } + + executor.getContextAlbum("VCPEClosedLoopStatusAlbum").put(attachmentPoint.toString(), vcpeClosedLoopStatus); + executor.logger.info("Created context information for new vCPE VNF \"" + attachmentPoint.toString() + "\""); + } + + executor.outFields.put("requestID", requestID); + executor.outFields.put("attachmentPoint", attachmentPoint); + executor.outFields.put("serviceInstanceId", attachmentPoint); + executor.logger.info(executor.outFields); +} + +executor.logger.info("********************* Event Successfully Received and stored in album *********************"); + +//**************************************************************************// + + diff --git a/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js b/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js new file mode 100644 index 000000000..f6a7c4ce7 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/NomadicEventSuccessTask.js @@ -0,0 +1,46 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +load("nashorn:mozilla_compat.js"); +importClass(org.apache.avro.Schema); + +executor.logger.info("Begin Execution NomadicEventSuccess.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); + +executor.logger.info("==========>" + executor.outFields); +executor.logger.info("==========>" + executor.inFields); + +result = vcpeClosedLoopStatus.get("result"); + +if (result === "SUCCESS") { + returnValue = executor.isTrue; + executor.outFields.put("result", "SUCCCESS"); + executor.logger.info("BBS policy Execution Done$$$$$$$$$$$"); +} else { + executor.logger.info("BBS policy Execution Failed$$$$$$$$$$$"); + executor.outFields.put("result", "FAILURE"); + returnValue = executor.isFalse; +} + +var returnValue = executor.isTrue; +executor.logger.info("End Execution NomadicEventSuccess.js"); diff --git a/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js b/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js new file mode 100644 index 000000000..959eab772 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/RUorInitStateSelect.js @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +executor.logger.info("Begin Execution RUorInitStateSelect.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var returnValue = executor.isTrue; +var result = null; + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); + +executor.logger.info("==========>" + executor.outFields); +executor.logger.info("==========>" + executor.inFields); + +result = vcpeClosedLoopStatus.get("result"); + +if (result === "SUCCESS") { + executor.subject.getTaskKey("SdncResourceUpdateTask").copyTo(executor.selectedTask); +} else { + executor.subject.getTaskKey("ErrorAAIServiceAssignedLogTask").copyTo(executor.selectedTask); + onsetFlag = executor.isFalse; +} + +executor.logger.info("State Selected Task:" + executor.selectedTask); +executor.logger.info("End Execution RUorInitStateSelect.js"); diff --git a/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js b/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js new file mode 100644 index 000000000..6b4c4ff34 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/SU2orInitStateSelect.js @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +executor.logger.info("Begin Execution SU2orInitStateSelect.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var returnValue = executor.isTrue; +var result = null; + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); + +executor.logger.info("==========>" + executor.outFields); +executor.logger.info("==========>" + executor.inFields); + +result = vcpeClosedLoopStatus.get("result"); + +if (result === "SUCCESS") { + executor.subject.getTaskKey("AAIServiceCreateTask").copyTo(executor.selectedTask); +} else { + executor.subject.getTaskKey("SdncResourceUpdateErrorLogOutput").copyTo(executor.selectedTask); + onsetFlag = executor.isFalse; +} + +executor.logger.info("State Selected Task:" + executor.selectedTask); +executor.logger.info("End Execution RUorInitStateSelect.js");
\ No newline at end of file diff --git a/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js b/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js new file mode 100644 index 000000000..6a302ea6a --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/SdncResourceUpdateTask.js @@ -0,0 +1,163 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(org.apache.avro.Schema); +importClass(java.io.BufferedReader); +importClass(java.io.IOException); +importClass(java.nio.file.Files); +importClass(java.nio.file.Paths); +executor.logger.info("Begin Execution SdncResourceUpdateTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); + +var attachmentPoint = executor.inFields.get("attachmentPoint"); +var requestID = executor.inFields.get("requestID"); +var serviceInstanceId = executor.inFields.get("serviceInstanceId"); + +var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); +executor.logger.info(vcpeClosedLoopStatus); +var jsonObj; +var aaiUpdateResult = true; +var SDNC_URL = "localhost:8080"; +try { + var br = Files.newBufferedReader(Paths.get("/home/apexuser/examples/config/ONAPBBS/config.txt")); + // read line by line + var line; + while ((line = br.readLine()) != null) { + if (line.startsWith("SDNC_URL")) { + var str = line.split("="); + SDNC_URL = str[str.length - 1]; + break; + } + } +} catch (err) { + executor.logger.info("Failed to retrieve data " + err); +} +executor.logger.info("SDNC_URL=>" + SDNC_URL); + + +var result; +var jsonObj; +var aaiUpdateResult = true; + +/* BBS Policy calls SDN-C GR-API to delete AccessConnectivity VF ID */ +var json = {id: 1, someValue: "1234"}; +try { + var urlPost1 = "http://" + SDNC_URL + "/RestConfServer/rest/operations/policy/ru/createInstance"; + result = httpPost(urlPost1, JSON.stringify(json) ,"application/json").data; + executor.logger.info("Data received From " + urlPost1 + " " +result.toString()); + jsonObj = JSON.parse(result); + executor.logger.info("After Parse " + jsonObj.toString()); + + if (result == "") { + aaiUpdateResult = false; + } +}catch (err) { + executor.logger.info("Failed to retrieve data " + err); + aaiUpdateResult = false; +} +/* BBS Policy calls SDN-C GR-API to create new AccessConnectivity VF */ +try { + if (aaiUpdateResult == true) { + var json = {id: 2, someValue: "1234"}; + var urlPost2 = "http://" + SDNC_URL + "/RestConfServer/rest/operations/policy/ru/createInstance"; + result = httpPost(urlPost2, JSON.stringify(json), "application/json").data; + executor.logger.info("Data received From " + urlPost2 + " " +result.toString()); + jsonObj = JSON.parse(result); + executor.logger.info("After Parse " + jsonObj.toString()); + + if (result == "") { + } + } +}catch (err) { + executor.logger.info("Failed to retrieve data " + err); + aaiUpdateResult = false; +} + + +/* If Success then Fill output schema */ +if (aaiUpdateResult === true) { + vcpeClosedLoopStatus.put("result", "SUCCESS"); +} else { + vcpeClosedLoopStatus.put("result", "FAILURE"); +} + + +executor.outFields.put("requestID", requestID); +executor.outFields.put("attachmentPoint", attachmentPoint); +executor.outFields.put("serviceInstanceId", executor.inFields.get("serviceInstanceId")); + +var returnValue = executor.isTrue; +executor.logger.info("==========>" + executor.outFields); +executor.logger.info("End Execution SdncResourceUpdateTask.js"); + + +/* Utility functions Begin */ +function httpGet(theUrl){ + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "GET"; + return asresult(con); +} + +function httpPost(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "POST"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asresult(con); +} + +function httpPut(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "PUT"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asresult(con); +} + +function asresult(con){ + var d = read(con.inputStream); + return {data : d, statusCode : con.resultCode}; +} + +function write(outputStream, data){ + var wr = new java.io.DataOutputStream(outputStream); + wr.writeBytes(data); + wr.flush(); + wr.close(); +} + +function read(inputStream){ + var inReader = new java.io.BufferedReader(new java.io.InputStreamReader(inputStream)); + var inputLine; + var result = new java.lang.StringBuffer(); + + while ((inputLine = inReader.readLine()) != null) { + result.append(inputLine); + } + inReader.close(); + return result.toString(); +} +/* Utility functions End */ diff --git a/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js new file mode 100644 index 000000000..9c48f0d52 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js @@ -0,0 +1,155 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +load("nashorn:mozilla_compat.js"); +importClass(java.io.BufferedReader); +importClass(java.io.IOException); +importClass(java.nio.file.Files); +importClass(java.nio.file.Paths); +executor.logger.info("Begin Execution ServiceUpdateStateCpeAuthTask.js"); +executor.logger.info(executor.subject.id); +executor.logger.info(executor.inFields); +var returnValue = executor.isTrue; + +//**************************************************************************// + +var clEventType = Java.type("org.onap.policy.controlloop.VirtualControlLoopEvent"); +var clEvent = executor.inFields.get("VirtualControlLoopEvent"); +executor.logger.info(clEvent.toString()); +executor.logger.info(clEvent.getClosedLoopControlName()); + +var requestID = clEvent.getRequestId(); +executor.logger.info("requestID = " + requestID); +var attachmentPoint = null; +var serviceInstanceId = null; +var AAI_URL = "localhost:8080"; +try { + var br = Files.newBufferedReader(Paths.get("/home/apexuser/examples/config/ONAPBBS/config.txt")); + // read line by line + var line; + while ((line = br.readLine()) != null) { + if (line.startsWith("AAI_URL")) { + var str = line.split("="); + AAI_URL = str[str.length - 1]; + break; + } + + } +} catch (err) { + executor.logger.info("Failed to retrieve data " + err); +} +executor.logger.info("AAI_URL=>" + AAI_URL); + +if (clEvent.getAai().get("attachmentPoint") != null) { + attachmentPoint = clEvent.getAai().get("attachmentPoint"); + executor.logger.info("attachmentPoint = " + attachmentPoint); + serviceInstanceId = clEvent.getAai().get("service-information.hsia-cfs-service-instance-id"); + executor.logger.info("serviceInstanceId = " + serviceInstanceId); + + var result; + var jsonObj; + var prevResult = true; + + + /*BBS Policy updates {{bbs-cfs-service-instance-UUID}} orchestration-status [ assigned --> created ]*/ + var json = {id: 1, someValue: "1234"}; + try { + var urlPut = "http://" + AAI_URL + "/RestConfServer/rest/operations/policy/cpe/cpeAuthUpdate"; + result = httpPut(urlPut, JSON.stringify(json)).data; + executor.logger.info("Data received From " + urlPut + " " +result.toString()); + repos = JSON.parse(result); + executor.logger.info("After Parse " + result.toString()); + + if (result == "") { + prevResult = false; + } + }catch (err) { + executor.logger.info("Failed to retrieve data " + err); + prevResult = false; + } + + /* If Success then Fill output schema */ + if (prevResult == true) { + executor.outFields.put("result", "SUCCCESS"); + } else { + executor.outFields.put("result", "FAILURE"); + } + + executor.outFields.put("requestID", requestID); + executor.outFields.put("attachmentPoint", attachmentPoint); + executor.outFields.put("serviceInstanceId", attachmentPoint); + executor.logger.info(executor.outFields); +} + + + +var returnValue = executor.isTrue; +executor.logger.info("End Execution ServiceUpdateStateCpeAuthTask.js"); + + +function httpGet(theUrl){ + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "GET"; + return asResponse(con); +} + +function httpPost(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "POST"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asResponse(con); +} + +function httpPut(theUrl, data, contentType){ + contentType = contentType || "application/json"; + var con = new java.net.URL(theUrl).openConnection(); + con.requestMethod = "PUT"; + con.setRequestProperty("Content-Type", contentType); + con.doOutput=true; + write(con.outputStream, data); + return asResponse(con); +} + +function asResponse(con){ + var d = read(con.inputStream); + return {data : d, statusCode : con.resultCode}; +} + +function write(outputStream, data){ + var wr = new java.io.DataOutputStream(outputStream); + wr.writeBytes(data); + wr.flush(); + wr.close(); +} + +function read(inputStream){ + var inReader = new java.io.BufferedReader(new java.io.InputStreamReader(inputStream)); + var inputLine; + var result = new java.lang.StringBuffer(); + + while ((inputLine = inReader.readLine()) != null) { + result.append(inputLine); + } + inReader.close(); + return result.toString(); +} diff --git a/examples/examples-onap-bbs/src/main/resources/policy/NomadicONTPolicyModel.apex b/examples/examples-onap-bbs/src/main/resources/policy/NomadicONTPolicyModel.apex new file mode 100644 index 000000000..e3f319661 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/policy/NomadicONTPolicyModel.apex @@ -0,0 +1,262 @@ +#------------------------------------------------------------------------------- +# ============LICENSE_START======================================================= +# Copyright (C) 2016-2019 Huawei. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +#------------------------------------------------------------------------------- + +#========> create Policy model +model create name=NomadicONTPolicyModel version=1.0.0 + + +#========> Define Schema and Data types +schema create name=SimpleStringType flavour=Java schema=java.lang.String +schema create name=SimpleLongType flavour=Java schema=java.lang.Long +schema create name=SimpleBooleanType flavour=Java schema=java.lang.Boolean +schema create name=UUIDType flavour=Java schema=java.util.UUID + +schema create name=VirtualControlLoopEventType flavour=Java schema=org.onap.policy.controlloop.VirtualControlLoopEvent + +schema create name=VCPEClosedLoopStatusType flavour=Avro schema=LS +#MACROFILE:"src/main/resources/schemas/VCPEClosedLoopStatusType.avsc" +LE + +#=======================> Create Albums +album create name=VCPEClosedLoopStatusAlbum scope=policy writable=true schemaName=VCPEClosedLoopStatusType + + +#===================================> Define Events +#=============>Nomadic ONT +event create name=Nomadic_ONT version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=DCAE target=APEX +event parameter create name=Nomadic_ONT parName=VirtualControlLoopEvent schemaName=VirtualControlLoopEventType + +event create name=AAI_SERVICE_ASSIGNED version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX +event parameter create name=AAI_SERVICE_ASSIGNED parName=requestID schemaName=UUIDType +event parameter create name=AAI_SERVICE_ASSIGNED parName=attachmentPoint schemaName=SimpleStringType +event parameter create name=AAI_SERVICE_ASSIGNED parName=serviceInstanceId schemaName=SimpleStringType optional=true + +event create name=SDNC_RESOURCE_UPDATE version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX +event parameter create name=SDNC_RESOURCE_UPDATE parName=requestID schemaName=UUIDType +event parameter create name=SDNC_RESOURCE_UPDATE parName=attachmentPoint schemaName=SimpleStringType +event parameter create name=SDNC_RESOURCE_UPDATE parName=serviceInstanceId schemaName=SimpleStringType optional=true + +event create name=AAI_SERVICE_CREATE version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX +event parameter create name=AAI_SERVICE_CREATE parName=requestID schemaName=UUIDType +event parameter create name=AAI_SERVICE_CREATE parName=attachmentPoint schemaName=SimpleStringType +event parameter create name=AAI_SERVICE_CREATE parName=serviceInstanceId schemaName=SimpleStringType optional=true + +event create name=ERROR_LOG version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX +event parameter create name=ERROR_LOG parName=errorLogParam schemaName=SimpleStringType + +event create name=END_CONTROL_LOOP version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=APEX +event parameter create name=END_CONTROL_LOOP parName=result schemaName=SimpleStringType +event parameter create name=END_CONTROL_LOOP parName=requestID schemaName=UUIDType +event parameter create name=END_CONTROL_LOOP parName=attachmentPoint schemaName=SimpleStringType +event parameter create name=END_CONTROL_LOOP parName=serviceInstanceId schemaName=SimpleStringType optional=true + + +event create name=END_EVENT version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=DCAE +event parameter create name=END_EVENT parName=result schemaName=SimpleStringType optional=true +event parameter create name=END_EVENT parName=requestID schemaName=UUIDType +event parameter create name=END_EVENT parName=attachmentPoint schemaName=SimpleStringType +event parameter create name=END_EVENT parName=serviceInstanceId schemaName=SimpleStringType optional=true + +#=============>CPE Authentication +event create name=CPE_Authentication version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=DCAE target=APEX +event parameter create name=CPE_Authentication parName=VirtualControlLoopEvent schemaName=VirtualControlLoopEventType + +event create name=AAI_CPE_AUTH_UPDATE version=1.0.0 nameSpace=org.onap.policy.apex.onap.bbs source=APEX target=DCAE +event parameter create name=AAI_CPE_AUTH_UPDATE parName=result schemaName=SimpleStringType +event parameter create name=AAI_CPE_AUTH_UPDATE parName=requestID schemaName=UUIDType +event parameter create name=AAI_CPE_AUTH_UPDATE parName=attachmentPoint schemaName=SimpleStringType +event parameter create name=AAI_CPE_AUTH_UPDATE parName=serviceInstanceId schemaName=SimpleStringType optional=true + + +#========> Define Tasks (1) +task create name=GetBBSCloseLoopEventTask + +task inputfield create name=GetBBSCloseLoopEventTask fieldName=VirtualControlLoopEvent schemaName=VirtualControlLoopEventType +task outputfield create name=GetBBSCloseLoopEventTask fieldName=requestID schemaName=UUIDType +task outputfield create name=GetBBSCloseLoopEventTask fieldName=attachmentPoint schemaName=SimpleStringType +task outputfield create name=GetBBSCloseLoopEventTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task contextref create name=GetBBSCloseLoopEventTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=GetBBSCloseLoopEventTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/GetBBSCloseLoopEventTask.js" +LE + +#========> Define Tasks (2) +task create name=AAIServiceAssignedTask +task inputfield create name=AAIServiceAssignedTask fieldName=requestID schemaName=UUIDType +task inputfield create name=AAIServiceAssignedTask fieldName=attachmentPoint schemaName=SimpleStringType +task inputfield create name=AAIServiceAssignedTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=AAIServiceAssignedTask fieldName=requestID schemaName=UUIDType +task outputfield create name=AAIServiceAssignedTask fieldName=attachmentPoint schemaName=SimpleStringType +task outputfield create name=AAIServiceAssignedTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true + +task contextref create name=AAIServiceAssignedTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=AAIServiceAssignedTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/AAIServiceAssignedTask.js" +LE + +#========> Define Tasks (3) +task create name=ErrorAAIServiceAssignedLogTask +task inputfield create name=ErrorAAIServiceAssignedLogTask fieldName=result schemaName=SimpleStringType +task inputfield create name=ErrorAAIServiceAssignedLogTask fieldName=requestID schemaName=UUIDType +task inputfield create name=ErrorAAIServiceAssignedLogTask fieldName=attachmentPoint schemaName=SimpleStringType +task inputfield create name=ErrorAAIServiceAssignedLogTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=ErrorAAIServiceAssignedLogTask fieldName=errorLogParam schemaName=SimpleStringType + +task logic create name=ErrorAAIServiceAssignedLogTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ErrorAAIServiceAssignedLogTask.js" +LE + +#========> Define Tasks (4) +task create name=SdncResourceUpdateTask +task inputfield create name=SdncResourceUpdateTask fieldName=requestID schemaName=UUIDType +task inputfield create name=SdncResourceUpdateTask fieldName=attachmentPoint schemaName=SimpleStringType +task inputfield create name=SdncResourceUpdateTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=SdncResourceUpdateTask fieldName=requestID schemaName=UUIDType +task outputfield create name=SdncResourceUpdateTask fieldName=attachmentPoint schemaName=SimpleStringType +task outputfield create name=SdncResourceUpdateTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task contextref create name=SdncResourceUpdateTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=SdncResourceUpdateTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/SdncResourceUpdateTask.js" +LE + +#========> Define Tasks (5) +task create name=ErrorSdncResourceUpdateTaskLogTask +task inputfield create name=ErrorSdncResourceUpdateTaskLogTask fieldName=result schemaName=SimpleStringType +task inputfield create name=ErrorSdncResourceUpdateTaskLogTask fieldName=requestID schemaName=UUIDType +task inputfield create name=ErrorSdncResourceUpdateTaskLogTask fieldName=attachmentPoint schemaName=SimpleStringType +task inputfield create name=ErrorSdncResourceUpdateTaskLogTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=ErrorSdncResourceUpdateTaskLogTask fieldName=errorLogParam schemaName=SimpleStringType + +task logic create name=ErrorSdncResourceUpdateTaskLogTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ErrorSdncResourceUpdateTaskLogTask.js" +LE + +#========> Define Tasks (6) +task create name=AAIServiceCreateTask +task inputfield create name=AAIServiceCreateTask fieldName=requestID schemaName=UUIDType +task inputfield create name=AAIServiceCreateTask fieldName=attachmentPoint schemaName=SimpleStringType +task inputfield create name=AAIServiceCreateTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=AAIServiceCreateTask fieldName=requestID schemaName=UUIDType +task outputfield create name=AAIServiceCreateTask fieldName=attachmentPoint schemaName=SimpleStringType +task outputfield create name=AAIServiceCreateTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=AAIServiceCreateTask fieldName=result schemaName=SimpleStringType +task contextref create name=AAIServiceCreateTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=AAIServiceCreateTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/AAIServiceCreateTask.js" +LE + +#========> Define Tasks (7) +task create name=NomadicEventSuccessTask +task inputfield create name=NomadicEventSuccessTask fieldName=requestID schemaName=UUIDType +task inputfield create name=NomadicEventSuccessTask fieldName=attachmentPoint schemaName=SimpleStringType +task inputfield create name=NomadicEventSuccessTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task outputfield create name=NomadicEventSuccessTask fieldName=result schemaName=SimpleStringType optional=true +task contextref create name=NomadicEventSuccessTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=NomadicEventSuccessTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/NomadicEventSuccessTask.js" +LE + + + +#========> Define Tasks (8) +task create name=ServiceUpdateStateCpeAuthTask +task inputfield create name=ServiceUpdateStateCpeAuthTask fieldName=VirtualControlLoopEvent schemaName=VirtualControlLoopEventType +task outputfield create name=ServiceUpdateStateCpeAuthTask fieldName=result schemaName=SimpleStringType +task outputfield create name=ServiceUpdateStateCpeAuthTask fieldName=requestID schemaName=UUIDType +task outputfield create name=ServiceUpdateStateCpeAuthTask fieldName=attachmentPoint schemaName=SimpleStringType +task outputfield create name=ServiceUpdateStateCpeAuthTask fieldName=serviceInstanceId schemaName=SimpleStringType optional=true +task contextref create name=ServiceUpdateStateCpeAuthTask albumName=VCPEClosedLoopStatusAlbum + +task logic create name=ServiceUpdateStateCpeAuthTask logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/ServiceUpdateStateCpeAuthTask.js" +LE + +#========> Create Policy (1) +policy create name=ONTRegistrationPolicy template=Freestyle firstState=INIT + +policy state create name=ONTRegistrationPolicy stateName=NOMADIC_ONT_REG_SUCCESS triggerName=END_CONTROL_LOOP defaultTaskName=NomadicEventSuccessTask +policy state output create name=ONTRegistrationPolicy stateName=NOMADIC_ONT_REG_SUCCESS outputName=NomadicEventSuccessOutPut eventName=END_EVENT +policy state taskref create name=ONTRegistrationPolicy stateName=NOMADIC_ONT_REG_SUCCESS taskName=NomadicEventSuccessTask outputType=DIRECT outputName=NomadicEventSuccessOutPut + +#========> Create State (1.4) +policy state create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE triggerName=AAI_SERVICE_CREATE defaultTaskName=AAIServiceCreateTask + +policy state output create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE outputName=AAIServiceCreateTaskOutput eventName=END_CONTROL_LOOP nextState=NOMADIC_ONT_REG_SUCCESS +policy state taskref create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE taskName=AAIServiceCreateTask outputType=DIRECT outputName=AAIServiceCreateTaskOutput + +policy state output create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE outputName=SdncResourceUpdateErrorLogOutput eventName=ERROR_LOG +policy state taskref create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE taskName=ErrorSdncResourceUpdateTaskLogTask outputType=DIRECT outputName=SdncResourceUpdateErrorLogOutput + +policy state contextref create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE albumName=VCPEClosedLoopStatusAlbum + +policy state selecttasklogic create name=ONTRegistrationPolicy stateName=AAI_SERVICE_CREATE logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/SU2orInitStateSelect.js" +LE + + +#========> Create State (1.3) +policy state create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE triggerName=SDNC_RESOURCE_UPDATE defaultTaskName=SdncResourceUpdateTask + +policy state output create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE outputName=SdncResourceUpdateOutput eventName=AAI_SERVICE_CREATE nextState=AAI_SERVICE_CREATE +policy state taskref create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE taskName=SdncResourceUpdateTask outputType=DIRECT outputName=SdncResourceUpdateOutput + +policy state output create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE outputName=AAIServiceAssignedErrorLogOutput eventName=ERROR_LOG +policy state taskref create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE taskName=ErrorAAIServiceAssignedLogTask outputType=DIRECT outputName=AAIServiceAssignedErrorLogOutput + +policy state contextref create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE albumName=VCPEClosedLoopStatusAlbum + +policy state selecttasklogic create name=ONTRegistrationPolicy stateName=SDNC_RES_UPDATE logicFlavour=JAVASCRIPT logic=LS +#MACROFILE:"src/main/resources/logic/RUorInitStateSelect.js" +LE + + + +#========> Create State (1.2) +policy state create name=ONTRegistrationPolicy stateName=AAI_SERVICE_ASSIGN triggerName=AAI_SERVICE_ASSIGNED defaultTaskName=AAIServiceAssignedTask + +policy state output create name=ONTRegistrationPolicy stateName=AAI_SERVICE_ASSIGN outputName=AAIServiceAssignedOutput eventName=SDNC_RESOURCE_UPDATE nextState=SDNC_RES_UPDATE +policy state taskref create name=ONTRegistrationPolicy stateName=AAI_SERVICE_ASSIGN taskName=AAIServiceAssignedTask outputType=DIRECT outputName=AAIServiceAssignedOutput + + + + + +#========> Create State (1.1) +policy state create name=ONTRegistrationPolicy stateName=INIT triggerName=Nomadic_ONT defaultTaskName=GetBBSCloseLoopEventTask +policy state output create name=ONTRegistrationPolicy stateName=INIT outputName=BBSCloseLoopEventOutPut eventName=AAI_SERVICE_ASSIGNED nextState=AAI_SERVICE_ASSIGN +policy state taskref create name=ONTRegistrationPolicy stateName=INIT taskName=GetBBSCloseLoopEventTask outputType=DIRECT outputName=BBSCloseLoopEventOutPut + + + +#========> Create Policy (2) +policy create name=CPEAuthenticationPolicy template=Freestyle firstState=INIT + + +#========> Create State (2.1) +policy state create name=CPEAuthenticationPolicy stateName=INIT triggerName=CPE_Authentication defaultTaskName=ServiceUpdateStateCpeAuthTask +policy state output create name=CPEAuthenticationPolicy stateName=INIT outputName=ServiceUpdateCpeAuthOutPut eventName=AAI_CPE_AUTH_UPDATE +policy state taskref create name=CPEAuthenticationPolicy stateName=INIT taskName=ServiceUpdateStateCpeAuthTask outputType=DIRECT outputName=ServiceUpdateCpeAuthOutPut + +validate diff --git a/examples/examples-onap-bbs/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc b/examples/examples-onap-bbs/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc new file mode 100644 index 000000000..5d1b317a8 --- /dev/null +++ b/examples/examples-onap-bbs/src/main/resources/schemas/VCPEClosedLoopStatusType.avsc @@ -0,0 +1,108 @@ +{ + "type": "record", + "name": "VCPEClosedLoopStatus", + "fields": [ + { + "name": "AAI", + "type": { + "type": "record", + "name": "VCPE_AAI_Type", + "namespace": "org.onap.policy.apex.onap.vcpe", + "fields": [ + { + "name": "attachmentPoint", + "type": "string" + }, + { + "name": "service_information_hsia_cfs_service_instance_id", + "type": "string" + }, + { + "name": "cvlan", + "type": "string" + }, + { + "name": "svlan", + "type": "string" + }, + { + "name": "remoteId", + "type": "string" + } + ] + } + }, + { + "name": "closedLoopAlarmStart", + "type": "long" + }, + { + "name": "closedLoopAlarmEnd", + "type": "long" + }, + { + "name": "closedLoopControlName", + "type": "string" + }, + { + "name": "version", + "type": "string" + }, + { + "name": "requestID", + "type": "string" + }, + { + "name": "closedLoopEventClient", + "type": "string" + }, + { + "name": "closedLoopEventStatus", + "type": "string" + }, + { + "name": "target_type", + "type": "string" + }, + { + "name": "target", + "type": "string" + }, + { + "name": "from", + "type": "string" + }, + { + "name": "policyScope", + "type": "string" + }, + { + "name": "policyName", + "type": "string" + }, + { + "name": "policyVersion", + "type": "string" + }, + { + "name": "notification", + "type": "string" + }, + { + "name": "notificationTime", + "type": "long" + }, + { + "name": "result", + "type": "string" + }, + { + "name": "message", + "type": "string" + }, + { + "name": "aai_message", + "type": "string" + } + ] +}
\ No newline at end of file diff --git a/examples/examples-onap-bbs/src/site/css/site.css b/examples/examples-onap-bbs/src/site/css/site.css new file mode 100644 index 000000000..92ddec619 --- /dev/null +++ b/examples/examples-onap-bbs/src/site/css/site.css @@ -0,0 +1,101 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Copyright (C) 2019 Huawei. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +@import url(http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.0/css/font-awesome.css); + + +/*************** Table definitions *******************/ + +tableblock > .title, .tableblock > caption { line-height: 1.4; color: #7a2518; font-weight: 300; margin-top: 0.2em; margin-bottom: 0.5em; } + +.tableblock > caption { text-align: left; font-weight: bold; white-space: nowrap; overflow: visible; max-width: 0; } + +table.tableblock { background: white; margin-bottom: 1.25em; border: solid 1px #dddddd; } +table.tableblock thead, table.tableblock tfoot { background: whitesmoke; font-weight: bold; } +table.tableblock thead tr th, table.tableblock thead tr td, table tfoot tr th, table tfoot tr td { padding: 0.5em 0.625em 0.625em; font-size: inherit; color: #222222; text-align: left; } +table.tableblock tr th, table.tableblock tr td { padding: 0.5625em 0.625em; font-size: inherit; color: #222222; } +table.tableblock tr.even, table.tableblock tr.alt, table.tableblock tr:nth-of-type(even) { background: #f9f9f9; } +table.tableblock thead tr th, table.tableblock tfoot tr th, table.tableblock tbody tr td, table.tableblock tr td, table.tableblock tfoot tr td { display: table-cell; line-height: 1.6; } + +table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-size: inherit; } + +table.tableblock.grid-all { border-collapse: separate; border-spacing: 1px; -webkit-border-radius: 4px; border-radius: 4px; border-top: 1px solid #dddddd; border-bottom: 1px solid #dddddd; } + +table.tableblock.frame-topbot, table.tableblock.frame-none { border-left: 0; border-right: 0; } + +table.tableblock.frame-sides, table.tableblock.frame-none { border-top: 0; border-bottom: 0; } + +table.tableblock td .paragraph:last-child p, table.tableblock td > p:last-child { margin-bottom: 0; } + +th.tableblock.halign-left, td.tableblock.halign-left { text-align: left; } + +th.tableblock.halign-right, td.tableblock.halign-right { text-align: right; } + +th.tableblock.halign-center, td.tableblock.halign-center { text-align: center; } + +th.tableblock.valign-top, td.tableblock.valign-top { vertical-align: top; } + +th.tableblock.valign-bottom, td.tableblock.valign-bottom { vertical-align: bottom; } + +th.tableblock.valign-middle, td.tableblock.valign-middle { vertical-align: middle; } + +p.tableblock.header { color: #222222; font-weight: bold; } + + + +/*************** KBD Macro definitions *******************/ + +kbd.keyseq { color: #555555; } + +kbd:not(.keyseq) { display: inline-block; color: #222222; font-size: 0.75em; line-height: 1.4; background-color: #F7F7F7; border: 1px solid #ccc; -webkit-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; margin: -0.15em 0.15em 0 0.15em; padding: 0.2em 0.6em 0.2em 0.5em; vertical-align: middle; white-space: nowrap; } + +kbd kbd:first-child { margin-left: 0; } + +kbd kbd:last-child { margin-right: 0; } + + +/*************** Admontion Blocks definitions *******************/ +.admonitionblock td.content > .title, .exampleblock > .title, .imageblock > .title, .videoblock > .title, .listingblock > .title, .literalblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, .sidebarblock > .title, .tableblock > .title, .verseblock > .title, .dlist > .title, .olist > .title, .ulist > .title, .qlist > .title, .hdlist > .title { text-align: left; font-weight: bold; } + +.admonitionblock > table { border: 0; background: none; width: 100%; margin-top: 1em; margin-bottom: 1em;} +.admonitionblock > table td.icon { text-align: center; width: 80px; } +.admonitionblock > table td.icon img { max-width: none; } +.admonitionblock > table td.icon .title { font-weight: bold; text-transform: uppercase; } +.admonitionblock > table td.content { padding-left: 1.125em; padding-right: 1.25em; border-left: 1px solid #dddddd; color: #6f6f6f; } +.admonitionblock > table td.content > :last-child > :last-child { margin-bottom: 0; } + +.admonitionblock td.icon [class^="fa icon-"]:before {font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default} +.admonitionblock td.icon .icon-note:before { content: "\f05a"; color: #005498; color: #003f72; } +.admonitionblock td.icon .icon-tip:before { content: "\f0eb"; text-shadow: 1px 1px 2px rgba(155, 155, 0, 0.8); color: #111; } +.admonitionblock td.icon .icon-warning:before { content: "\f071"; color: #bf6900; } +.admonitionblock td.icon .icon-caution:before { content: "\f06d"; color: #bf3400; } +.admonitionblock td.icon .icon-important:before { content: "\f06a"; color: #bf0000; } + + + +/*************** Misc definitions *******************/ + +*:not(pre) > code { font-size: 0.9375em; padding: 1px 3px 0; white-space: nowrap; background-color: #f2f2f2; border: 1px solid #cccccc; -webkit-border-radius: 4px; border-radius: 4px; text-shadow: none; } + +pre, pre > code { line-height: 1.4; color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; } + +code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #6d180b; } + diff --git a/examples/examples-onap-bbs/src/site/images/logos.png b/examples/examples-onap-bbs/src/site/images/logos.png Binary files differnew file mode 100644 index 000000000..915d6e59d --- /dev/null +++ b/examples/examples-onap-bbs/src/site/images/logos.png diff --git a/examples/examples-onap-bbs/src/site/site.xml b/examples/examples-onap-bbs/src/site/site.xml new file mode 100644 index 000000000..9e14cadfe --- /dev/null +++ b/examples/examples-onap-bbs/src/site/site.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2016-2018 Ericsson. All rights reserved. + Copyright (C) 2019 Huawei. All rights reserved. + ================================================================================ + This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE + Full license text at https://creativecommons.org/licenses/by/4.0/legalcode + + SPDX-License-Identifier: CC-BY-4.0 + ============LICENSE_END========================================================= + +--> + +<project name="APEX Examples ONAP BBS"> + <body> + <menu name="APEX Examples ONAP BBS"> + </menu> + <menu ref="reports" inherit="top" /> + <menu ref="modules" /> + + <breadcrumbs> + <item name="ONAP BBS" href="index.html" /> + </breadcrumbs> + </body> +</project>
\ No newline at end of file diff --git a/examples/pom.xml b/examples/pom.xml index acba94098..b489f7e2f 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -40,6 +40,7 @@ <module>examples-decisionmaker</module> <module>examples-periodic</module> <module>examples-onap-vcpe</module> + <module>examples-onap-bbs</module> <module>examples-servlet</module> </modules> |