aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2020-07-16 15:46:14 +0100
committerLathish <lathishbabu.ganesan@est.tech>2020-07-20 16:20:40 +0100
commitad7220f5dcb8a3acd43bca1d855012a441e97d5c (patch)
tree459cda7b0134702cb7e1fc501e69b61cc9cd7533
parent96aeff5a753e008add7a879198ba3229f4b6016b (diff)
Updated A1 Yang model
Issue-ID: CCSDK-2581 Change-Id: I816cac765c2cf09c3d0911b98b3361ef8cb3696f Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
-rw-r--r--sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang336
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java620
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java956
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProviderTest.java823
4 files changed, 90 insertions, 2645 deletions
diff --git a/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang b/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang
index fb740cc27..157bde5af 100644
--- a/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang
+++ b/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang
@@ -1,340 +1,122 @@
+//-
+// ============LICENSE_START=======================================================
+// Copyright (C) 2020 Nordix Foundation.
+// ================================================================================
+// 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=========================================================
+//
module A1-ADAPTER-API {
- namespace "org:onap:ccsdk";
+ namespace "org:onap:a1-adapter";
prefix a1-adapter-api;
- revision "2019-12-12" {
- description
- "Added standard output payload for all RPC's";
- }
-
- revision "2019-10-02" {
- description
- "A1 adapter for Frankfurt";
+ import ietf-inet-types {
+ prefix "inet";
+ revision-date "2013-07-15";
}
- grouping a1-adapter-response {
- leaf response-code {
- type string;
- }
- leaf response-message {
- type string;
- }
- description
- "Response payload for A1 Adapter RPC's";
+ import ietf-yang-types {
+ prefix yang;
}
- grouping a1-policy-instance-property {
-
- description
- "Properties as specified in the create_schema field of policy type in PUT payload";
-
- leaf property-name {
- type string {
- length "1..64";
- }
- description
- "Individual property name";
- }
- leaf property-value {
- type string {
- length "1..64";
- }
- description
- "Value of the property";
- }
- }
-
-
- grouping a1-policy-type-create-schema-property-statement {
-
- leaf policy-statement {
- type string {
- length "1..64";
- }
+ revision "2020-01-22" {
description
- "Individual policy statement name";
- }
- leaf policy-statement-value {
- type string {
- length "1..64";
- }
- description
- "Value of the policy statement";
- }
+ "A1 adapter";
}
-
-///Flattend interface using RPC
-
- //Get a comma separated list of near-rt rics, e.g. domain-name1:port1,domainname2:port2
- //Each item in the returned list will be regarded as one near-rt-ric-id.
- rpc getNearRT-RICs {
- // OpenDaylight Fluorine version of restconf cannot handle RPCs with no input
+ rpc putA1Policy {
input {
- leaf dummy {
- type string;
- }
- }
-
- output {
- uses a1-adapter-response;
- leaf-list near-rt-ric-id-list {
- type string;
+ leaf near-rt-ric-url {
+ type inet:uri;
}
- }
- }
-
- //Get health status for a Near-RT-RIC. true - health ok, false - health is not ok.
- rpc getHealthCheck {
- input {
- leaf near-rt-ric-id {
+ leaf body {
type string;
}
}
-
output {
- uses a1-adapter-response;
- leaf health-status {
- type boolean;
- }
- }
- }
-
- //Get a comma separated list of integer policy type ids
- //Each item in the returned list will be regarded as one policy-type-id.
- rpc getPolicyTypes {
- input {
- leaf near-rt-ric-id {
+ leaf body {
type string;
}
- }
- output {
- uses a1-adapter-response;
- leaf-list policy-type-id-list {
- type uint32;
+ leaf http-status {
+ type int32;
}
}
}
- //Create a policy type
- rpc createPolicyType {
+ rpc getA1Policy {
input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
- }
- leaf description {
- type string;
- }
- leaf name {
- type string;
- }
- leaf policy-type {
- type string;
- }
- list properties {
- key "property-name";
- leaf property-name {
- type string {
- length "1..64";
- }
- description
- "Individual property name";
- }
- list policy-statements {
- key "policy-statement";
- uses a1-policy-type-create-schema-property-statement;
- }
- }
- }
- output {
- uses a1-adapter-response;
- leaf status {
- type string;
- }
- leaf code {
- type string;
- }
- }
- }
-
- //Get a policy type
- rpc getPolicyType {
- input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
+ leaf near-rt-ric-url {
+ type inet:uri;
}
}
output {
- uses a1-adapter-response;
- leaf description {
+ leaf body {
type string;
}
- leaf name {
- type string;
- }
- leaf policy-type {
- type string;
+ leaf http-status {
+ type int32;
}
}
}
- //Delete a policy type
- rpc deletePolicyType {
+ rpc getA1PolicyStatus {
input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
+ leaf near-rt-ric-url {
+ type inet:uri;
}
}
output {
- uses a1-adapter-response;
- }
- }
-
- //Get a comma separeated list of string policy instance ids
- //Each item in the returned list will be regarded as one policy-instance-id.
- rpc getPolicyInstances {
- input {
- leaf near-rt-ric-id {
+ leaf body {
type string;
}
- leaf policy-type-id {
- type uint32;
- }
- }
-
- output {
- uses a1-adapter-response;
- leaf-list policy-instance-id-list {
- type string;
+ leaf http-status {
+ type int32;
}
}
}
- //Create a policy instance
- rpc createPolicyInstance {
+ rpc getA1PolicyType {
input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
- }
- leaf policy-instance-id {
- type string;
- }
- leaf policy-instance {
- type string;
- }
- list properties {
- key "property-name";
- uses a1-policy-instance-property;
- }
- }
- output {
- uses a1-adapter-response;
- }
- }
-
- ///Get a policy instance
- rpc getPolicyInstance {
- input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
- }
- leaf policy-instance-id {
- type string;
+ leaf near-rt-ric-url {
+ type inet:uri;
}
}
output {
- uses a1-adapter-response;
- leaf policy-instance {
- type string;
- }
- }
- }
-
- //Delete a policy instance
- rpc deletePolicyInstance {
- input {
- leaf near-rt-ric-id {
+ leaf body {
type string;
}
- leaf policy-type-id {
- type uint32;
- }
- leaf policy-instance-id {
- type string;
+ leaf http-status {
+ type int32;
}
}
- output {
- uses a1-adapter-response;
- }
}
- //Get the status for a policy instance
- rpc getStatus {
+ rpc deleteA1Policy {
input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
- }
- leaf policy-instance-id {
- type string;
+ leaf near-rt-ric-url {
+ type inet:uri;
}
}
output {
- uses a1-adapter-response;
- leaf status {
+ leaf body {
type string;
}
- }
- }
-
- //Policy feedback Notification to provide policy enforcement update
- rpc notifyPolicyEnforcementUpdate {
- input {
- leaf near-rt-ric-id {
- type string;
- }
- leaf policy-type-id {
- type uint32;
- }
- leaf policy-instance-id {
- type string;
- }
- leaf policy_enforcement_status {
- type string;
- description
- "Policy enforcement status - IN_EFFECT or NON_IN_EFFECT";
- }
- leaf policy_enforcement_reason {
- type string;
- description
- "Indicates the reason why policy is no longer being enforced";
+ leaf http-status {
+ type int32;
}
}
- output {
- uses a1-adapter-response;
- }
}
-
-
-
-
-}
+} \ No newline at end of file
diff --git a/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java
index 324e0eae1..eb0894bd6 100644
--- a/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java
+++ b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,22 +22,8 @@
package org.onap.ccsdk.features.sdnr.northbound.a1Adapter;
-import java.util.Properties;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateOutputBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,606 +40,4 @@ public class A1AdapterClient {
public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException {
return svcLogicService.hasGraph(module, rpc, version, mode);
}
-
- // Client for GetNearRTRICs
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetNearRTRICsOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetNearRTRICsOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- // Client for GetHealthCheck
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetHealthCheckOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetHealthCheckOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- // Client for getPolicyTypes
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyTypesOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyTypesOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- // Client for createPolicyType
-
-
- public Properties execute(String module, String rpc, String version, String mode,
- CreatePolicyTypeOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- CreatePolicyTypeOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- // Client for getPolicyType
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyTypeOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyTypeOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- // Client for deletePolicyType
-
- public Properties execute(String module, String rpc, String version, String mode,
- DeletePolicyTypeOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- DeletePolicyTypeOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- // Client for getPolicyInstances
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyInstancesOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyInstancesOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
-
- // Client for createPolicyInstance
-
- public Properties execute(String module, String rpc, String version, String mode,
- CreatePolicyInstanceOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- CreatePolicyInstanceOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- // Client for getPolicyInstance
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyInstanceOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetPolicyInstanceOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- // Client for deletePolicyInstance
-
- public Properties execute(String module, String rpc, String version, String mode,
- DeletePolicyInstanceOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- DeletePolicyInstanceOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
- // Client for getStatus
-
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetStatusOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- GetStatusOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
- // Client for notifyPolicyEnforcementUpdate
-
-
- public Properties execute(String module, String rpc, String version, String mode,
- NotifyPolicyEnforcementUpdateOutputBuilder serviceData) throws SvcLogicException {
-
- Properties parms = new Properties();
-
- return execute(module, rpc, version, mode, serviceData, parms);
- }
-
- public Properties execute(String module, String rpc, String version, String mode,
- NotifyPolicyEnforcementUpdateOutputBuilder serviceData, Properties parms) throws SvcLogicException {
- Properties localProp;
- localProp = MdsalHelper.toProperties(parms, serviceData);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters passed to SLI");
-
- for (Object key : localProp.keySet()) {
- String parmName = (String) key;
- String parmValue = localProp.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
-
- Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug("Parameters returned by SLI");
-
- for (Object key : respProps.keySet()) {
- String parmName = (String) key;
- String parmValue = respProps.getProperty(parmName);
-
- LOG.debug(parmName + " = " + parmValue);
-
- }
- }
- if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
- return respProps;
- }
-
- MdsalHelper.toBuilder(respProps, serviceData);
-
- return respProps;
- }
-
-
-
-}
+} \ No newline at end of file
diff --git a/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java
index b10177d8f..22109b09b 100644
--- a/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java
+++ b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,68 +22,25 @@
package org.onap.ccsdk.features.sdnr.northbound.a1Adapter;
-import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.A1ADAPTERAPIService;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateOutputBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.A1ADAPTERAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.DeleteA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.DeleteA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyStatusInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyStatusOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.PutA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.PutA1PolicyOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -148,891 +105,34 @@ public class A1AdapterProvider implements AutoCloseable, A1ADAPTERAPIService {
LOG.info("Successfully closed provider for {}", APPLICATION_NAME);
}
- // RPC getNearRT-RICs
-
- @Override
- public ListenableFuture<RpcResult<GetNearRTRICsOutput>> getNearRTRICs(GetNearRTRICsInput input) {
- final String svcOperation = "getNearRT-RICs";
-
- Properties parms = new Properties();
- GetNearRTRICsOutputBuilder serviceDataBuilder = (GetNearRTRICsOutputBuilder) getServiceData(GET_NEARRT_RICS);
-
- LOG.info("Reached RPC getNearRT-RICs");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetNearRTRICsOutput> rpcResult =
- RpcResultBuilder.<GetNearRTRICsOutput>status(true).withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetNearRTRICsInputBuilder inputBuilder = new GetNearRTRICsInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetNearRTRICs ");
- }
-
- RpcResult<GetNearRTRICsOutput> rpcResult =
- RpcResultBuilder.<GetNearRTRICsOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getNearRT-RICs ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- // RPC getHealthCheck
-
- @Override
- public ListenableFuture<RpcResult<GetHealthCheckOutput>> getHealthCheck(GetHealthCheckInput input) {
- final String svcOperation = "getHealthCheck";
-
- Properties parms = new Properties();
- GetHealthCheckOutputBuilder serviceDataBuilder = (GetHealthCheckOutputBuilder) getServiceData(GET_HEALTH_CHECK);
-
- LOG.info("Reached RPC getHealthCheck");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetHealthCheckOutput> rpcResult =
- RpcResultBuilder.<GetHealthCheckOutput>status(true).withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetHealthCheck. ");
- }
-
- RpcResult<GetHealthCheckOutput> rpcResult =
- RpcResultBuilder.<GetHealthCheckOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getHealthCheck ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- // RPC getPolicyTypes
-
- @Override
- public ListenableFuture<RpcResult<GetPolicyTypesOutput>> getPolicyTypes(GetPolicyTypesInput input) {
- final String svcOperation = "getPolicyTypes";
-
- Properties parms = new Properties();
- GetPolicyTypesOutputBuilder serviceDataBuilder = (GetPolicyTypesOutputBuilder) getServiceData(GET_POLICY_TYPES);
-
- LOG.info("Reached RPC getPolicyTypes");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetPolicyTypesOutput> rpcResult =
- RpcResultBuilder.<GetPolicyTypesOutput>status(true).withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetPolicyTypes ");
- }
-
- RpcResult<GetPolicyTypesOutput> rpcResult =
- RpcResultBuilder.<GetPolicyTypesOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getPolicyTypes ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- // RPC createPolicyType
-
- @Override
- public ListenableFuture<RpcResult<CreatePolicyTypeOutput>> createPolicyType(CreatePolicyTypeInput input) {
- final String svcOperation = "createPolicyType";
-
- Properties parms = new Properties();
- CreatePolicyTypeOutputBuilder serviceDataBuilder =
- (CreatePolicyTypeOutputBuilder) getServiceData(CREATE_POLICY_TYPE);
-
- LOG.info("Reached RPC createPolicyType");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<CreatePolicyTypeOutput> rpcResult = RpcResultBuilder.<CreatePolicyTypeOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for CreatePolicyType");
- }
-
- RpcResult<CreatePolicyTypeOutput> rpcResult =
- RpcResultBuilder.<CreatePolicyTypeOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from createPolicyType ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- // RPC getPolicyType
-
- @Override
- public ListenableFuture<RpcResult<GetPolicyTypeOutput>> getPolicyType(GetPolicyTypeInput input) {
- final String svcOperation = "getPolicyType";
-
- Properties parms = new Properties();
- GetPolicyTypeOutputBuilder serviceDataBuilder = (GetPolicyTypeOutputBuilder) getServiceData(GET_POLICY_TYPE);
-
- LOG.info("Reached RPC getPolicyType");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetPolicyTypeOutput> rpcResult =
- RpcResultBuilder.<GetPolicyTypeOutput>status(true).withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetPolicyType. ");
- }
-
- RpcResult<GetPolicyTypeOutput> rpcResult =
- RpcResultBuilder.<GetPolicyTypeOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getPolicyType ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- // RPC deletePolicyType
-
- @Override
- public ListenableFuture<RpcResult<DeletePolicyTypeOutput>> deletePolicyType(DeletePolicyTypeInput input) {
- final String svcOperation = "deletePolicyType";
-
- Properties parms = new Properties();
- DeletePolicyTypeOutputBuilder serviceDataBuilder =
- (DeletePolicyTypeOutputBuilder) getServiceData(DELETE_POLICY_TYPE);
-
- LOG.info("Reached RPC deletePolicyType");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<DeletePolicyTypeOutput> rpcResult = RpcResultBuilder.<DeletePolicyTypeOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for DeletePolicyType ");
- }
-
- RpcResult<DeletePolicyTypeOutput> rpcResult =
- RpcResultBuilder.<DeletePolicyTypeOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from deletePolicyType ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- // RPC getPolicyInstances
-
- @Override
- public ListenableFuture<RpcResult<GetPolicyInstancesOutput>> getPolicyInstances(GetPolicyInstancesInput input) {
- final String svcOperation = "getPolicyInstances";
-
- Properties parms = new Properties();
- GetPolicyInstancesOutputBuilder serviceDataBuilder =
- (GetPolicyInstancesOutputBuilder) getServiceData(GET_POLICY_INSTANCES);
-
- LOG.info("Reached RPC getPolicyInstances");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetPolicyInstancesOutput> rpcResult = RpcResultBuilder.<GetPolicyInstancesOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetPolicyInstances ");
- }
-
- RpcResult<GetPolicyInstancesOutput> rpcResult =
- RpcResultBuilder.<GetPolicyInstancesOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getPolicyInstances ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
-
- // RPC createPolicyInstance
-
@Override
- public ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> createPolicyInstance(
- CreatePolicyInstanceInput input) {
- final String svcOperation = "createPolicyInstance";
-
- Properties parms = new Properties();
- CreatePolicyInstanceOutputBuilder serviceDataBuilder =
- (CreatePolicyInstanceOutputBuilder) getServiceData(CREATE_POLICY_INSTANCES);
-
- LOG.info("Reached RPC createPolicyInstance");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<CreatePolicyInstanceOutput> rpcResult = RpcResultBuilder.<CreatePolicyInstanceOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for CreatePolicyInstance. ");
- }
-
- RpcResult<CreatePolicyInstanceOutput> rpcResult = RpcResultBuilder.<CreatePolicyInstanceOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from createPolicyInstance ");
-
- return Futures.immediateFuture(rpcResult);
+ public ListenableFuture<RpcResult<DeleteA1PolicyOutput>> deleteA1Policy(DeleteA1PolicyInput input) {
+ // TODO Auto-generated method stub
+ return null;
}
-
-
- // RPC getPolicyInstance
-
@Override
- public ListenableFuture<RpcResult<GetPolicyInstanceOutput>> getPolicyInstance(GetPolicyInstanceInput input) {
- final String svcOperation = "getPolicyInstance";
-
- Properties parms = new Properties();
- GetPolicyInstanceOutputBuilder serviceDataBuilder =
- (GetPolicyInstanceOutputBuilder) getServiceData(GET_POLICY_INSTANCE);
-
- LOG.info("Reached RPC getPolicyInstance");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetPolicyInstanceOutput> rpcResult = RpcResultBuilder.<GetPolicyInstanceOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetPolicyInstance. ");
- }
-
- RpcResult<GetPolicyInstanceOutput> rpcResult =
- RpcResultBuilder.<GetPolicyInstanceOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getPolicyInstance ");
-
- return Futures.immediateFuture(rpcResult);
+ public ListenableFuture<RpcResult<GetA1PolicyOutput>> getA1Policy(GetA1PolicyInput input) {
+ // TODO Auto-generated method stub
+ return null;
}
-
-
- // RPC deletePolicyInstance
-
@Override
- public ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> deletePolicyInstance(
- DeletePolicyInstanceInput input) {
- final String svcOperation = "deletePolicyInstance";
-
- Properties parms = new Properties();
- DeletePolicyInstanceOutputBuilder serviceDataBuilder =
- (DeletePolicyInstanceOutputBuilder) getServiceData(DELETE_POLICY_INSTANCE);
-
- LOG.info("Reached RPC deletePolicyInstance");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<DeletePolicyInstanceOutput> rpcResult = RpcResultBuilder.<DeletePolicyInstanceOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for DeletePolicyInstance. ");
- }
-
- RpcResult<DeletePolicyInstanceOutput> rpcResult = RpcResultBuilder.<DeletePolicyInstanceOutput>status(true)
- .withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from deletePolicyInstance ");
-
- return Futures.immediateFuture(rpcResult);
+ public ListenableFuture<RpcResult<GetA1PolicyStatusOutput>> getA1PolicyStatus(GetA1PolicyStatusInput input) {
+ // TODO Auto-generated method stub
+ return null;
}
-
-
- // RPC getStatus
-
@Override
- public ListenableFuture<RpcResult<GetStatusOutput>> getStatus(GetStatusInput input) {
- final String svcOperation = "getStatus";
-
- Properties parms = new Properties();
- GetStatusOutputBuilder serviceDataBuilder = (GetStatusOutputBuilder) getServiceData(GET_STATUS);
-
- LOG.info("Reached RPC getStatus");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<GetStatusOutput> rpcResult =
- RpcResultBuilder.<GetStatusOutput>status(true).withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- GetStatusInputBuilder inputBuilder = new GetStatusInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for GetStatus. ");
- }
-
- RpcResult<GetStatusOutput> rpcResult =
- RpcResultBuilder.<GetStatusOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from getStatus ");
-
- return Futures.immediateFuture(rpcResult);
+ public ListenableFuture<RpcResult<GetA1PolicyTypeOutput>> getA1PolicyType(GetA1PolicyTypeInput input) {
+ // TODO Auto-generated method stub
+ return null;
}
-
- // RPC notifyPolicyEnforcementUpdate
-
@Override
- public ListenableFuture<RpcResult<NotifyPolicyEnforcementUpdateOutput>> notifyPolicyEnforcementUpdate(
- NotifyPolicyEnforcementUpdateInput input) {
- final String svcOperation = "notifyPolicyEnforcementUpdate";
-
- Properties parms = new Properties();
- NotifyPolicyEnforcementUpdateOutputBuilder serviceDataBuilder =
- (NotifyPolicyEnforcementUpdateOutputBuilder) getServiceData(NOTIFICATION_ENFORECEMENT);
-
- LOG.info("Reached RPC notifyPolicyEnforcementUpdate");
-
- LOG.info(svcOperation + " called.");
-
- if (input == null) {
- LOG.debug("exiting " + svcOperation + " because of invalid input");
- serviceDataBuilder.setResponseCode("Input is null");
- RpcResult<NotifyPolicyEnforcementUpdateOutput> rpcResult = RpcResultBuilder
- .<NotifyPolicyEnforcementUpdateOutput>status(true).withResult(serviceDataBuilder.build()).build();
- return Futures.immediateFuture(rpcResult);
- }
-
- // add input to parms
- LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
- NotifyPolicyEnforcementUpdateInputBuilder inputBuilder = new NotifyPolicyEnforcementUpdateInputBuilder(input);
- MdsalHelper.toProperties(parms, inputBuilder.build());
-
- LOG.info("Printing SLI parameters to be passed");
-
- // iterate properties file to get key-value pairs
- for (String key : parms.stringPropertyNames()) {
- String value = parms.getProperty(key);
- LOG.info("The SLI parameter in " + key + " is: " + value);
- }
-
- // Call SLI sync method
- try {
- if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation, null, "sync")) {
- LOG.info("A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
- try {
- A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
- } catch (Exception e) {
- LOG.error("Caught exception executing service logic for " + svcOperation, e);
- serviceDataBuilder.setResponseCode("500");
- }
- } else {
- LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
- serviceDataBuilder.setResponseCode("503");
- }
- } catch (Exception e) {
- LOG.error("Caught exception looking for service logic", e);
- serviceDataBuilder.setResponseCode("500");
- }
-
- String errorCode = serviceDataBuilder.getResponseCode();
-
- if (!("0".equals(errorCode) || "200".equals(errorCode))) {
- LOG.error("Returned FAILED for " + svcOperation + " error code: '" + errorCode + "'");
- } else {
- LOG.info("Returned SUCCESS for " + svcOperation + " ");
- serviceDataBuilder.setResponseMessage("A1 Adapter Executed for notifyPolicyEnforcementUpdate. ");
- }
-
- RpcResult<NotifyPolicyEnforcementUpdateOutput> rpcResult = RpcResultBuilder
- .<NotifyPolicyEnforcementUpdateOutput>status(true).withResult(serviceDataBuilder.build()).build();
-
- LOG.info("Successful exit from notifyPolicyEnforcementUpdate ");
-
- return Futures.immediateFuture(rpcResult);
- }
-
- protected Builder<?> getServiceData(String svcOperation) {
- switch (svcOperation) {
- case GET_NEARRT_RICS:
- return new GetNearRTRICsOutputBuilder();
- case GET_HEALTH_CHECK:
- return new GetHealthCheckOutputBuilder();
- case GET_POLICY_TYPES:
- return new GetPolicyTypesOutputBuilder();
- case CREATE_POLICY_TYPE:
- return new CreatePolicyTypeOutputBuilder();
- case GET_POLICY_TYPE:
- return new GetPolicyTypeOutputBuilder();
- case DELETE_POLICY_TYPE:
- return new DeletePolicyTypeOutputBuilder();
- case GET_POLICY_INSTANCES:
- return new GetPolicyInstancesOutputBuilder();
- case CREATE_POLICY_INSTANCES:
- return new CreatePolicyInstanceOutputBuilder();
- case GET_POLICY_INSTANCE:
- return new GetPolicyInstanceOutputBuilder();
- case DELETE_POLICY_INSTANCE:
- return new DeletePolicyInstanceOutputBuilder();
- case GET_STATUS:
- return new GetStatusOutputBuilder();
- case NOTIFICATION_ENFORECEMENT:
- return new NotifyPolicyEnforcementUpdateOutputBuilder();
- }
+ public ListenableFuture<RpcResult<PutA1PolicyOutput>> putA1Policy(PutA1PolicyInput input) {
+ // TODO Auto-generated method stub
return null;
}
-}
+
+} \ No newline at end of file
diff --git a/sdnr/northbound/a1Adapter/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProviderTest.java b/sdnr/northbound/a1Adapter/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProviderTest.java
index fa8a82c8f..8fea501ff 100644
--- a/sdnr/northbound/a1Adapter/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProviderTest.java
+++ b/sdnr/northbound/a1Adapter/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProviderTest.java
@@ -20,74 +20,6 @@
package org.onap.ccsdk.features.sdnr.northbound.a1Adapter;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
-import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.CreatePolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.DeletePolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetHealthCheckOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetNearRTRICsOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstanceOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyInstancesOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypeOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesInput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetPolicyTypesOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.GetStatusOutputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.NotifyPolicyEnforcementUpdateOutputBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* This class Tests all the methods in A1AdapterProvider
*
@@ -95,757 +27,4 @@ import org.slf4j.LoggerFactory;
*
*/
-@RunWith(MockitoJUnitRunner.Silent.class)
-public class A1AdapterProviderTest {
-
- protected static final Logger LOG = LoggerFactory.getLogger(A1AdapterProviderTest.class);
-
- class A1AdapterProviderMock extends A1AdapterProvider {
-
- A1AdapterProviderMock(final DataBroker dataBroker, final NotificationPublishService notificationPublishService,
- final RpcProviderRegistry rpcProviderRegistry, final A1AdapterClient A1AdapterClient) {
- super(dataBroker, mockNotificationPublishService, mockRpcProviderRegistry, a1AdapterClient);
- }
-
- @Override
- public Builder<?> getServiceData(String svcOperation) {
- return null;
- }
- }
-
- private A1AdapterProviderMock a1AdapterProviderMock = null;
- @Mock
- private DataBroker dataBroker;
- @Mock
- private NotificationPublishService mockNotificationPublishService;
- @Mock
- private RpcProviderRegistry mockRpcProviderRegistry;
- @Mock
- private A1AdapterClient a1AdapterClient;
- private static String module = "A1-ADAPTER-API";
- private static String mode = "sync";
-
- @Before
- public void setUp() throws Exception {
-
- a1AdapterProviderMock = new A1AdapterProviderMock(dataBroker, mockNotificationPublishService,
- mockRpcProviderRegistry, a1AdapterClient);
- a1AdapterProviderMock = Mockito.spy(a1AdapterProviderMock);
-
- }
-
- @Test
- public void test_GetNearRT_RICs() throws SvcLogicException, InterruptedException, ExecutionException {
- GetNearRTRICsOutputBuilder nearRTRICsOutputBuilder = new GetNearRTRICsOutputBuilder();
- nearRTRICsOutputBuilder.setResponseCode("200");
- String rpc = "getNearRT-RICs";
- Properties respProps = new Properties();
- GetNearRTRICsInputBuilder inputBuilder = new GetNearRTRICsInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetNearRTRICsOutputBuilder.class),
- any(Properties.class))).thenReturn(respProps);
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) nearRTRICsOutputBuilder);
- ListenableFuture<RpcResult<GetNearRTRICsOutput>> result =
- a1AdapterProviderMock.getNearRTRICs(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_GetNearRT_RICs_With_No_Input() throws SvcLogicException, InterruptedException, ExecutionException {
- GetNearRTRICsInput getNearRTRICsInput = null;
- String rpc = "getNearRT-RICs";
- GetNearRTRICsOutputBuilder nearRTRICsOutputBuilder = new GetNearRTRICsOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) nearRTRICsOutputBuilder);
- ListenableFuture<RpcResult<GetNearRTRICsOutput>> result =
- a1AdapterProviderMock.getNearRTRICs(getNearRTRICsInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_GetNearRT_RICs_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- GetNearRTRICsOutputBuilder nearRTRICsOutputBuilder = new GetNearRTRICsOutputBuilder();
- String rpc = "getNearRT-RICs";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) nearRTRICsOutputBuilder);
- GetNearRTRICsInputBuilder inputBuilder = new GetNearRTRICsInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<GetNearRTRICsOutput>> result =
- a1AdapterProviderMock.getNearRTRICs(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_GetNearRT_RICs_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetNearRTRICsOutputBuilder nearRTRICsOutputBuilder = new GetNearRTRICsOutputBuilder();
- String rpc = "getNearRT-RICs";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) nearRTRICsOutputBuilder);
- GetNearRTRICsInputBuilder inputBuilder = new GetNearRTRICsInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetNearRTRICsOutput>> result =
- a1AdapterProviderMock.getNearRTRICs(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_GetNearRT_RICs_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetNearRTRICsOutputBuilder nearRTRICsOutputBuilder = new GetNearRTRICsOutputBuilder();
- String rpc = "getNearRT-RICs";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) nearRTRICsOutputBuilder);
- GetNearRTRICsInputBuilder inputBuilder = new GetNearRTRICsInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetNearRTRICsOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetNearRTRICsOutput>> result =
- a1AdapterProviderMock.getNearRTRICs(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getHealthCheck() throws SvcLogicException, InterruptedException, ExecutionException {
- String rpc = "getHealthCheck";
- Properties respProps = new Properties();
- GetHealthCheckOutputBuilder healthCheckOutputBuilder = new GetHealthCheckOutputBuilder();
- healthCheckOutputBuilder.setResponseCode("200");
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) healthCheckOutputBuilder);
- GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetHealthCheckOutputBuilder.class),
- any(Properties.class))).thenReturn(respProps);
- ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
- a1AdapterProviderMock.getHealthCheck(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getHealthCheck_With_No_Input() throws SvcLogicException, InterruptedException, ExecutionException {
- GetHealthCheckInput getHealthCheckInput = null;
- String rpc = "getHealthCheck";
- GetHealthCheckOutputBuilder healthCheckOutputBuilder = new GetHealthCheckOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) healthCheckOutputBuilder);
- ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
- a1AdapterProviderMock.getHealthCheck(getHealthCheckInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getHealthCheck_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- GetHealthCheckOutputBuilder healthCheckOutputBuilder = new GetHealthCheckOutputBuilder();
- String rpc = "getHealthCheck";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) healthCheckOutputBuilder);
- GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
- a1AdapterProviderMock.getHealthCheck(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getHealthCheck_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetHealthCheckOutputBuilder healthCheckOutputBuilder = new GetHealthCheckOutputBuilder();
- String rpc = "getHealthCheck";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) healthCheckOutputBuilder);
- GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
- a1AdapterProviderMock.getHealthCheck(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getHealthCheck_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetHealthCheckOutputBuilder healthCheckOutputBuilder = new GetHealthCheckOutputBuilder();
- String rpc = "getHealthCheck";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) healthCheckOutputBuilder);
- GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetHealthCheckOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
- a1AdapterProviderMock.getHealthCheck(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyTypes() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypesOutputBuilder policyTypesOutputBuilder = new GetPolicyTypesOutputBuilder();
- policyTypesOutputBuilder.setResponseCode("200");
- String rpc = "getPolicyTypes";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypesOutputBuilder);
- Properties respProps = new Properties();
- GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypesOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
- a1AdapterProviderMock.getPolicyTypes(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyTypes_With_No_Input() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypesInput getHealthCheckInput = null;
- String rpc = "getPolicyTypes";
- GetPolicyTypesOutputBuilder policyTypesOutputBuilder = new GetPolicyTypesOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypesOutputBuilder);
- ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
- a1AdapterProviderMock.getPolicyTypes(getHealthCheckInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyTypes_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypesOutputBuilder policyTypesOutputBuilder = new GetPolicyTypesOutputBuilder();
- String rpc = "getPolicyTypes";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypesOutputBuilder);
- GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
- a1AdapterProviderMock.getPolicyTypes(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyTypes_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypesOutputBuilder policyTypesOutputBuilder = new GetPolicyTypesOutputBuilder();
- String rpc = "getPolicyTypes";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypesOutputBuilder);
- GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
- a1AdapterProviderMock.getPolicyTypes(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyTypes_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypesOutputBuilder policyTypesOutputBuilder = new GetPolicyTypesOutputBuilder();
- String rpc = "getPolicyTypes";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypesOutputBuilder);
- GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypesOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
- a1AdapterProviderMock.getPolicyTypes(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyType() throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyTypeOutputBuilder createPolicyTypeOutputBuilder = new CreatePolicyTypeOutputBuilder();
- createPolicyTypeOutputBuilder.setResponseCode("200");
- String rpc = "createPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyTypeOutputBuilder);
- Properties respProps = new Properties();
- CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(CreatePolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
- a1AdapterProviderMock.createPolicyType(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyType_With_No_Input()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyTypeInput createPolicyTypeInput = null;
- String rpc = "createPolicyType";
- CreatePolicyTypeOutputBuilder createPolicyTypeOutputBuilder = new CreatePolicyTypeOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyTypeOutputBuilder);
- ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
- a1AdapterProviderMock.createPolicyType(createPolicyTypeInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyType_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyTypeOutputBuilder createPolicyTypeOutputBuilder = new CreatePolicyTypeOutputBuilder();
- String rpc = "createPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyTypeOutputBuilder);
- CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
- a1AdapterProviderMock.createPolicyType(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyType_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyTypeOutputBuilder createPolicyTypeOutputBuilder = new CreatePolicyTypeOutputBuilder();
- String rpc = "createPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyTypeOutputBuilder);
- CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
- a1AdapterProviderMock.createPolicyType(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyType_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyTypeOutputBuilder createPolicyTypeOutputBuilder = new CreatePolicyTypeOutputBuilder();
- String rpc = "createPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyTypeOutputBuilder);
- CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(CreatePolicyTypeOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
- a1AdapterProviderMock.createPolicyType(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyType() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypeOutputBuilder policyTypeOutputBuilder = new GetPolicyTypeOutputBuilder();
- policyTypeOutputBuilder.setResponseCode("200");
- String rpc = "getPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypeOutputBuilder);
- Properties respProps = new Properties();
- GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
- a1AdapterProviderMock.getPolicyType(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyType_With_No_Input() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypeInput getPolicyTypeInput = null;
- String rpc = "getPolicyType";
- GetPolicyTypeOutputBuilder policyTypeOutputBuilder = new GetPolicyTypeOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypeOutputBuilder);
- ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
- a1AdapterProviderMock.getPolicyType(getPolicyTypeInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyType_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypeOutputBuilder policyTypeOutputBuilder = new GetPolicyTypeOutputBuilder();
- String rpc = "getPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypeOutputBuilder);
- GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
- a1AdapterProviderMock.getPolicyType(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyType_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypeOutputBuilder policyTypeOutputBuilder = new GetPolicyTypeOutputBuilder();
- String rpc = "getPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypeOutputBuilder);
- GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
- a1AdapterProviderMock.getPolicyType(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyType_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyTypeOutputBuilder policyTypeOutputBuilder = new GetPolicyTypeOutputBuilder();
- String rpc = "getPolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyTypeOutputBuilder);
- GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
- a1AdapterProviderMock.getPolicyType(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyType() throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyTypeOutputBuilder deletePolicyTypeOutputBuilder = new DeletePolicyTypeOutputBuilder();
- deletePolicyTypeOutputBuilder.setResponseCode("200");
- String rpc = "deletePolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyTypeOutputBuilder);
- Properties respProps = new Properties();
- DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
- a1AdapterProviderMock.deletePolicyType(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyType_With_No_Input()
- throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyTypeInput deletePolicyTypeInput = null;
- String rpc = "deletePolicyType";
- DeletePolicyTypeOutputBuilder deletePolicyTypeOutputBuilder = new DeletePolicyTypeOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyTypeOutputBuilder);
- ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
- a1AdapterProviderMock.deletePolicyType(deletePolicyTypeInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyType_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyTypeOutputBuilder deletePolicyTypeOutputBuilder = new DeletePolicyTypeOutputBuilder();
- String rpc = "deletePolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyTypeOutputBuilder);
- DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
- a1AdapterProviderMock.deletePolicyType(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyType_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyTypeOutputBuilder deletePolicyTypeOutputBuilder = new DeletePolicyTypeOutputBuilder();
- String rpc = "deletePolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyTypeOutputBuilder);
- DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
- a1AdapterProviderMock.deletePolicyType(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyType_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyTypeOutputBuilder deletePolicyTypeOutputBuilder = new DeletePolicyTypeOutputBuilder();
- String rpc = "deletePolicyType";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyTypeOutputBuilder);
- DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(DeletePolicyTypeOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
- a1AdapterProviderMock.deletePolicyType(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstances() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstancesOutputBuilder policyInstancesOutputBuilder = new GetPolicyInstancesOutputBuilder();
- policyInstancesOutputBuilder.setResponseCode("200");
- String rpc = "getPolicyInstances";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstancesOutputBuilder);
- Properties respProps = new Properties();
- GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
- a1AdapterProviderMock.getPolicyInstances(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstances_With_No_Input()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstancesInput getPolicyInstancesInput = null;
- String rpc = "getPolicyInstances";
- GetPolicyInstancesOutputBuilder policyInstancesOutputBuilder = new GetPolicyInstancesOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstancesOutputBuilder);
- ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
- a1AdapterProviderMock.getPolicyInstances(getPolicyInstancesInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstances_With_No_DG()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstancesOutputBuilder policyInstancesOutputBuilder = new GetPolicyInstancesOutputBuilder();
- String rpc = "getPolicyInstances";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstancesOutputBuilder);
- GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
- a1AdapterProviderMock.getPolicyInstances(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstances_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstancesOutputBuilder policyInstancesOutputBuilder = new GetPolicyInstancesOutputBuilder();
- String rpc = "getPolicyInstances";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstancesOutputBuilder);
- GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
- a1AdapterProviderMock.getPolicyInstances(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstances_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstancesOutputBuilder policyInstancesOutputBuilder = new GetPolicyInstancesOutputBuilder();
- String rpc = "getPolicyInstances";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstancesOutputBuilder);
- GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode),
- any(GetPolicyInstancesOutputBuilder.class), any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
- a1AdapterProviderMock.getPolicyInstances(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyInstance() throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyInstanceOutputBuilder createPolicyInstanceOutputBuilder = new CreatePolicyInstanceOutputBuilder();
- createPolicyInstanceOutputBuilder.setResponseCode("200");
- String rpc = "createPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyInstanceOutputBuilder);
- Properties respProps = new Properties();
- CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode),
- any(CreatePolicyInstanceOutputBuilder.class), eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
- a1AdapterProviderMock.createPolicyInstance(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyInstance_With_No_Input()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyInstanceInput createPolicyInstanceInput = null;
- String rpc = "createPolicyInstance";
- CreatePolicyInstanceOutputBuilder createPolicyInstanceOutputBuilder = new CreatePolicyInstanceOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyInstanceOutputBuilder);
- ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
- a1AdapterProviderMock.createPolicyInstance(createPolicyInstanceInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyInstance_With_No_DG()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyInstanceOutputBuilder createPolicyInstanceOutputBuilder = new CreatePolicyInstanceOutputBuilder();
- String rpc = "createPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyInstanceOutputBuilder);
- CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
- a1AdapterProviderMock.createPolicyInstance(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyInstance_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyInstanceOutputBuilder createPolicyInstanceOutputBuilder = new CreatePolicyInstanceOutputBuilder();
- String rpc = "createPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyInstanceOutputBuilder);
- CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
- a1AdapterProviderMock.createPolicyInstance(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_createPolicyInstance_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- CreatePolicyInstanceOutputBuilder createPolicyInstanceOutputBuilder = new CreatePolicyInstanceOutputBuilder();
- String rpc = "createPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) createPolicyInstanceOutputBuilder);
- CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode),
- any(CreatePolicyInstanceOutputBuilder.class), any(Properties.class)))
- .thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
- a1AdapterProviderMock.createPolicyInstance(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstance() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstanceOutputBuilder policyInstanceOutputBuilder = new GetPolicyInstanceOutputBuilder();
- policyInstanceOutputBuilder.setResponseCode("200");
- String rpc = "getPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstanceOutputBuilder);
- Properties respProps = new Properties();
- GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
- a1AdapterProviderMock.getPolicyInstance(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstance_With_No_Input()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstanceInput getPolicyInstanceInput = null;
- String rpc = "getPolicyInstance";
- GetPolicyInstanceOutputBuilder policyInstanceOutputBuilder = new GetPolicyInstanceOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstanceOutputBuilder);
- ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
- a1AdapterProviderMock.getPolicyInstance(getPolicyInstanceInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstance_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstanceOutputBuilder policyInstanceOutputBuilder = new GetPolicyInstanceOutputBuilder();
- String rpc = "getPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstanceOutputBuilder);
- GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
- a1AdapterProviderMock.getPolicyInstance(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstance_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstanceOutputBuilder policyInstanceOutputBuilder = new GetPolicyInstanceOutputBuilder();
- String rpc = "getPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstanceOutputBuilder);
- GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
- a1AdapterProviderMock.getPolicyInstance(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getPolicyInstance_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- GetPolicyInstanceOutputBuilder policyInstanceOutputBuilder = new GetPolicyInstanceOutputBuilder();
- String rpc = "getPolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) policyInstanceOutputBuilder);
- GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyInstanceOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
- a1AdapterProviderMock.getPolicyInstance(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyInstance() throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyInstanceOutputBuilder deletePolicyInstanceOutputBuilder = new DeletePolicyInstanceOutputBuilder();
- deletePolicyInstanceOutputBuilder.setResponseCode("200");
- String rpc = "deletePolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyInstanceOutputBuilder);
- Properties respProps = new Properties();
- DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
- a1AdapterProviderMock.deletePolicyInstance(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyInstance_With_No_Input()
- throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyInstanceInput deletePolicyInstanceInput = null;
- String rpc = "deletePolicyInstance";
- DeletePolicyInstanceOutputBuilder deletePolicyInstanceOutputBuilder = new DeletePolicyInstanceOutputBuilder();
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyInstanceOutputBuilder);
- ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
- a1AdapterProviderMock.deletePolicyInstance(deletePolicyInstanceInput);
- assertEquals("Input is null", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyInstance_With_No_DG() throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyInstanceOutputBuilder deletePolicyInstanceOutputBuilder = new DeletePolicyInstanceOutputBuilder();
- String rpc = "deletePolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyInstanceOutputBuilder);
- DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(Boolean.FALSE);
- ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
- a1AdapterProviderMock.deletePolicyInstance(inputBuilder.build());
- assertEquals("503", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyInstance_With_DG_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyInstanceOutputBuilder deletePolicyInstanceOutputBuilder = new DeletePolicyInstanceOutputBuilder();
- String rpc = "deletePolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyInstanceOutputBuilder);
- DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
- a1AdapterProviderMock.deletePolicyInstance(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_deletePolicyInstance_With_DG_Execute_Exception()
- throws SvcLogicException, InterruptedException, ExecutionException {
- DeletePolicyInstanceOutputBuilder deletePolicyInstanceOutputBuilder = new DeletePolicyInstanceOutputBuilder();
- String rpc = "deletePolicyInstance";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) deletePolicyInstanceOutputBuilder);
- DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(DeletePolicyInstanceOutputBuilder.class),
- any(Properties.class))).thenThrow(new SvcLogicException());
- ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
- a1AdapterProviderMock.deletePolicyInstance(inputBuilder.build());
- assertEquals("500", result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_getStatus() throws SvcLogicException, InterruptedException, ExecutionException {
- GetStatusOutputBuilder statusOutputBuilder = new GetStatusOutputBuilder();
- statusOutputBuilder.setResponseCode("200");
- String rpc = "getStatus";
- when(a1AdapterProviderMock.getServiceData(rpc)).thenReturn((Builder) statusOutputBuilder);
- Properties respProps = new Properties();
- GetStatusInputBuilder inputBuilder = new GetStatusInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<GetStatusOutput>> result = a1AdapterProviderMock.getStatus(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
- @Test
- public void test_notifyPolicyEnforcementUpdate()
- throws SvcLogicException, InterruptedException, ExecutionException {
- NotifyPolicyEnforcementUpdateOutputBuilder notifyPolicyEnforcementUpdateOutputBuilder =
- new NotifyPolicyEnforcementUpdateOutputBuilder();
- notifyPolicyEnforcementUpdateOutputBuilder.setResponseCode("200");
- String rpc = "notifyPolicyEnforcementUpdate";
- when(a1AdapterProviderMock.getServiceData(rpc))
- .thenReturn((Builder) notifyPolicyEnforcementUpdateOutputBuilder);
- Properties respProps = new Properties();
- NotifyPolicyEnforcementUpdateInputBuilder inputBuilder = new NotifyPolicyEnforcementUpdateInputBuilder();
- when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
- when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode), any(GetPolicyTypeOutputBuilder.class),
- eq(null))).thenReturn(respProps);
- ListenableFuture<RpcResult<NotifyPolicyEnforcementUpdateOutput>> result =
- a1AdapterProviderMock.notifyPolicyEnforcementUpdate(inputBuilder.build());
- assertEquals("200",result.get().getResult().getResponseCode());
- }
-
-
-}
+public class A1AdapterProviderTest {} \ No newline at end of file