diff options
70 files changed, 639 insertions, 2062 deletions
@@ -33,10 +33,9 @@ committers: company: 'ATT' id: 'jh245g' timezone: 'America/New York' - - name: 'Ryan Goulding' - email: 'ryandgoulding@gmail.com' - company: 'Inocybe Technologies' - id: 'rgoulding' - timezone: 'America/New York' tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' + changes: + - type: 'Deletion' + name: 'Ryan Goulding' + link: 'https://lists.onap.org/g/onap-tsc/message/4261' diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java index 296fe70f..15aa7a1d 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSourceFactory.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2016 - 2017 ONAP * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -38,7 +40,7 @@ public class CachedDataSourceFactory { if(config instanceof JDBCConfiguration) return JdbcDBCachedDataSource.createInstance(config); - return (CachedDataSource)null; + return null; } } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java index 9acae340..047fa297 100755 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/DBResourceManager.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2016 - 2017 ONAP * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -68,7 +70,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb transient protected long retryInterval = 10000L; transient boolean recoveryMode = true; - SortedSet<CachedDataSource> dsQueue = new ConcurrentSkipListSet<CachedDataSource>(new DataSourceComparator()); + SortedSet<CachedDataSource> dsQueue = new ConcurrentSkipListSet<>(new DataSourceComparator()); protected final Set<CachedDataSource> broken = Collections.synchronizedSet(new HashSet<CachedDataSource>()); protected final Object monitor = new Object(); protected final Properties configProps; @@ -80,6 +82,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb protected final long monitoringInitialDelay; protected final long expectedCompletionTime; protected final long unprocessedFailoverThreshold; + private static final String LOGGER_ALARM_MSG="Generated alarm: DBResourceManager.getData - No active DB connection pools are available."; public DBResourceManager(final DBLIBResourceProvider configuration) { this(configuration.getProperties()); @@ -393,7 +396,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb // test if there are any connection pools available if(this.dsQueue.isEmpty()){ - LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available."); + LOGGER.error(LOGGER_ALARM_MSG); throw new DBLibException("No active DB connection pools are available in RequestDataWithRecovery call."); } @@ -457,7 +460,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb private CachedRowSet requestDataNoRecovery(String statement, ArrayList<Object> arguments, String preferredDS) throws SQLException { if(dsQueue.isEmpty()){ - LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available."); + LOGGER.error(LOGGER_ALARM_MSG); throw new DBLibException("No active DB connection pools are available in RequestDataNoRecovery call."); } CachedDataSource active = this.dsQueue.first(); @@ -533,7 +536,7 @@ public class DBResourceManager implements DataSource, DataAccessor, DBResourceOb private boolean writeDataNoRecovery(String statement, ArrayList<Object> arguments, String preferredDS) throws SQLException { if(dsQueue.isEmpty()){ - LOGGER.error("Generated alarm: DBResourceManager.getData - No active DB connection pools are available."); + LOGGER.error(LOGGER_ALARM_MSG); throw new DBLibException("No active DB connection pools are available in RequestDataNoRecovery call."); } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java index a8bc58b8..5f0209b6 100755 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/BaseDBConfiguration.java @@ -3,6 +3,7 @@ * onap * ================================================================================ * Copyright (C) 2016 - 2017 ONAP + * Modifications Copyright (C) 2018 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,12 +22,14 @@ package org.onap.ccsdk.sli.core.dblib.config; import java.util.Properties; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Base class responsible for parsing business logic for database configuration from given <code>Properties</code>. */ public abstract class BaseDBConfiguration { + private Logger logger = LoggerFactory.getLogger(BaseDBConfiguration.class); /** * Property key within a properties configuration File for db type */ @@ -45,7 +48,7 @@ public abstract class BaseDBConfiguration { /** * Property key with a properties configuration File for jdbc driver */ - public static final String DRIVER_NAME = "org.onap.ccsdk.sli.jdbc.driver"; + public static final String DRIVER_NAME = "org.onap.ccsdk.sli.jdbc.driver"; /** * Property key with a properties configuration File for db database connection name @@ -131,6 +134,7 @@ public abstract class BaseDBConfiguration { String value = properties.getProperty(CONNECTION_TIMEOUT, DEFAULT_REJECT_CHANGE_VALUE); return Integer.parseInt(value); } catch (Exception exc) { + logger.error("Exception",exc); return Integer.parseInt(DEFAULT_REJECT_CHANGE_VALUE); } } @@ -146,6 +150,7 @@ public abstract class BaseDBConfiguration { String value = properties.getProperty(REQUEST_TIMEOUT, DEFAULT_REJECT_CHANGE_VALUE); return Integer.parseInt(value); } catch (Exception exc) { + logger.error("Exception",exc); return Integer.parseInt(DEFAULT_REJECT_CHANGE_VALUE); } } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/DbConfigPool.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/DbConfigPool.java index 21fdab24..fb94ea0e 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/DbConfigPool.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/config/DbConfigPool.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2016 - 2017 ONAP * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -30,7 +32,7 @@ public class DbConfigPool { private final String type; - private ArrayList<BaseDBConfiguration> configurations = new ArrayList<BaseDBConfiguration>(); + private ArrayList<BaseDBConfiguration> configurations = new ArrayList<>(); public DbConfigPool(Properties properties) { LOGGER.debug("Initializing DbConfigType"); @@ -38,7 +40,6 @@ public class DbConfigPool { } public int getTimeout() { - // TODO Auto-generated method stub return 0; } diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/DBConfigFactory.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/DBConfigFactory.java index c3503576..1aa90783 100644 --- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/DBConfigFactory.java +++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/factory/DBConfigFactory.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2016 - 2017 ONAP * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -44,7 +46,7 @@ public class DBConfigFactory { static DbConfigPool getConfigparams(Properties properties) { DbConfigPool xmlConfig = new DbConfigPool(properties); - ArrayList<Properties> propertySets = new ArrayList<Properties>(); + ArrayList<Properties> propertySets = new ArrayList<>(); if ("JDBC".equalsIgnoreCase(xmlConfig.getType())) { String hosts = properties.getProperty(BaseDBConfiguration.DATABASE_HOSTS); diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java index d7a599cb..4481ab90 100644 --- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java +++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/LogFilter.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights * reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -84,6 +86,7 @@ public class LogFilter implements Filter { private static final Logger AUDIT = LoggerFactory.getLogger("org.onap.ccsdk.sli.core.filters.audit"); @Override public void destroy() { + // this method does nothing } @Override @@ -111,6 +114,7 @@ public class LogFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { + // this method does nothing } @@ -134,11 +138,7 @@ public class LogFilter implements Filter { String userName="unknown"; - /* below returning org.opendaylight.aaa.shiro.realm.TokenAuthRealm$ODLPrincipal@745dfcfe - if ( request.getUserPrincipal() != null) { - userName = request.getUserPrincipal().getName(); - } - */ + // going directly after Authorization header if (request.getHeader("Authorization") != null) { String authzHeader = request.getHeader("Authorization"); @@ -164,12 +164,8 @@ public class LogFilter implements Filter { private void post(HttpServletRequest request,HttpServletResponse response,long startTime) { - //AUDIT.info("{}|{}|{}{}",request.getRemoteHost(),request.getMethod(),request.getRequestURL().toString(),request.getQueryString()); - //AUDIT.info(request.getRemoteHost() + D + request.getMethod() + D + request.getRequestURL().toString() + D + request.getQueryString()); - //METRIC.info(request.getMethod() + D + response.getStatus() + D + request.getRequestURL().toString() + D + (System.currentTimeMillis() - startTime) + " ms"); MDC.put(BEGIN_TIMESTAMP,asIso8601(startTime)); MDC.put(END_TIMESTAMP,asIso8601(System.currentTimeMillis())); - //MDC.put(REQUEST_ID,"already done above"); MDC.put(SERVICE_NAME,request.getRequestURL().toString()); int idx = request.getPathInfo().lastIndexOf(':'); String instance = ""; @@ -179,7 +175,6 @@ public class LogFilter implements Filter { MDC.put(SERVICE_INSTANCE,instance); MDC.put(THREAD_ID,""); MDC.put(PHYSICAL_SERVER_NAME,""); - //MDC.put(PARTNER_NAME,"already done above"); if ( response.getStatus() >= 400 ) { MDC.put(STATUS_CODE,"ERROR"); } else { diff --git a/sli/common/src/main/resources/crAseNetwork.sql b/sli/common/src/main/resources/crAseNetwork.sql deleted file mode 100644 index 83f1dfc8..00000000 --- a/sli/common/src/main/resources/crAseNetwork.sql +++ /dev/null @@ -1,82 +0,0 @@ ---- --- ============LICENSE_START======================================================= --- ONAP : CCSDK --- ================================================================================ --- Copyright (C) 2017 AT&T Intellectual Property. All rights --- reserved. --- ================================================================================ --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- ============LICENSE_END========================================================= ---- - -CREATE TABLE sdnctl.ASE ( - ase_network_id INT NOT NULL, - topology VARCHAR(25), - CONSTRAINT P_ASE PRIMARY KEY(ase_network_id)); - -CREATE TABLE sdnctl.ASE_PORT ( - esm_name VARCHAR(25), - resource_emt_clli VARCHAR(25) NOT NULL, - resource_emt_ip_addr VARCHAR(25) NOT NULL, - port_action VARCHAR(25), - profile VARCHAR(25) , - port VARCHAR(15) NOT NULL, - state VARCHAR(25), - resource_mode VARCHAR(25), - speed INT, - resource_lldp VARCHAR(1), - resource_mtu VARCHAR(5), - resource_autoneg VARCHAR(10), - resource_twamp VARCHAR(10), - resource_description VARCHAR(80), - uni_circuit_id VARCHAR(45), - CONSTRAINT P_ASE_PORT PRIMARY KEY(resource_emt_clli, port)); - -CREATE TABLE sdnctl.ASE_EVC ( - esm_name VARCHAR(25), - emt_ip_addr VARCHAR(25) NOT NULL, - evc_action VARCHAR(25), - service_id VARCHAR(25), - serv_type VARCHAR(25), - evc_choice VARCHAR(25), - uni_port VARCHAR(25) NOT NULL, - lag_port VARCHAR(25), - mac_onoff VARCHAR(25), - ppcos VARCHAR(25), - cir VARCHAR(25), - cbs VARCHAR(25), - ebs VARCHAR(25), - sgos VARCHAR(25), - pe VARCHAR(25), - unit VARCHAR(25), - qinq VARCHAR(25), - interface VARCHAR(25), - evc_description VARCHAR(80), - bandwidth VARCHAR(10), - svlan VARCHAR(5), - cvlan VARCHAR(5), - routing_instance VARCHAR(25), - rd VARCHAR(25), - rt VARCHAR(25), - evc_limit VARCHAR(25), - label_block_size VARCHAR(25), - site VARCHAR(25), - int_mac_limit VARCHAR(5), - sgos_grade VARCHAR(25), - bum_rate VARCHAR(25), - uni_circuit_id VARCHAR(45), - leg INT, - CONSTRAINT P_ASE_EVC PRIMARY KEY(emt_ip_addr, uni_port,leg)); - - - diff --git a/sli/common/src/main/yang/ase-network.yang b/sli/common/src/main/yang/ase-network.yang deleted file mode 100755 index ae654ae0..00000000 --- a/sli/common/src/main/yang/ase-network.yang +++ /dev/null @@ -1,179 +0,0 @@ -module ase { - namespace "att:ase"; - prefix ase; - revision "2014-06-03" { - description "Example ASE Network Module"; - } - - container ase { - config true; - leaf ase-network-id{ - type uint32; - } - leaf topology { - type string ; // check enum - } - } - - container ase-port { - config true; - // is this really a list of cpe ports one for each uni-ckt - leaf esm-name { - type string; - } - - leaf resource-emt-clli { - type string; - } - - leaf resource-emt-ip-addr{ - type string; - } - leaf port-action { - type string; - } - leaf profile { - type string; - } - leaf port { - type string; - } - leaf state { - type string; - } - leaf resource-mode { - type string; - } - leaf speed { - type string; - } - leaf resource-lldp { - type string; - } - leaf resource-mtu { - type string; - } - leaf resource-autoneg{ - type string; - } - leaf resource-twamp { - type string; - } - leaf resource-description { - type string; - } - leaf uni-circuit-id { - type string; - } - } // ase-port container - - container ase-evc { -// Port contains a list of EVC -// EVCs are either point to point or multipoint (topology) -// EVCs are connected ? what ID is used to connected them ? (network-id) ? - config true; - leaf esm-name { - type string; - } - leaf emt-ip-addr { - type string; - } - leaf evc-action { - type string; - } - leaf service-id { - type string; - } - - leaf serv-type { - type string; - } - leaf evc-choice { - type string; - } - leaf uni-port { - type string; - } - leaf lag-port { - type string; - } - leaf mac-onoff { - type string; - } - - leaf ppcos { - type string; - } - leaf cir { - type string; - } - leaf cbs { - type string; - } - leaf ebs { - type string; - } - leaf sgos { - type string; - } -// ipag Device Data - leaf pe { - type string; - } - leaf unit { - type string; - } - leaf qinq { - type string; - } - leaf interface { - type string; - } - leaf evc-description { - type string; - } - leaf bandwidth { - type string; - } - leaf svlan { - type string; - description "Service VLAN is either outer tag or only tag depending on QinQ"; - } - leaf cvlan { - type string; - description "Customer VLAN is null if not QinQ"; - } - leaf routing-instance { - type string; - } - leaf rd { - type string; - } - leaf rt { - type string; - } - leaf limit { - type string; - } - leaf label-block-size { - type string; - } - leaf site { - type string; - } - leaf int-mac-limit { - type string; - } - leaf sgos-grade { - type string; - } - leaf bum-rate { - type string; - } - leaf uni-circuit-id { - type string; - } - } // ase-evc container - -} // module ase-network - diff --git a/sli/common/src/main/yang/ase-type.yang b/sli/common/src/main/yang/ase-type.yang deleted file mode 100755 index 2de186e6..00000000 --- a/sli/common/src/main/yang/ase-type.yang +++ /dev/null @@ -1,561 +0,0 @@ -module ase-type { - - namespace "att:ase:type"; - prefix ase-type; - - organization "AT&T ASE"; - - revision 2014-06-09 { - description - "Initial version"; - } - - ///////////////////////////////////////////////////// - // ASE Service Model Typedefs & Groupings - ///////////////////////////////////////////////////// - - typedef query-type { - type enumeration { - enum getDevicePortDetails{ - value 0; - } - enum GetServiceDetailsRequest{ - value 1; - } - } - } - - typedef uni-action-type { - type enumeration { - enum PortPreReserveRequest{ - value 0; - } - enum PortReleaseRequest{ - value 1; - } - enum PortDeProvRequest{ - value 2; - } - enum ChangePortProvRequest{ - value 3; - } - enum PortActivateRequest{ - value 4; - } - enum ChangePortActivateRequest{ - value 5; - } - enum DisconnectPortRequest{ - value 6; - } - enum getDevicePortDetails{ - value 7; - } - } - } - - typedef evc-action-type { - type enumeration { - enum ConnectionProvRequest{ - value 0; - } - enum ChangeConnectionProvRequest{ - value 1; - } - enum ConnectionDeProvrequest{ - value 2; - } - enum ConnectionActivateRequest{ - value 3; - } - enum ChangeConnectionActivateRequest{ - value 4; - } - enum DisconnectConnectionRequest{ - value 5; - } - enum GetServiceDetailsRequest{ - value 6; - } - } - } - - typedef evc-gos-type { - type enumeration { - enum "REAL-TIME"{ - value 0; - } - enum "INTERACTIVE"{ - value 1; - } - enum "BUSINESS-CRITICAL-HIGH"{ - value 2; - } - enum "BUSINESS-CRITICAL-MEDIUM"{ - value 3; - } - enum "NON-CRITICAL-HIGH"{ - value 4; - } - enum "NON-CRITICAL-LOW"{ - value 5; - } - } - } - - typedef cir-rate-type { - type enumeration { - enum "Mbps"{ - value 0; - } - enum "Gbps"{ - value 1; - } - } - } - - typedef ase-yes-no-type { - type enumeration { - enum "Y"{ - value 0; - } - enum "N"{ - value 1; - } - } - } - - typedef provisioning-indicator { - type enumeration { - enum "Y"{ - value 0; - } - enum "N"{ - value 1; - } - } - } - - typedef media-type { - type enumeration { - enum "SFP-1GE-SX"{ - value 0; - } - enum "SFP-1GE-LX"{ - value 1; - } - enum "SFP-1GE"{ - value 2; - } - enum "Ethernet-10_100_1000M"{ - value 3; - } - } - } - - typedef media-speed-type { - type enumeration { - enum "100"{ - value 0; - } - enum "1000"{ - value 1; - } - enum "10000"{ - value 2; - } - } - } - - typedef cos-category-type { - type enumeration { - enum "GOS"{ - value 0; - } - enum "PPCOS"{ - value 1; - } - } - } - - typedef uni-gos-type { - type enumeration { - enum "INTERACTIVE"{ - value 0; - } - enum "BUSINESS-CRITICAL-HIGH"{ - value 1; - } - enum "BUSINESS-CRITICAL-MEDIUM"{ - value 2; - } - enum "NON-CRITICAL-HIGH"{ - value 3; - } - } - } - - typedef uni-cir-value-type { - type enumeration { - enum "2"{ - value 0; - } - enum "4"{ - value 1; - } - enum "5"{ - value 2; - } - enum "8"{ - value 3; - } - enum "10"{ - value 4; - } - enum "20"{ - value 5; - } - enum "30"{ - value 6; - } - enum "40"{ - value 7; - } - enum "50"{ - value 8; - } - enum "60"{ - value 9; - } - enum "70"{ - value 10; - } - enum "80"{ - value 11; - } - enum "90"{ - value 12; - } - enum "100"{ - value 13; - } - enum "125"{ - value 14; - } - enum "150"{ - value 15; - } - enum "175"{ - value 16; - } - enum "200"{ - value 17; - } - enum "225"{ - value 18; - } - enum "250"{ - value 19; - } - } - } - - typedef uni-mac-limit-type { - description "MAC address limit for UNI port"; - type enumeration { - enum "Y"{ - value 0; - } - enum "N"{ - value 1; - } - } - } - - typedef port-tagging-type { - type enumeration { - enum "port-based"{ - value 0; - } - enum "vlan-based"{ - value 1; - } - } - } - - typedef port-status { - type enumeration { - enum "Available"{ - value 0; - } - enum "Reserved"{ - value 1; - } - enum "Active" { - value 2; - } - } - } - - grouping uni-common-request-hdr { - leaf request-id { - type string; - mandatory true; - } - leaf source { - description "The source system requesting action or info"; - type string; - mandatory true; - } - leaf request-action { - description "action indicator for this service instance"; - type uni-action-type; - } - leaf undo-indicator { - type provisioning-indicator; - } - leaf notification-url { - description "When this field exists, NCS will return an " - + "acknowledgement that the request is legal " - + "Once the activate is finished (or fails) NCS" - + "will utilize the URL to indicate the status"; - type string; - } - } - - grouping uni-common-return-hdr { - leaf request-action { - description "action indicator for this service instance"; - type uni-action-type; - } - leaf request-id { - description "Identifier for the request from NGO"; - type string; - - } - } - - grouping uni-common-error-format { - leaf error-code { - description "Error code"; - type int32; - } - leaf error-message { - description "Error text describing the API error occurance"; - type string; - } - } - - grouping query-common-hdr { - leaf request-id { - description "Identifier for the request from NGO"; - type string; - } - leaf request-type { - description "action indicator for this service instance"; - type query-type; - } - } - - grouping query-error-format { - leaf error-code { - description "Error code"; - type int32; - } - leaf error-message { - description "Error text describing the API error occurance"; - type string; - } - } - - grouping evc-common-request-hdr { - leaf request-id { - description "Identifier for the request from NGO"; - type string; - } - leaf source { - description "The source system requesting action or info"; - type string; - mandatory true; - } - leaf uni-order-number { - type string; - } - leaf request-action { - description "action indicator for this service instance"; - type evc-action-type; - mandatory true; - } - leaf undo-indicator { - type provisioning-indicator; - } - leaf notification-url { - description "When this field exists, NCS will return an " - + "acknowledgement that the request is legal " - + "Once the activate is finished (or fails) NCS" - + "will utilize the URL to indicate the status"; - type string; - } - leaf evc-name { - type string; - mandatory true; - } - } - - grouping evc-common-error-format { - leaf error-code { - description "Error code"; - type int32; - } - leaf error-message { - description "Error text describing the API error occurance"; - type string; - } - } - - ///////////////////////////////////////// - // UNI-PORTS table contains all circuits - ///////////////////////////////////////// - container uni-ports { - description - "UNI port container"; - list uni-port { - key "uni-circuit-id"; - leaf uni-circuit-id { - type string; - mandatory true; - } - leaf subscriber-name { - type string; - mandatory true; - } - leaf uni-order-number { - type string; - mandatory true; - } - leaf edge-device-clli { - description "Edge device (e.g. EMT) on which port " - + " reservation is needed"; - type string; - mandatory true; - } - leaf uni-location-city { - type string; - mandatory true; - } - leaf uni-location-state { - type string; - mandatory true; - } - leaf media-type { - type media-type; - mandatory true; - } - leaf media-speed { - type media-speed-type; - mandatory true; - } - leaf uni-cir-value { - description "Integer value for the CIR"; - type uni-cir-value-type; - mandatory true; - } - leaf uni-cir-units { - description "Units for the CIR"; - type cir-rate-type; - mandatory true; - } - leaf cos-category { - description "CoS Type"; - type cos-category-type; - mandatory true; - } - leaf gos-profile { - description "GoS tpye"; - type uni-gos-type; - mandatory true; - } - leaf aditional-mac-allowed { - type uni-mac-limit-type; - } - leaf port-tagging { - type port-tagging-type; - mandatory true; - } - leaf port-status { - type port-status; - } - leaf name-value-pair { - type string; - } - } - } - - /////////////////////////////////////////// - // EVCS table contains all evc associations - /////////////////////////////////////////// - container evcs { - list evc { - key "evc-name"; - leaf evc-name { - type string; - mandatory true; - } - leaf topology { - type enumeration { - enum "MultiPoint"{ - value 0; - } - enum "PointToPoint"{ - value 1; - } - } - } - list evc-leg { - key evc-access-name; - leaf evc-access-name { - type string; - } - leaf subscriber-name { - type string; - } - leaf cvlan { - type uint16 { - range "2..4090"; - } - } - leaf connection-cir-value { - type uni-cir-value-type; - } - leaf connection-cir-units-string { - type cir-rate-type; - } - leaf connection-gos-profile { - type evc-gos-type; - } - leaf connection-additional-mac-allowed { - type uni-mac-limit-type; - } - leaf connection-emc-indicator { - type enumeration { - enum "Y"{ - value 0; - } - enum "N"{ - value 1; - } - } - } - leaf connection-emc-speed-value { - type uni-cir-value-type; - } - leaf connection-emc-speed-units-string { - type cir-rate-type; - } - } - leaf name-value-pair { - type string; - } - } - } -} diff --git a/sli/common/src/main/yang/ase.yang b/sli/common/src/main/yang/ase.yang deleted file mode 100755 index 0b36a561..00000000 --- a/sli/common/src/main/yang/ase.yang +++ /dev/null @@ -1,558 +0,0 @@ -module ase { - - namespace "att:ase"; - prefix ase; - - import ase-type {prefix ase-type; revision-date "2014-06-09";} - - organization "AT&T ASE"; - - description - "This submodule contains a collection of YANG definitions for - defining the ASE service model(s) for UNI and EVC"; - - revision 2014-03-27 { - description - "Additional detail for UNI and EVC API"; - } - revision 2014-03-18 { - description - "Initial version"; - } - - - ///////////////////////////////////////////////////// - // ASE Query Actions - ///////////////////////////////////////////////////// - - //// - // Port Reserve Request - //// - rpc ase-port-reserve { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - leaf edge-device-clli { - description "Edge device (e.g. EMT) on which port " - + " reservation is needed"; - type string; - mandatory true; - } - leaf uni-cir-value { - description "Integer value for the CIR"; - type ase-type:uni-cir-value-type; - mandatory true; - } - leaf uni-cir-units { - description "Units for the CIR"; - type ase-type:cir-rate-type; - mandatory true; - } - } - output { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - } - leaf uni-port-id { - description "Allocated UNI port id"; - type string; - } - - uses ase-type:uni-common-error-format; - } - } - - //// - // Release Port Request - //// - rpc ase-release-port-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - } - output { - uses ase-type:uni-common-return-hdr; - uses ase-type:uni-common-error-format; - } - } - - //// - // Port Provisioning Request - //// - rpc ase-port-prov-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - leaf subscriber-name { - type string; - mandatory true; - } - leaf uni-order-number { - type string; - mandatory true; - } - leaf edge-device-clli { - description "Edge device (e.g. EMT) on which port " - + " reservation is needed"; - type string; - mandatory true; - } - leaf uni-location-city { - type string; - mandatory true; - } - leaf uni-location-state { - type string; - mandatory true; - } - leaf media-type { - type ase-type:media-type; - mandatory true; - } - leaf media-speed { - type ase-type:media-speed-type; - mandatory true; - } - leaf uni-cir-value { - description "Integer value for the CIR"; - type ase-type:uni-cir-value-type; - mandatory true; - } - leaf uni-cir-units { - description "Units for the CIR"; - type ase-type:cir-rate-type; - mandatory true; - } - leaf cos-category { - description "CoS Type"; - type ase-type:cos-category-type; - mandatory true; - } - leaf gos-profile { - description "GoS tpye"; - type ase-type:uni-gos-type; - mandatory true; - } - leaf aditional-mac-allowed { - type ase-type:uni-mac-limit-type; - } - leaf port-tagging { - type ase-type:port-tagging-type; - mandatory true; - } - leaf name-value-pair { - type string; - } - } - output { - uses ase-type:uni-common-return-hdr; - uses ase-type:uni-common-error-format; - } - } - - //// - // Deprovisioning Port Request - //// - rpc ase-deprov-port-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - } - output { - uses ase-type:uni-common-error-format; - } - } - - //// - // Change Port Provisioning Request - //// - rpc ase-change-port-prov-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - leaf subscriber-name { - type string; - } - leaf media-speed { - type ase-type:media-speed-type; - } - leaf uni-cir-value { - description "Integer value for the CIR"; - type ase-type:uni-cir-value-type; - } - leaf uni-cir-units { - description "Units for the CIR"; - type ase-type:cir-rate-type; - } - leaf cos-catagory { - type ase-type:cos-category-type; - } - leaf gos-profile { - type ase-type:uni-gos-type; - } - leaf additional-mac-allowed { - type ase-type:uni-mac-limit-type; - } - leaf port-tagging { - type ase-type:port-tagging-type; - mandatory true; - } - leaf name-value-pair { - type string; - } - } - output { - uses ase-type:uni-common-error-format; - } - } - - //// - // Port Activate Request - //// - rpc ase-port-activate-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - } - output { - uses ase-type:uni-common-error-format; - } - } - - //// - // Port Change Activation Request - //// - rpc ase-change-port-activation-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - } - output { - uses ase-type:uni-common-error-format; - } - } - - //// - // Port Disconnect Request - //// - rpc ase-port-disconnect-request { - input { - uses ase-type:uni-common-request-hdr; - - leaf uni-circuit-id { - type string; - mandatory true; - } - } - output { - uses ase-type:uni-common-error-format; - } - } - - ///////////////////////////////////////////////////// - // EVC API - ///////////////////////////////////////////////////// - - //// - // EVC Provision Request - //// - rpc ase-evc-activation { - input { - uses ase-type:evc-common-request-hdr; - leaf topology { - type enumeration { - enum "MultiPoint"{ - value 0; - } - enum "PointToPoint"{ - value 1; - } - } - } - list evc-leg { - key evc-access-name; - leaf evc-access-name { - type string; - } - leaf subscriber-name { - type string; - } - leaf cvlan { - type uint16 { - range "2..4090"; - } - } - leaf connection-cir-value { - type ase-type:uni-cir-value-type; - } - leaf connection-cir-units-string { - type ase-type:cir-rate-type; - } - leaf connection-gos-profile { - type ase-type:evc-gos-type; - } - leaf connection-additional-mac-allowed { - type ase-type:uni-mac-limit-type; - } - leaf connection-emc-indicator { - type enumeration { - enum "Y"{ - value 0; - } - enum "N"{ - value 1; - } - } - } - leaf connection-emc-speed-value { - type ase-type:uni-cir-value-type; - } - leaf connection-emc-speed-units-string { - type ase-type:cir-rate-type; - } - } - leaf name-value-pair { - type string; - } - } - output { - uses ase-type:evc-common-error-format; - } - } - - //// - // EVC Change Activation Request - //// - rpc ase-evc-change-activation { - input { - uses ase-type:evc-common-request-hdr; - leaf topology { - type enumeration { - enum "MultiPoint"{ - value 0; - } - enum "PointToPoint"{ - value 1; - } - } - } - list evc-leg { - key evc-access-name; - leaf evc-access-name { - type string; - } - leaf connection-cir-value { - type ase-type:uni-cir-value-type; - } - leaf connection-cir-units-string { - type ase-type:cir-rate-type; - } - leaf connection-gos-profile { - type ase-type:evc-gos-type; - } - leaf connection-additional-mac-allowed { - type ase-type:uni-mac-limit-type; - } - - } - leaf name-value-pair { - type string; - } - - } - output { - uses ase-type:evc-common-error-format; - } - } - - //// - // EVC Disconnet Connection Request - //// - rpc ase-evc-disconnect-request { - input { - uses ase-type:evc-common-request-hdr; - leaf topology { - type enumeration { - enum "MultiPoint"{ - value 0; - } - enum "PointToPoint"{ - value 1; - } - } - } - list evc-leg { - key evc-access-name; - leaf evc-access-name { - type string; - } - } - leaf name-value-pair { - type string; - } - - } - output { - uses ase-type:evc-common-error-format; - } - } - - ///////////////////////////////////////////////////// - // ASE Query Actions - ///////////////////////////////////////////////////// - - rpc find-available-ports { - description "Return a count of available ports"; - input { - uses ase-type:query-common-hdr; - leaf edge-device-clli { - type string; - mandatory true; - } - - leaf port-role { - type enumeration { - enum "NETWORK"{ - value 0; - } - enum "ACCESS"{ - value 1; - } - enum "SDN-ACCESS"{ - value 2; - } - } - mandatory true; - } - leaf port-assigned { - type string; - } - } - output { - uses ase-type:query-common-hdr; - container statuss { - leaf edge-device-clli { - type string; - } - container max-cir { - leaf cir-value { - type uint16; - } - leaf cir-type { - type ase-type:cir-rate-type; - } - } - leaf if-count { - type uint16; - } - } - uses ase-type:query-error-format; - } - } - - rpc find-evcs-in-uni { - description "Return EVC instances for a specified UNI"; - input { - uses ase-type:query-common-hdr; - - leaf uni-circuit-id { - type string; //leafref - } - leaf edge-device-clli { - description "Edge device (e.g. EMT) on which port " - + " reservation is needed"; - type string; - } - } - output { - uses ase-type:query-common-hdr; - - leaf uni-leg-name { - description "NGO-proivded named"; - type string; - } - uses ase-type:query-error-format; - } - } - - rpc find-service-details { - description "Return EVC instances for a specified UNI"; - input { - uses ase-type:query-common-hdr; - leaf uni-circuit-id { - type string; //leafref - } - leaf source { - type string; - mandatory true; - } - leaf service-name { - type string; - mandatory true; - } - leaf service-type { - type string; - mandatory true; - } - } - output { - uses ase-type:query-common-hdr; - - leaf service-name { - type string; - mandatory true; - } - leaf service-type { - type string; - mandatory true; - } - leaf service-state { - type enumeration { - enum "Active"{ - value 0; - } - enum "NotActive"{ - value 1; - } - } - } - leaf has-pending-change { - type ase-type:ase-yes-no-type; - } - leaf allowed-connection-count { - type int16; - } - uses ase-type:query-error-format; - } - } -} //module diff --git a/sli/common/src/test/resources/svclogic.xsd b/sli/common/src/test/resources/svclogic.xsd deleted file mode 100755 index 3e109c7c..00000000 --- a/sli/common/src/test/resources/svclogic.xsd +++ /dev/null @@ -1,339 +0,0 @@ -<?xml version = "1.0" encoding = "UTF-8"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.onap.org/sdnc/svclogic" xmlns="http://www.onap.org/sdnc/svclogic">
-
- <xsd:simpleType name="modeType">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="sync" />
- <xsd:enumeration value="async" />
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:group name="node">
- <xsd:choice>
- <xsd:element ref="block" />
- <xsd:element ref="is-available" />
- <xsd:element ref="exists" />
- <xsd:element ref="reserve" />
- <xsd:element ref="release" />
- <xsd:element ref="allocate" />
- <xsd:element ref="get-resource" />
- <xsd:element ref="configure" />
- <xsd:element ref="return" />
- <xsd:element ref="switch" />
- <xsd:element ref="record" />
- <xsd:element ref="save" />
- <xsd:element ref="for" />
- <xsd:element ref="set" />
- <xsd:element ref="execute" />
- <xsd:element ref="delete" />
- <xsd:element ref="update" />
- <xsd:element ref="call" />
- <xsd:element ref="notify" />
- <xsd:element ref="break" />
- <xsd:element ref="while" />
- <xsd:element ref="exit" />
- </xsd:choice>
- </xsd:group>
-
- <xsd:element name="service-logic">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="method" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="module" use="required" type="xsd:string" />
- <xsd:attribute name="version" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="method">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="rpc" use="required" type="xsd:string" />
- <xsd:attribute name="mode" use="optional" type="modeType" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="block">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="is-available">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="exists">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="outcome">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="ref" use="optional" type="xsd:string" />
- <xsd:attribute name="value" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="reserve">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="select" use="optional" type="xsd:string" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="release">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="record">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="allocate">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="required" type="xsd:string" />
- <xsd:attribute name="pfx" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="get-resource">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
- <xsd:attribute name="order-by" use="optional" type="xsd:string" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- <!-- force is retired and does not do anything -->
- <xsd:attribute name="force" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="configure">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="adaptor" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="required" type="xsd:string" />
- <xsd:attribute name="activate" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
-
- <xsd:element name="parameter">
- <xsd:complexType>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="value" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
-
- <xsd:element name="return">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="status" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="switch">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="test" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="save">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="force" use="optional" type="xsd:boolean" />
- <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="delete">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <!-- force is retired and does not do anything -->
- <xsd:attribute name="force" use="optional" type="xsd:string" />
- <!-- local-only is retired and does not do anything -->
- <xsd:attribute name="local-only" use="optional" type="xsd:string" />
- <!-- pfx is retired and does not do anything -->
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="for">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
- <xsd:attribute name="index" use="required" type="xsd:string" />
- <xsd:attribute name="start" use="required" type="xsd:string" />
- <xsd:attribute name="end" use="required" type="xsd:string" />
- <xsd:attribute name="silentFailure" use="optional" type="xsd:boolean" default="false" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="set">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="only-if-unset" use="optional"
- type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="execute">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="method" use="required" type="xsd:string" />
- <xsd:attribute name="emitsOutcome" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="update">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="force" use="optional" type="xsd:boolean" />
- <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="call">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="module" use="optional" type="xsd:string" />
- <xsd:attribute name="rpc" use="required" type="xsd:string" />
- <xsd:attribute name="version" use="optional" type="xsd:string" />
- <xsd:attribute name="mode" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="notify">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="optional" type="xsd:string" />
- <xsd:attribute name="resource" use="optional" type="xsd:string" />
- <xsd:attribute name="action" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <!-- force is retired and does not do anything -->
- <xsd:attribute name="force" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="break">
- <xsd:complexType />
- </xsd:element>
-
- <xsd:element name="exit">
- <xsd:complexType />
- </xsd:element>
-
- <xsd:element name="while">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
- </xsd:sequence>
- <xsd:attribute name="test" use="required" type="xsd:string" />
- <xsd:attribute name="do" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
-</xsd:schema>
diff --git a/sli/pom.xml b/sli/pom.xml index 7b1fd9d2..7060541a 100755 --- a/sli/pom.xml +++ b/sli/pom.xml @@ -21,6 +21,7 @@ </organization> <modules> + <module>provider-base</module> <module>model</module> <module>common</module> <module>provider</module> diff --git a/sli/provider-base/pom.xml b/sli/provider-base/pom.xml new file mode 100644 index 00000000..63cba830 --- /dev/null +++ b/sli/provider-base/pom.xml @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>1.2.0-SNAPSHOT</version> + <relativePath /> + </parent> + + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider-base</artifactId> + <version>0.4.0-SNAPSHOT</version> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>dblib-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> + + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <scope>compile</scope> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + +</project> diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java index 34fdb537..a51accbb 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/AbstractSvcLogicNodeExecutor.java @@ -19,9 +19,8 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; -import org.onap.ccsdk.sli.core.sli.MetricLogger; import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -32,11 +31,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class SvcLogicNodeExecutor { +public abstract class AbstractSvcLogicNodeExecutor { + protected SvcLogicResolver resolver; + public abstract SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException; - public abstract SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException; - - private static final Logger LOG = LoggerFactory.getLogger(SvcLogicNodeExecutor.class); + private static final Logger LOG = LoggerFactory.getLogger(AbstractSvcLogicNodeExecutor.class); protected String evaluateNodeTest(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { @@ -49,28 +48,27 @@ public abstract class SvcLogicNodeExecutor { } + public void setResolver(SvcLogicResolver resolver) { + this.resolver = resolver; + } - - protected SvcLogicAdaptor getAdaptor(String adaptorName) { - return SvcLogicAdaptorFactory.getInstance(adaptorName); + protected SvcLogicAdaptor getAdaptor(String adaptorName) { + return resolver.getSvcLogicAdaptor(adaptorName); } - protected SvcLogicResource getSvcLogicResource(String plugin) { - - return((SvcLogicResource) SvcLogicClassResolver.resolve(plugin)); + protected SvcLogicResource getSvcLogicResource(String resourceName) { + return resolver.getSvcLogicResource(resourceName); } - protected SvcLogicRecorder getSvcLogicRecorder(String plugin) { - return((SvcLogicRecorder) SvcLogicClassResolver.resolve(plugin)); + protected SvcLogicRecorder getSvcLogicRecorder(String recorderName) { + return resolver.getSvcLogicRecorder(recorderName); } protected SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName){ - return((SvcLogicJavaPlugin) SvcLogicClassResolver.resolve(pluginName)); - + return resolver.getSvcLogicJavaPlugin(pluginName); } protected SvcLogicNode getNextNode(SvcLogicNode node, String outValue) { - MetricLogger.resetContext(); SvcLogicNode nextNode = node.getOutcomeValue(outValue); if (nextNode != null) { if (LOG.isDebugEnabled()) { @@ -91,4 +89,5 @@ public abstract class SvcLogicNodeExecutor { } return (nextNode); } + } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/BlockNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java index e5ae021f..7aaf795b 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/BlockNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BlockNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,13 +28,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BlockNodeExecutor extends SvcLogicNodeExecutor { +public class BlockNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(BlockNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { SvcLogicExpression atomicExpr = node.getAttribute("atomic"); @@ -72,4 +72,5 @@ public class BlockNodeExecutor extends SvcLogicNodeExecutor { } + } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/BreakNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BreakNodeExecutor.java index fc6f0a50..603d7abc 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/BreakNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/BreakNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.BreakNodeException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BreakNodeExecutor extends SvcLogicNodeExecutor { +public class BreakNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(BreakNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String message = "BreakNodeExecutor encountered break with nodeId " + node.getNodeId(); LOG.debug(message); throw new BreakNodeException(message); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java index c8e6548f..284795bd 100755..100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/CallNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/CallNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -30,13 +30,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicStore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CallNodeExecutor extends SvcLogicNodeExecutor { +public class CallNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(CallNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String outValue = "not-found"; diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ConfigureNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java index 337b7064..5b1d9efe 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ConfigureNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ConfigureNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.HashMap; import java.util.Iterator; @@ -34,11 +34,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ConfigureNodeExecutor extends SvcLogicNodeExecutor { +public class ConfigureNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(ConfigureNodeExecutor.class); - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String adaptorName = SvcLogicExpressionResolver.evaluate( diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java index 571dd37c..2393a159 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/DeleteNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/DeleteNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,19 +28,20 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DeleteNodeExecutor extends SvcLogicNodeExecutor { +public class DeleteNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(DeleteNodeExecutor.class); + private static final String FAILURE="failure"; @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); String resourceType = SvcLogicExpressionResolver.evaluate(node.getAttribute("resource"), node, ctx); String key = SvcLogicExpressionResolver.evaluateAsKey(node.getAttribute("key"), node, ctx); - String outValue = "failure"; + String outValue = FAILURE; if (LOG.isDebugEnabled()) { LOG.debug("delete node encountered - looking for resource class " + plugin); @@ -58,11 +59,11 @@ public class DeleteNodeExecutor extends SvcLogicNodeExecutor { break; case FAILURE: default: - outValue = "failure"; + outValue = FAILURE; } } catch (SvcLogicException e) { LOG.error("Caught exception from resource plugin", e); - outValue = "failure"; + outValue = FAILURE; } } else { LOG.warn("Could not find SvcLogicResource object for plugin " + plugin); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java index ed75c335..357f11d0 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -36,12 +36,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ExecuteNodeExecutor extends SvcLogicNodeExecutor { +public class ExecuteNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(ExecuteNodeExecutor.class); private static final String pluginErrorMessage = "Could not execute plugin. SvcLogic status will be set to failure."; - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String pluginName = SvcLogicExpressionResolver.evaluate( diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java index 80aec075..397c5f32 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExistsNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExistsNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ExistsNodeExecutor extends SvcLogicNodeExecutor { +public class ExistsNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(ExistsNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExitNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExitNodeExecutor.java index fc667f40..828e1015 100755..100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExitNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ExitNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.ExitNodeException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ExitNodeExecutor extends SvcLogicNodeExecutor { +public class ExitNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(ExitNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String message = "ExitNodeExecutor encountered exit with nodeId " + node.getNodeId(); LOG.debug(message); throw new ExitNodeException(message); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java index a73fadcf..8ca1f32d 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ForNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.BreakNodeException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -29,13 +29,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ForNodeExecutor extends SvcLogicNodeExecutor { +public class ForNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(ForNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { SvcLogicExpression atomicExpr = node.getAttribute("atomic"); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java index 468a6fff..a2f1c63d 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/GetResourceNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/GetResourceNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -29,11 +29,11 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class GetResourceNodeExecutor extends SvcLogicNodeExecutor { +public class GetResourceNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(GetResourceNodeExecutor.class); - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java index 72d99e4f..a93c0d6f 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/IsAvailableNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/IsAvailableNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class IsAvailableNodeExecutor extends SvcLogicNodeExecutor { +public class IsAvailableNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(IsAvailableNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java index 44d1ec8f..de59a4b7 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/NotifyNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/NotifyNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NotifyNodeExecutor extends SvcLogicNodeExecutor { +public class NotifyNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(NotifyNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java index e3941446..3522c0a7 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/RecordNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/RecordNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.HashMap; import java.util.Iterator; @@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class RecordNodeExecutor extends SvcLogicNodeExecutor { +public class RecordNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(RecordNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java index b0453fad..ed9d7d7d 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReleaseNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReleaseNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -28,12 +28,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ReleaseNodeExecutor extends SvcLogicNodeExecutor { +public class ReleaseNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(ReleaseNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java index 00355cd0..8e21a459 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReserveNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReserveNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -29,12 +29,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ReserveNodeExecutor extends SvcLogicNodeExecutor { +public class ReserveNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(ReserveNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReturnNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java index e05692d5..d2fe35d7 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ReturnNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/ReturnNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Iterator; import java.util.Map; @@ -32,13 +32,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ReturnNodeExecutor extends SvcLogicNodeExecutor { +public class ReturnNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(ReturnNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String status = SvcLogicExpressionResolver.evaluate( diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java index 1b5219be..2dfc4074 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SaveNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SaveNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.HashMap; import java.util.Iterator; @@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SaveNodeExecutor extends SvcLogicNodeExecutor { +public class SaveNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(SaveNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java index 8275a8e4..8bebb336 100755..100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.HashMap; import java.util.Iterator; @@ -34,13 +34,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SetNodeExecutor extends SvcLogicNodeExecutor { +public class SetNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(SetNodeExecutor.class); protected final String arrayPattern = "\\[\\d*\\]"; @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { execute(node,ctx); return null; diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicExpressionResolver.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java index c9446bda..779be9e9 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicExpressionResolver.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolver.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.List; diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProvider.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicPropertiesProvider.java index 9debd6bc..fc108f95 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProvider.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicPropertiesProvider.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Properties; diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicResolver.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicResolver.java new file mode 100644 index 00000000..08b67595 --- /dev/null +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicResolver.java @@ -0,0 +1,17 @@ +package org.onap.ccsdk.sli.core.sli.provider.base; + +import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; +import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; + +public interface SvcLogicResolver { + + abstract SvcLogicResource getSvcLogicResource(String resourceName); + + abstract SvcLogicRecorder getSvcLogicRecorder(String recorderName); + + abstract SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName); + + abstract SvcLogicAdaptor getSvcLogicAdaptor(String adaptorName); +} diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceBase.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceBase.java new file mode 100644 index 00000000..8c436fef --- /dev/null +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceBase.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.core.sli.provider.base; + +import java.util.Properties; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +import org.onap.ccsdk.sli.core.sli.SvcLogicNode; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; + +public interface SvcLogicServiceBase { + + + /** + * Check for existence of a directed graph + * @param module - module name + * @param rpc - rpc name + * @param version - version. If null, looks for active version + * @param mode - mode (sync/async) + * @return true if directed graph found, false otherwise + * @throws SvcLogicException + */ + boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException; + + /** + * Execute a directed graph + * + * @param module - module name + * @param rpc - rpc name + * @param version - version. If null, use active version + * @param mode - mode (sync/async) + * @param parms - parameters, used to set SvcLogicContext attributes + * @return final values of attributes from SvcLogicContext, as Properties + * @throws SvcLogicException + * + * + */ + Properties execute(String module, String rpc, String version, String mode, Properties parms) throws SvcLogicException; + + SvcLogicStore getStore() throws SvcLogicException; + + SvcLogicContext execute(SvcLogicGraph calledGraph, SvcLogicContext ctx) throws SvcLogicException; + + SvcLogicNode executeNode(SvcLogicNode nextNode, SvcLogicContext ctx) throws SvcLogicException; + +} diff --git a/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java new file mode 100644 index 00000000..92fdb9a3 --- /dev/null +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicServiceImplBase.java @@ -0,0 +1,189 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.core.sli.provider.base; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.ExitNodeException; +import org.onap.ccsdk.sli.core.sli.MetricLogger; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +import org.onap.ccsdk.sli.core.sli.SvcLogicNode; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +public class SvcLogicServiceImplBase implements SvcLogicServiceBase { + protected SvcLogicResolver resolver; + protected static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() { + { + put("block", new BlockNodeExecutor()); + put("call", new CallNodeExecutor()); + put("configure", new ConfigureNodeExecutor()); + put("delete", new DeleteNodeExecutor()); + put("execute", new ExecuteNodeExecutor()); + put("exists", new ExistsNodeExecutor()); + put("for", new ForNodeExecutor()); + put("get-resource", new GetResourceNodeExecutor()); + put("is-available", new IsAvailableNodeExecutor()); + put("notify", new NotifyNodeExecutor()); + put("record", new RecordNodeExecutor()); + put("release", new ReleaseNodeExecutor()); + put("reserve", new ReserveNodeExecutor()); + put("return", new ReturnNodeExecutor()); + put("save", new SaveNodeExecutor()); + put("set", new SetNodeExecutor()); + put("switch", new SwitchNodeExecutor()); + put("update", new UpdateNodeExecutor()); + put("break", new BreakNodeExecutor()); + put("while", new WhileNodeExecutor()); + put("exit", new ExitNodeExecutor()); + } + }; + + private static final Logger LOG = LoggerFactory.getLogger(SvcLogicServiceImplBase.class); + protected HashMap<String, AbstractSvcLogicNodeExecutor> nodeExecutors = null; + protected Properties properties; + protected SvcLogicStore store; + protected static final String CURRENT_GRAPH="currentGraph"; + + public SvcLogicServiceImplBase(SvcLogicStore store) { + this.store = store; + } + + protected void registerExecutors() { + + LOG.info("Entered register executors"); + for (String nodeType : BUILTIN_NODES.keySet()) { + LOG.info("SLI - registering node executor for node type " + nodeType); + registerExecutor(nodeType, BUILTIN_NODES.get(nodeType)); + } + LOG.info("Done registerExecutors"); + } + + public void registerExecutor(String nodeName, AbstractSvcLogicNodeExecutor executor) { + if (nodeExecutors == null) { + nodeExecutors = new HashMap<>(); + } + LOG.info("SLI - registering executor for node type {}", nodeName); + executor.setResolver(resolver); + nodeExecutors.put(nodeName, executor); + } + + public void unregisterExecutor(String nodeName) { + LOG.info("SLI - unregistering executor for node type {}", nodeName); + nodeExecutors.remove(nodeName); + } + + public SvcLogicContext execute(SvcLogicGraph graph, SvcLogicContext ctx) throws SvcLogicException { + if (nodeExecutors == null) { + registerExecutors(); + } + + // Set service name in MDC to reference current working directed graph + MDC.put(MetricLogger.SERVICE_NAME, graph.getModule() + ":" + graph.getRpc() + "/v" + graph.getVersion()); + + MDC.put(CURRENT_GRAPH, graph.toString()); + + SvcLogicNode curNode = graph.getRootNode(); + LOG.info("About to execute graph {}", graph.toString()); + try { + while (curNode != null) { + resetContext(); + SvcLogicNode nextNode = executeNode(curNode, ctx); + curNode = nextNode; + } + } catch (ExitNodeException e) { + LOG.debug("SvcLogicServiceImpl caught ExitNodeException"); + } + MDC.remove("nodeId"); + MDC.remove(CURRENT_GRAPH); + + return (ctx); + } + + protected void resetContext() { + + } + + public SvcLogicNode executeNode(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { + if (node == null) { + return (null); + } + + LOG.info("About to execute node # {} ({})", node.getNodeId(), node.getNodeType()); + + if (LOG.isDebugEnabled()) { + LOG.debug("Executing node " + node.getNodeId() + " of " + node.getGraph().getRpc()); + } + + AbstractSvcLogicNodeExecutor executor = nodeExecutors.get(node.getNodeType()); + + if (executor != null) { + LOG.debug("Executing node executor for node type {} - {}", node.getNodeType(), + executor.getClass().getName()); + + MDC.put("nodeId", node.getNodeId() + " (" + node.getNodeType() + ")"); + return (executor.execute(this, node, ctx)); + } else { + throw new SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type"); + } + } + + @Override + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException { + return (store.hasGraph(module, rpc, version, mode)); + } + + @Override + public Properties execute(String module, String rpc, String version, String mode, Properties props) + throws SvcLogicException { + LOG.info("Fetching service logic from data store"); + SvcLogicGraph graph = store.fetch(module, rpc, version, mode); + + if (graph == null) { + Properties retProps = new Properties(); + retProps.setProperty("error-code", "401"); + retProps.setProperty("error-message", + "No service logic found for [" + module + "," + rpc + "," + version + "," + mode + "]"); + return (retProps); + } + + SvcLogicContext ctx = new SvcLogicContext(props); + ctx.setAttribute(CURRENT_GRAPH, graph.toString()); + ctx.setAttribute("X-ECOMP-RequestID", MDC.get("X-ECOMP-RequestID")); + execute(graph, ctx); + return (ctx.toProperties()); + } + + @Override + public SvcLogicStore getStore() throws SvcLogicException { + return this.store; + } + +} diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SwitchNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SwitchNodeExecutor.java index 592fb288..2186a38e 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SwitchNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/SwitchNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -27,14 +27,14 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SwitchNodeExecutor extends SvcLogicNodeExecutor { +public class SwitchNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory .getLogger(SwitchNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java index a783df41..c4c8faa8 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/UpdateNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/UpdateNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.HashMap; import java.util.Iterator; @@ -33,12 +33,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class UpdateNodeExecutor extends SvcLogicNodeExecutor { +public class UpdateNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(UpdateNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String plugin = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/WhileNodeExecutor.java b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java index b717aa98..c01e2f51 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/WhileNodeExecutor.java +++ b/sli/provider-base/src/main/java/org/onap/ccsdk/sli/core/sli/provider/base/WhileNodeExecutor.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import org.onap.ccsdk.sli.core.sli.BreakNodeException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -29,12 +29,12 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class WhileNodeExecutor extends SvcLogicNodeExecutor { +public class WhileNodeExecutor extends AbstractSvcLogicNodeExecutor { private static final Logger LOG = LoggerFactory.getLogger(WhileNodeExecutor.class); @Override - public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { + public SvcLogicNode execute(SvcLogicServiceBase svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { String testResult = evaluateNodeTest(node, ctx); SvcLogicExpression silentFailureExpr = node.getAttribute("do"); diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/BadPlugin.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/BadPlugin.java index f5a39f50..6c5877eb 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/BadPlugin.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/BadPlugin.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyAdaptor.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyAdaptor.java index 0f3893ef..58582e0e 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyAdaptor.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyAdaptor.java @@ -1,7 +1,7 @@ /** * */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map; import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyRecorder.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyRecorder.java index e87f9628..52bc123a 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyRecorder.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyRecorder.java @@ -1,4 +1,4 @@ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map; import org.onap.ccsdk.sli.core.sli.SvcLogicException; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyResource.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyResource.java index 2f784186..2e15f3fb 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/DummyResource.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/DummyResource.java @@ -1,7 +1,7 @@ /** * */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutorTest.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutorTest.java index 33ce6f69..474136d5 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ExecuteNodeExecutorTest.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/ExecuteNodeExecutorTest.java @@ -19,9 +19,10 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map.Entry; +import java.util.Properties; import org.onap.ccsdk.sli.core.sli.DuplicateValueException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; @@ -30,8 +31,9 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl; +import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase; import junit.framework.TestCase; @@ -53,8 +55,15 @@ public class ExecuteNodeExecutorTest extends TestCase { MockExecuteNodeExecutor execute = new MockExecuteNodeExecutor(); SvcLogicNode node = new SvcLogicNode(0, "", "", new SvcLogicGraph()); node.setAttribute("method", "selectLunch"); - SvcLogicPropertiesProvider resourceProvider = new SvcLogicPropertiesProviderImpl(); - execute.execute(new SvcLogicServiceImpl(resourceProvider), new SvcLogicNode(0, "", "", new SvcLogicGraph()), new SvcLogicContext()); + SvcLogicPropertiesProvider resourceProvider = new SvcLogicPropertiesProvider() { + + public Properties getProperties() { + return new Properties(); + }; + }; + + + execute.execute(new SvcLogicServiceImplBase(null), new SvcLogicNode(0, "", "", new SvcLogicGraph()), new SvcLogicContext()); } } diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/LunchSelectorPlugin.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/LunchSelectorPlugin.java index b86edb06..0f4cab74 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/LunchSelectorPlugin.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/LunchSelectorPlugin.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PluginTest.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java index 98e0753d..cbeb5971 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PluginTest.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/PluginTest.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.lang.reflect.Method; import java.util.HashMap; @@ -29,8 +29,8 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.SvcLogicExpressionResolver; +import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicExpressionResolver; import junit.framework.TestCase; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutorTest.java index 7c6f4ce5..115989a8 100755..100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SetNodeExecutorTest.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/SetNodeExecutorTest.java @@ -1,4 +1,4 @@ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -8,6 +8,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.onap.ccsdk.sli.core.sli.SvcLogicParser; +import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor; public class SetNodeExecutorTest { @Test diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicExpressionResolverTest.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolverTest.java index a08144ee..bf4a2622 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicExpressionResolverTest.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/SvcLogicExpressionResolverTest.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.io.BufferedReader; import java.io.InputStream; @@ -31,7 +31,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicExpression; import org.onap.ccsdk.sli.core.sli.SvcLogicExpressionFactory; import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; import org.onap.ccsdk.sli.core.sli.SvcLogicNode; -import org.onap.ccsdk.sli.core.sli.provider.SvcLogicExpressionResolver; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicExpressionResolver; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/VoidDummyPlugin.java b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/VoidDummyPlugin.java index 8c7b0d30..b2332e05 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/VoidDummyPlugin.java +++ b/sli/provider-base/src/test/java/org/onap/ccsdk/sli/core/sli/provider/base/VoidDummyPlugin.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.ccsdk.sli.core.sli.provider; +package org.onap.ccsdk.sli.core.sli.provider.base; import java.util.Map; diff --git a/sli/provider/src/test/resources/clearMultipleArrayValues.xml b/sli/provider-base/src/test/resources/clearMultipleArrayValues.xml index 8f40058f..8f40058f 100644 --- a/sli/provider/src/test/resources/clearMultipleArrayValues.xml +++ b/sli/provider-base/src/test/resources/clearMultipleArrayValues.xml diff --git a/sli/provider/src/test/resources/clearNestedSubArrayValues.xml b/sli/provider-base/src/test/resources/clearNestedSubArrayValues.xml index a80b3e56..a80b3e56 100644 --- a/sli/provider/src/test/resources/clearNestedSubArrayValues.xml +++ b/sli/provider-base/src/test/resources/clearNestedSubArrayValues.xml diff --git a/sli/provider/src/test/resources/clearSingleArrayValues.xml b/sli/provider-base/src/test/resources/clearSingleArrayValues.xml index 56781a06..56781a06 100644 --- a/sli/provider/src/test/resources/clearSingleArrayValues.xml +++ b/sli/provider-base/src/test/resources/clearSingleArrayValues.xml diff --git a/sli/provider/src/test/resources/clearSingleSubArrayValues.xml b/sli/provider-base/src/test/resources/clearSingleSubArrayValues.xml index 22f14f37..22f14f37 100644 --- a/sli/provider/src/test/resources/clearSingleSubArrayValues.xml +++ b/sli/provider-base/src/test/resources/clearSingleSubArrayValues.xml diff --git a/sli/provider/src/test/resources/clearSubArrayValues.xml b/sli/provider-base/src/test/resources/clearSubArrayValues.xml index cb25f38a..cb25f38a 100644 --- a/sli/provider/src/test/resources/clearSubArrayValues.xml +++ b/sli/provider-base/src/test/resources/clearSubArrayValues.xml diff --git a/sli/provider/src/test/resources/clearValues.xml b/sli/provider-base/src/test/resources/clearValues.xml index dc7f5c8a..dc7f5c8a 100644 --- a/sli/provider/src/test/resources/clearValues.xml +++ b/sli/provider-base/src/test/resources/clearValues.xml diff --git a/sli/provider/src/test/resources/copyValues.xml b/sli/provider-base/src/test/resources/copyValues.xml index f56f7140..f56f7140 100644 --- a/sli/provider/src/test/resources/copyValues.xml +++ b/sli/provider-base/src/test/resources/copyValues.xml diff --git a/sli/provider/src/test/resources/expression.tests b/sli/provider-base/src/test/resources/expression.tests index 848a0e7a..848a0e7a 100755..100644 --- a/sli/provider/src/test/resources/expression.tests +++ b/sli/provider-base/src/test/resources/expression.tests diff --git a/sli/provider-base/src/test/resources/simplelogger.properties b/sli/provider-base/src/test/resources/simplelogger.properties new file mode 100644 index 00000000..07ab67f7 --- /dev/null +++ b/sli/provider-base/src/test/resources/simplelogger.properties @@ -0,0 +1,22 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.slf4j.simpleLogger.defaultLogLevel=info diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml index 3bf931a7..0a090282 100755 --- a/sli/provider/pom.xml +++ b/sli/provider/pom.xml @@ -47,7 +47,12 @@ <version>${project.version}</version> <scope>compile</scope> </dependency> - + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider-base</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java index ecfe6b69..540c04ef 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactory.java @@ -24,9 +24,6 @@ package org.onap.ccsdk.sli.core.sli.provider; import java.util.HashMap; import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +53,7 @@ public class SvcLogicAdaptorFactory { return adaptorMap.get(name); } else { - SvcLogicAdaptor adaptor = (SvcLogicAdaptor) SvcLogicClassResolver.resolve(name); + SvcLogicAdaptor adaptor = (SvcLogicAdaptor) SvcLogicClassResolver.getInstance().resolve(name); if (adaptor != null) { registerAdaptor(adaptor); diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java index d2b733fc..f10976a5 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java @@ -1,5 +1,10 @@ package org.onap.ccsdk.sli.core.sli.provider; +import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor; +import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; +import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; @@ -7,35 +12,63 @@ import org.osgi.framework.ServiceReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SvcLogicClassResolver { - private static final Logger LOG = LoggerFactory.getLogger(SvcLogicClassResolver.class); +public class SvcLogicClassResolver implements SvcLogicResolver { + private static final Logger LOG = LoggerFactory.getLogger(SvcLogicClassResolver.class); + private static SvcLogicClassResolver instance = new SvcLogicClassResolver(); - public static Object resolve(String className) { + private SvcLogicClassResolver() { + } - Bundle bundle = FrameworkUtil.getBundle(SvcLogicClassResolver.class); + public static SvcLogicClassResolver getInstance() { + return instance; + } - if (bundle == null) { - // Running outside OSGi container (e.g. jUnit). Use Reflection - // to resolve class - try { - return(Class.forName(className).newInstance()); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + public Object resolve(String className) { - LOG.error("Could not resolve class "+className, e); - return null; - } + Bundle bundle = FrameworkUtil.getBundle(SvcLogicClassResolver.class); - } else { - BundleContext bctx = bundle.getBundleContext(); - ServiceReference sref = bctx.getServiceReference(className); - if (sref != null) { - return bctx.getService(sref); - } else { + if (bundle == null) { + // Running outside OSGi container (e.g. jUnit). Use Reflection + // to resolve class + try { + return (Class.forName(className).newInstance()); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { - LOG.warn("Could not find service reference object for class " + className); - return null; - } - } - } + LOG.error("Could not resolve class " + className, e); + return null; + } + + } else { + BundleContext bctx = bundle.getBundleContext(); + ServiceReference sref = bctx.getServiceReference(className); + if (sref != null) { + return bctx.getService(sref); + } else { + + LOG.warn("Could not find service reference object for class " + className); + return null; + } + } + } + + @Override + public SvcLogicResource getSvcLogicResource(String resourceName) { + return (SvcLogicResource) resolve(resourceName); + } + + @Override + public SvcLogicRecorder getSvcLogicRecorder(String recorderName) { + return (SvcLogicRecorder) resolve(recorderName); + } + + @Override + public SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName) { + return (SvcLogicJavaPlugin) resolve(pluginName); + } + + @Override + public SvcLogicAdaptor getSvcLogicAdaptor(String adaptorName) { + return SvcLogicAdaptorFactory.getInstance(adaptorName); + } } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImpl.java index a9992a09..c4680cce 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImpl.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImpl.java @@ -31,6 +31,7 @@ import java.util.Vector; import org.onap.ccsdk.sli.core.dblib.DblibConfigurationException; import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider; import org.onap.ccsdk.sli.core.utils.JREFileResolver; import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java index 3f24adff..a23594ee 100644 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java @@ -22,43 +22,15 @@ package org.onap.ccsdk.sli.core.sli.provider; import java.util.Properties; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; + import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; -import org.onap.ccsdk.sli.core.sli.SvcLogicNode; -import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -public interface SvcLogicService { +public interface SvcLogicService extends SvcLogicServiceBase { String NAME = "org.onap.ccsdk.sli.core.sli.provider.SvcLogicService"; - // public SvcLogicContext execute(SvcLogicGraph graph, SvcLogicContext ctx) throws SvcLogicException; - /** - * Check for existence of a directed graph - * @param module - module name - * @param rpc - rpc name - * @param version - version. If null, looks for active version - * @param mode - mode (sync/async) - * @return true if directed graph found, false otherwise - * @throws SvcLogicException - */ - boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException; - - /** - * Execute a directed graph - * - * @param module - module name - * @param rpc - rpc name - * @param version - version. If null, use active version - * @param mode - mode (sync/async) - * @param parms - parameters, used to set SvcLogicContext attributes - * @return final values of attributes from SvcLogicContext, as Properties - * @throws SvcLogicException - * - * - * @deprecated use execute(String module, String rpc, String version, String mode, DOMDataBroker dataBroker) instead - */ @Deprecated Properties execute(String module, String rpc, String version, String mode, Properties parms) throws SvcLogicException; @@ -76,10 +48,5 @@ public interface SvcLogicService { */ Properties execute(String module, String rpc, String version, String mode, Properties parms, DOMDataBroker domDataBroker) throws SvcLogicException; - SvcLogicStore getStore() throws SvcLogicException; - - SvcLogicContext execute(SvcLogicGraph calledGraph, SvcLogicContext ctx) throws SvcLogicException; - - SvcLogicNode executeNode(SvcLogicNode nextNode, SvcLogicContext ctx) throws SvcLogicException; } diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java index c7942563..23d703c2 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java @@ -23,20 +23,20 @@ package org.onap.ccsdk.sli.core.sli.provider; -import java.util.HashMap; -import java.util.Map; import java.util.Properties; + import org.onap.ccsdk.sli.core.dblib.DbLibService; import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.sli.ExitNodeException; import org.onap.ccsdk.sli.core.sli.MetricLogger; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore; import org.onap.ccsdk.sli.core.sli.SvcLogicException; import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; -import org.onap.ccsdk.sli.core.sli.SvcLogicNode; import org.onap.ccsdk.sli.core.sli.SvcLogicStore; import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; +import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -44,71 +44,32 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; -public class SvcLogicServiceImpl implements SvcLogicService { - - private static final Map<String, SvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, SvcLogicNodeExecutor>() { - { - put("block", new BlockNodeExecutor()); - put("call", new CallNodeExecutor()); - put("configure", new ConfigureNodeExecutor()); - put("delete", new DeleteNodeExecutor()); - put("execute", new ExecuteNodeExecutor()); - put("exists", new ExistsNodeExecutor()); - put("for", new ForNodeExecutor()); - put("get-resource", new GetResourceNodeExecutor()); - put("is-available", new IsAvailableNodeExecutor()); - put("notify", new NotifyNodeExecutor()); - put("record", new RecordNodeExecutor()); - put("release", new ReleaseNodeExecutor()); - put("reserve", new ReserveNodeExecutor()); - put("return", new ReturnNodeExecutor()); - put("save", new SaveNodeExecutor()); - put("set", new SetNodeExecutor()); - put("switch", new SwitchNodeExecutor()); - put("update", new UpdateNodeExecutor()); - put("break", new BreakNodeExecutor()); - put("while", new WhileNodeExecutor()); - put("exit", new ExitNodeExecutor()); - } - }; +public class SvcLogicServiceImpl extends SvcLogicServiceImplBase implements SvcLogicService { private static final Logger LOG = LoggerFactory.getLogger(SvcLogicServiceImpl.class); - protected HashMap<String, SvcLogicNodeExecutor> nodeExecutors = null; protected BundleContext bctx = null; - protected Properties properties; - protected SvcLogicStore store; - private static final String CURRENT_GRAPH="currentGraph"; public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider) throws SvcLogicException { + super(null); + this.resolver = SvcLogicClassResolver.getInstance(); properties = resourceProvider.getProperties(); - getStore(); + this.store = getStore(); } public SvcLogicServiceImpl(SvcLogicPropertiesProvider resourceProvider, DbLibService dbSvc) throws SvcLogicException { + super(null); + this.resolver = SvcLogicClassResolver.getInstance(); properties = resourceProvider.getProperties(); - store = new SvcLogicDblibStore(dbSvc); - } - - - protected void registerExecutors() { - - LOG.info("Entered register executors"); - for (String nodeType : BUILTIN_NODES.keySet()) { - LOG.info("SLI - registering node executor for node type " + nodeType); - registerExecutor(nodeType, BUILTIN_NODES.get(nodeType)); - } - LOG.info("Done registerExecutors"); + this.store = new SvcLogicDblibStore(dbSvc); } public void registerExecutor(ServiceReference sr) { String nodeName = (String) sr.getProperty("nodeType"); if (nodeName != null) { - - SvcLogicNodeExecutor executor; - + AbstractSvcLogicNodeExecutor executor; try { - executor = (SvcLogicNodeExecutor) bctx.getService(sr); + executor = (AbstractSvcLogicNodeExecutor) bctx.getService(sr); } catch (Exception e) { LOG.error("Cannot get service executor for {}", nodeName, e); return; @@ -117,14 +78,6 @@ public class SvcLogicServiceImpl implements SvcLogicService { } } - public void registerExecutor(String nodeName, SvcLogicNodeExecutor executor) { - if (nodeExecutors == null) { - nodeExecutors = new HashMap<>(); - } - LOG.info("SLI - registering executor for node type {}", nodeName); - nodeExecutors.put(nodeName, executor); - } - public void unregisterExecutor(ServiceReference sr) { String nodeName = (String) sr.getProperty("nodeType"); @@ -133,67 +86,6 @@ public class SvcLogicServiceImpl implements SvcLogicService { } } - public void unregisterExecutor(String nodeName) { - LOG.info("SLI - unregistering executor for node type {}", nodeName); - nodeExecutors.remove(nodeName); - } - - public SvcLogicContext execute(SvcLogicGraph graph, SvcLogicContext ctx) throws SvcLogicException { - if (nodeExecutors == null) { - registerExecutors(); - } - - // Set service name in MDC to reference current working directed graph - MDC.put(MetricLogger.SERVICE_NAME, graph.getModule() + ":" + graph.getRpc() + "/v" + graph.getVersion()); - - MDC.put(CURRENT_GRAPH, graph.toString()); - - SvcLogicNode curNode = graph.getRootNode(); - LOG.info("About to execute graph {}", graph.toString()); - try { - while (curNode != null) { - - SvcLogicNode nextNode = executeNode(curNode, ctx); - curNode = nextNode; - } - } catch (ExitNodeException e) { - LOG.debug("SvcLogicServiceImpl caught ExitNodeException"); - } - MDC.remove("nodeId"); - MDC.remove(CURRENT_GRAPH); - - return (ctx); - } - - public SvcLogicNode executeNode(SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { - if (node == null) { - return (null); - } - - LOG.info("About to execute node # {} ({})", node.getNodeId(), node.getNodeType()); - - if (LOG.isDebugEnabled()) { - LOG.debug("Executing node " + node.getNodeId() + " of " + node.getGraph().getRpc()); - } - - SvcLogicNodeExecutor executor = nodeExecutors.get(node.getNodeType()); - - if (executor != null) { - LOG.debug("Executing node executor for node type {} - {}", node.getNodeType(), - executor.getClass().getName()); - - MDC.put("nodeId", node.getNodeId() + " (" + node.getNodeType() + ")"); - return (executor.execute(this, node, ctx)); - } else { - throw new SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type"); - } - } - - @Override - public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException { - return (store.hasGraph(module, rpc, version, mode)); - } - @Override public Properties execute(String module, String rpc, String version, String mode, Properties props) throws SvcLogicException { @@ -218,12 +110,16 @@ public class SvcLogicServiceImpl implements SvcLogicService { ctx.setAttribute(CURRENT_GRAPH, graph.toString()); ctx.setAttribute("X-ECOMP-RequestID", MDC.get("X-ECOMP-RequestID")); ctx.setDomDataBroker(domDataBroker); - execute(graph, ctx); - return (ctx.toProperties()); } + + @Override + protected void resetContext() { + MetricLogger.resetContext(); + } + @Override public SvcLogicStore getStore() throws SvcLogicException { // Create and initialize SvcLogicStore object - used to access // saved service logic. @@ -246,4 +142,5 @@ public class SvcLogicServiceImpl implements SvcLogicService { return store; } + } diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ITCaseSvcLogicGraphExecutor.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ITCaseSvcLogicGraphExecutor.java index 445df36f..6d466bc7 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ITCaseSvcLogicGraphExecutor.java +++ b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/ITCaseSvcLogicGraphExecutor.java @@ -24,7 +24,6 @@ package org.onap.ccsdk.sli.core.sli.provider; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; - import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; @@ -34,27 +33,46 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Properties; + import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.ccsdk.sli.core.dblib.DBResourceManager; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; import org.onap.ccsdk.sli.core.sli.SvcLogicParser; import org.onap.ccsdk.sli.core.sli.SvcLogicStore; import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceRegistration; +import org.onap.ccsdk.sli.core.sli.provider.base.BlockNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.BreakNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.CallNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ConfigureNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.DeleteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ExistsNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ForNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.GetResourceNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.IsAvailableNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.NotifyNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.RecordNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ReleaseNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ReserveNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ReturnNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SaveNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider; +import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ITCaseSvcLogicGraphExecutor { private static final Logger LOG = LoggerFactory.getLogger(SvcLogicGraph.class); - private static final Map<String, SvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, SvcLogicNodeExecutor>() { + private static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() { { put("block", new BlockNodeExecutor()); put("break", new BreakNodeExecutor()); diff --git a/sliPluginUtils/provider/testFileName b/sliPluginUtils/provider/testFileName deleted file mode 100644 index 674e20cc..00000000 --- a/sliPluginUtils/provider/testFileName +++ /dev/null @@ -1 +0,0 @@ -####################################### diff --git a/sliapi/provider/pom.xml b/sliapi/provider/pom.xml index e6ffaa9d..efcf321c 100755 --- a/sliapi/provider/pom.xml +++ b/sliapi/provider/pom.xml @@ -62,6 +62,11 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider-base</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.opendaylight.controller</groupId> <artifactId>sal-core-api</artifactId> </dependency> diff --git a/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java b/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java index 287f2f20..96d61933 100644 --- a/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java +++ b/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java @@ -25,28 +25,28 @@ import org.junit.Test; import org.onap.ccsdk.sli.core.sli.SvcLogicParser; import org.onap.ccsdk.sli.core.sli.SvcLogicStore; import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; -import org.onap.ccsdk.sli.core.sli.provider.BlockNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.CallNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ConfigureNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.DeleteNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ExistsNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ForNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.GetResourceNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.IsAvailableNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.NotifyNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.RecordNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ReleaseNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ReserveNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.ReturnNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.SaveNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.SetNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.SvcLogicNodeExecutor; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl; import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl; -import org.onap.ccsdk.sli.core.sli.provider.SwitchNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.UpdateNodeExecutor; -import org.onap.ccsdk.sli.core.sli.provider.WhileNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.BlockNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.CallNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ConfigureNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.DeleteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ExistsNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ForNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.GetResourceNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.IsAvailableNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.NotifyNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.RecordNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ReleaseNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ReserveNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.ReturnNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SaveNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor; +import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor; 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; @@ -67,7 +67,7 @@ public class TestSliapiProvider { private static final String HEALTHCHECK_DG = "sli_healthcheck.xml"; - private static final Map<String, SvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, SvcLogicNodeExecutor>() { + private static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() { { put("block", new BlockNodeExecutor()); put("call", new CallNodeExecutor()); |