code improvements- incorporating comments
[cli.git] / framework / src / main / java / org / onap / cli / fw / utils / OnapCommandDiscoveryUtils.java
1 /*
2  * Copyright 2017 Huawei Technologies Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.cli.fw.utils;
18
19 import static org.onap.cli.fw.conf.OnapCommandConstants.ATTRIBUTES;
20 import static org.onap.cli.fw.conf.OnapCommandConstants.DEAFULT_INPUT_PARAMETERS_NAME;
21 import static org.onap.cli.fw.conf.OnapCommandConstants.DEFAULT_SCHEMA_PATH_PATERN;
22 import static org.onap.cli.fw.conf.OnapCommandConstants.DESCRIPTION;
23 import static org.onap.cli.fw.conf.OnapCommandConstants.DISCOVERY_FILE;
24 import static org.onap.cli.fw.conf.OnapCommandConstants.IS_DEFAULT_PARAM;
25 import static org.onap.cli.fw.conf.OnapCommandConstants.NAME;
26 import static org.onap.cli.fw.conf.OnapCommandConstants.OPEN_CLI_SAMPLE_VERSION;
27 import static org.onap.cli.fw.conf.OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION;
28 import static org.onap.cli.fw.conf.OnapCommandConstants.PARAMETERS;
29 import static org.onap.cli.fw.conf.OnapCommandConstants.RESULTS;
30 import static org.onap.cli.fw.conf.OnapCommandConstants.SCHEMA_DIRECTORY;
31 import static org.onap.cli.fw.conf.OnapCommandConstants.SCHEMA_PATH_PATERN;
32
33 import java.io.File;
34 import java.io.IOException;
35 import java.lang.reflect.Constructor;
36 import java.lang.reflect.InvocationTargetException;
37 import java.util.ArrayList;
38 import java.util.Arrays;
39 import java.util.HashMap;
40 import java.util.List;
41 import java.util.Map;
42 import java.util.Optional;
43 import java.util.ServiceLoader;
44
45 import org.apache.commons.io.FileUtils;
46 import org.onap.cli.fw.cmd.OnapCommand;
47 import org.onap.cli.fw.conf.OnapCommandConfig;
48 import org.onap.cli.fw.conf.OnapCommandConstants;
49 import org.onap.cli.fw.error.OnapCommandDiscoveryFailed;
50 import org.onap.cli.fw.error.OnapCommandException;
51 import org.onap.cli.fw.error.OnapCommandInstantiationFailed;
52 import org.onap.cli.fw.error.OnapCommandInvalidSample;
53 import org.onap.cli.fw.error.OnapCommandInvalidSchema;
54 import org.onap.cli.fw.error.OnapCommandNotFound;
55 import org.onap.cli.fw.schema.OnapCommandSchemaInfo;
56 import org.springframework.core.io.Resource;
57 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
58 import org.springframework.core.io.support.ResourcePatternResolver;
59 import com.esotericsoftware.yamlbeans.YamlReader;
60 import com.google.gson.Gson;
61 import com.google.gson.GsonBuilder;
62 import com.google.gson.stream.JsonReader;
63 import java.io.FileReader;
64 import java.io.Writer;
65 import java.io.FileWriter;
66 import java.io.InputStream;
67 import java.io.InputStreamReader;
68 import java.io.FileInputStream;
69
70 public class OnapCommandDiscoveryUtils {
71     private OnapCommandDiscoveryUtils() {
72         throw new IllegalStateException("Utility class");
73     }
74
75     private static Gson gson = new GsonBuilder().serializeNulls().create();
76
77     /**
78      * Fetch a particular schema details.
79      *
80      * @param cmd
81      *            command name
82      * @return ExternalSchema obj
83      * @throws OnapCommandInvalidSchema
84      *             exception
85      * @throws OnapCommandDiscoveryFailed
86      *             exception
87      */
88     public static OnapCommandSchemaInfo getSchemaInfo(String cmd, String version) throws OnapCommandException {
89         List<OnapCommandSchemaInfo> list = OnapCommandDiscoveryUtils.discoverOrLoadSchemas(false);
90         OnapCommandSchemaInfo schemaInfo = null;
91         if (list != null) { //NOSONAR
92             for (OnapCommandSchemaInfo schema : list) {
93                 if (cmd.equals(schema.getCmdName()) && version.equals(schema.getProduct())) {
94                     schemaInfo = schema;
95                     break;
96                 }
97             }
98         }
99
100         if (schemaInfo == null)
101              throw new OnapCommandNotFound(cmd, version);
102
103         return schemaInfo;
104    }
105
106     /**
107     * Load the previous discovered json file.
108      *
109      * @return list
110      * @throws OnapCommandInvalidSchema
111      *             exception
112      * @throws OnapCommandDiscoveryFailed
113      *             exception
114      */
115     public static List<OnapCommandSchemaInfo> discoverOrLoadSchemas(boolean forceRefresh) throws OnapCommandException {
116         List<OnapCommandSchemaInfo> schemas = new ArrayList<>(); //NOSONAR
117         if (forceRefresh || Boolean.parseBoolean(OnapCommandConfig.getPropertyValue(OnapCommandConstants.DISCOVER_ALWAYS))
118                 || !OnapCommandDiscoveryUtils.isAlreadyDiscovered()) {
119             schemas = OnapCommandDiscoveryUtils.discoverSchemas();
120             if (!schemas.isEmpty()) {
121                 //merge the existing RPC schema with discovered ones
122                 List<OnapCommandSchemaInfo> schemasExisting = OnapCommandDiscoveryUtils.loadSchemas();
123
124                 Map<String, OnapCommandSchemaInfo> rpcCommands = new HashMap<>();
125                 for (OnapCommandSchemaInfo info: schemasExisting) {
126                     if (info.isRpc()) {
127                         rpcCommands.put(info.getProduct() + ":" + info.getCmdName(), info);
128                     }
129                 }
130
131                 //mrkanag: Enable clustering for keeping command in more than one OCLIP engine
132                 //Remove if already an same command exists with RPC
133                 for (OnapCommandSchemaInfo info: schemas) {
134                     OnapCommandSchemaInfo infoExisting = rpcCommands.get(info.getProduct() + ":" + info.getCmdName());
135                     if (infoExisting != null) {
136                         rpcCommands.remove(info.getProduct() + ":" + info.getCmdName());
137                     }
138                 }
139
140                 //Add all RPC ones
141                 schemas.addAll(rpcCommands.values());
142
143                 OnapCommandDiscoveryUtils.persistSchemaInfo(schemas);
144             }
145         } else {
146             schemas = OnapCommandDiscoveryUtils.loadSchemas();
147         }
148
149         return schemas;
150     }
151
152     public static String getDataStorePath() {
153         return OnapCommandConfig.getPropertyValue(OnapCommandConstants.OPEN_CLI_DATA_DIR);
154     }
155
156     public static List<OnapCommandSchemaInfo> loadSchemas() throws OnapCommandException {
157         List<OnapCommandSchemaInfo> schemas = new ArrayList<>();
158
159         if (!OnapCommandDiscoveryUtils.isAlreadyDiscovered()) return schemas;
160
161         String dataDir = OnapCommandDiscoveryUtils.getDataStorePath();
162         File file = new File(dataDir + File.separator + DISCOVERY_FILE);
163         try (JsonReader jsonReader = new JsonReader(new FileReader(file))){
164             OnapCommandSchemaInfo[] list = gson.fromJson(jsonReader, OnapCommandSchemaInfo[].class);
165             schemas.addAll(Arrays.asList(list));
166         } catch (Exception e) { // NOSONAR
167             throw new OnapCommandDiscoveryFailed(dataDir,
168                     DISCOVERY_FILE, e);
169         }
170
171         return schemas;
172     }
173
174     /**
175      * Check if json file discovered or not.
176      *
177      * @return boolean
178      * @throws OnapCommandDiscoveryFailed
179      *             exception
180      */
181     public static boolean isAlreadyDiscovered() throws OnapCommandDiscoveryFailed { //NOSONAR
182         String dataDir = OnapCommandDiscoveryUtils.getDataStorePath();
183         return new File(dataDir + File.separator + DISCOVERY_FILE).exists();
184     }
185
186     /**
187      * Persist the external schema details.
188      *
189      * @param schemas
190      *            list
191      * @throws OnapCommandDiscoveryFailed
192      *             exception
193      */
194     public static void persistSchemaInfo(List<OnapCommandSchemaInfo> schemas) throws OnapCommandDiscoveryFailed {
195         if (schemas != null) {
196             String dataDir = OnapCommandDiscoveryUtils.getDataStorePath();
197
198             try {
199                 FileUtils.forceMkdir(new File(dataDir));
200
201                 File file = new File(dataDir + File.separator + DISCOVERY_FILE);
202                 try(Writer writer = new FileWriter(file)){
203                     gson.toJson(schemas,writer);
204                 }
205             } catch (Exception e1) { // NOSONAR
206                 throw new OnapCommandDiscoveryFailed(dataDir,
207                         DISCOVERY_FILE, e1);
208             }
209         }
210     }
211
212     /**
213      * Get schema map.
214      *
215      * @param resource
216      *            resource obj
217      * @return map
218      * @throws OnapCommandInvalidSchema
219      *             exception
220      */
221     public static Map<String, Object> loadSchema(Resource resource) throws OnapCommandInvalidSchema {
222         return loadYaml(resource);
223     }
224
225     /**
226      * Returns a resource available under certain directory in class-path.
227      *
228      * @param pattern
229      *            search pattern
230      * @return found resource
231      * @throws IOException
232      *             exception
233      */
234     public static Resource findResource(String fileName, String pattern) throws IOException {
235         Resource[] resources = OnapCommandDiscoveryUtils.findResources(pattern);
236         if (resources != null && resources.length > 0) { //NOSONAR
237             for (Resource res : resources) {
238                 if (res.getFilename().equals(fileName)) {
239                     return res;
240                 }
241             }
242         }
243
244         return null;
245     }
246
247     /**
248      * Returns all resources available under certain directory in class-path.
249      *
250      * @param pattern
251      *            search pattern
252      * @return resources found resources
253      * @throws IOException
254      *             exception
255      */
256     public static Resource[] findResources(String pattern) throws IOException {
257         ClassLoader cl = OnapCommandUtils.class.getClassLoader();
258         ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cl);
259         return resolver.getResources("classpath*:" + pattern);
260     }
261
262     public static String identitySchemaProfileType(Map<String, ?> schemaYamlMap) {
263
264         for (String schemeType : OnapCommandConfig.getCommaSeparatedList(OnapCommandConstants.SCHEMA_TYPES_SUPPORTED)) {
265             if (schemaYamlMap.get(schemeType) != null) {
266                 return schemeType;
267             }
268         }
269
270         return OnapCommandConstants.BASIC_SCHEMA_PROFILE;
271     }
272
273     /**
274      * Find external schema files.
275      *
276      * @return list ExternalSchema
277      * @throws OnapCommandDiscoveryFailed
278      *             exception
279      * @throws OnapCommandInvalidSchema
280      *             exception
281      */
282     public static List<OnapCommandSchemaInfo> discoverSchemas() throws OnapCommandException {
283         List<OnapCommandSchemaInfo> extSchemas = new ArrayList<>();
284         try {
285             //collect default input parameters for every profile
286             Resource[] deafultRres = findResources(DEFAULT_SCHEMA_PATH_PATERN);
287             Map <String, List<Object>> defaultInputs = new HashMap<>();
288
289             if (deafultRres != null && deafultRres.length > 0) {
290                 Map<String, ?> deafultResourceMap;
291
292                 for (Resource resource : deafultRres) {
293                     try {
294                         deafultResourceMap = loadYaml(resource);
295                     } catch (OnapCommandException e) {
296                         OnapCommandUtils.log.error("Ignores invalid schema " + resource.getURI().toString(), e);
297                         continue;
298                     }
299
300                     if (deafultResourceMap != null && deafultResourceMap.size() > 0) {
301                         //default_input_parameters_http.yaml
302                         String profileName = resource.getFilename().substring(
303                                 DEAFULT_INPUT_PARAMETERS_NAME.length() + 1,
304                                 resource.getFilename().indexOf('.'));
305                         if (deafultResourceMap.containsKey(PARAMETERS)) {
306                             List<Object> params = new ArrayList<>();
307                             for (Map<String, ?> p: (List<Map<String, ?>>) deafultResourceMap.get(PARAMETERS)) {
308                                 if (p.keySet().contains(IS_DEFAULT_PARAM) && ! (Boolean.getBoolean(String.valueOf(p.get(IS_DEFAULT_PARAM))))) {
309                                     params.add(p);
310                                 }
311                             }
312
313                             defaultInputs.put(profileName, params);
314                         }
315                     }
316                 }
317             }
318
319             Resource[] res = findResources(SCHEMA_PATH_PATERN);
320             if (res != null && res.length > 0) {
321                 for (Resource resource : res) {
322                     Map<String, ?> resourceMap;
323                     try {
324                         resourceMap = loadYaml(resource);
325                     } catch (OnapCommandException e) {
326                         OnapCommandUtils.log.error("Ignores invalid schema " + resource.getURI().toString(), e);
327                         continue;
328                     }
329
330                     if (resourceMap != null && resourceMap.size() > 0) {
331                         OnapCommandSchemaInfo schema = new OnapCommandSchemaInfo();
332
333                         schema.setSchemaURI(resource.getURI().toString());
334
335                         Object obj = resourceMap.get(OPEN_CLI_SCHEMA_VERSION);
336                         if (obj == null) {
337                             OnapCommandUtils.log.info("Invalid Schema yaml {}" + schema.getSchemaURI());
338                         }
339                         else{
340                             schema.setVersion(obj.toString());
341
342                             if (!schema.getVersion().equalsIgnoreCase(OnapCommandConstants.OPEN_CLI_SCHEMA_VERSION_VALUE_1_0)) {
343                                 OnapCommandUtils.log.info("Unsupported Schema version found {} " + schema.getSchemaURI());
344                             }
345                             else{
346
347                                 //There are schema like default input parameters and does not have command name
348                                 if (resourceMap.get(NAME) != null) {
349                                     schema.setSchemaName(resource.getFilename());
350                                     schema.setCmdName((String) resourceMap.get(NAME));
351
352                                     schema.setDescription((String) resourceMap.get(DESCRIPTION));
353
354                                     Map<String, ?> infoMap = (Map<String, ?>) resourceMap.get(OnapCommandConstants.INFO);
355                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_TYPE) != null) {
356                                         schema.setType(infoMap.get(OnapCommandConstants.INFO_TYPE).toString());
357                                     }
358
359                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_PRODUCT) != null) {
360                                         schema.setProduct(infoMap.get(OnapCommandConstants.INFO_PRODUCT).toString());
361                                     }
362
363                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_IGNORE) != null) {
364                                         schema.setIgnore(infoMap.get(OnapCommandConstants.INFO_IGNORE).toString());
365                                     }
366
367                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_STATE) != null) {
368                                         schema.setState(infoMap.get(OnapCommandConstants.INFO_STATE).toString());
369                                     }
370
371                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_SERVICE) != null) {
372                                         schema.setService(infoMap.get(OnapCommandConstants.INFO_SERVICE).toString());
373                                     }
374
375                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_AUTHOR) != null) {
376                                         schema.setAuthor(infoMap.get(OnapCommandConstants.INFO_AUTHOR).toString());
377                                     }
378
379                                     if (infoMap != null && infoMap.get(OnapCommandConstants.INFO_METADATA) != null) {
380                                         schema.setMetadata((Map<String, String>)infoMap.get(OnapCommandConstants.INFO_METADATA));
381                                     }
382
383                                     schema.setSchemaProfile(identitySchemaProfileType(resourceMap));
384
385                                     if (resourceMap.containsKey(PARAMETERS)) {
386                                        schema.setInputs((List<Object>)resourceMap.get(PARAMETERS));
387                                        if (defaultInputs.get(schema.getSchemaProfile()) != null) {
388                                           schema.getInputs().addAll(defaultInputs.get(schema.getSchemaProfile()));
389                                        }
390                                     }
391
392                                     if (resourceMap.containsKey(RESULTS)) {
393                                         schema.setOutputs((List<Object>)((Map<String, Object>)resourceMap.get(RESULTS)).get(ATTRIBUTES));
394                                      }
395
396                                      extSchemas.add(schema);
397                                 }
398                             }
399                         }
400                     }
401                 }
402             }
403         } catch (IOException e) {
404             throw new OnapCommandDiscoveryFailed(SCHEMA_DIRECTORY, e);
405         }
406
407         try {
408             Resource[] samples = findResources(OnapCommandConstants.VERIFY_SAMPLES_FILE_PATTERN);
409             for (Resource sample : samples) {
410                     updateSchemaInfoWithSample(sample, extSchemas);
411             }
412         } catch (IOException e) {
413             throw new OnapCommandDiscoveryFailed(OnapCommandConstants.VERIFY_SAMPLES_DIRECTORY, e);
414         }
415
416         return extSchemas;
417     }
418
419     private static void updateSchemaInfoWithSample(Resource sampleResourse,
420                                                       List<OnapCommandSchemaInfo> schemaInfos) throws OnapCommandInvalidSchema, IOException {
421         Map<String, ?> infoMap = loadSchema(sampleResourse);
422
423         if (infoMap == null) {
424             return;
425         }
426
427         Object sampleVersion = infoMap.get(OPEN_CLI_SAMPLE_VERSION);
428         if (sampleVersion == null) {
429             OnapCommandUtils.log.info("Invalid Sample yaml {}", sampleResourse.getURI());
430             return;
431         }
432
433         if (!sampleVersion.toString().equalsIgnoreCase(OnapCommandConstants.OPEN_CLI_SAMPLE_VERSION_VALUE_1_0)) {
434             OnapCommandUtils.log.info("Unsupported Sample version found {}", sampleResourse.getURI());
435             return;
436         }
437
438         String cmdName = (String) infoMap.get(OnapCommandConstants.VERIFY_CMD_NAME);
439         String version = (String) infoMap.get(OnapCommandConstants.VERIFY_CMD_VERSION);
440
441         Optional<OnapCommandSchemaInfo> optSchemaInfo = schemaInfos.stream()
442                 .filter(e -> e.getCmdName().equals(cmdName) && e.getProduct().equals(version))
443                 .findFirst();
444
445         if (optSchemaInfo.isPresent()) {
446             OnapCommandSchemaInfo onapCommandSchemaInfo = optSchemaInfo.get();
447             onapCommandSchemaInfo.getSampleFiles().add(sampleResourse.getFilename());
448         }
449     }
450
451     /**
452      * Discover the Oclip commands.
453      *
454      * @return list
455      */
456     public static List<Class<OnapCommand>> discoverCommandPlugins() {
457         ServiceLoader<OnapCommand> loader = ServiceLoader.load(OnapCommand.class);
458         List<Class<OnapCommand>> clss = new ArrayList<>();
459         for (OnapCommand implClass : loader) {
460             clss.add((Class<OnapCommand>) implClass.getClass());
461         }
462
463         return clss;
464     }
465
466     /**
467      * Instantiate command plugin
468      * @throws OnapCommandInstantiationFailed
469      */
470     public static OnapCommand loadCommandClass(Class <? extends OnapCommand> cls) throws OnapCommandInstantiationFailed {
471         try {
472             Constructor<?> constr = cls.getConstructor();
473             return (OnapCommand) constr.newInstance();
474         } catch (NoSuchMethodException | SecurityException | InstantiationException
475                 | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
476             throw new OnapCommandInstantiationFailed(cls.getName(), e);
477         }
478
479     }
480
481     public static List<Map<String, Object>> createTestSuite(String cmd, String version) throws OnapCommandException {
482
483         ArrayList<Map<String, Object>> testSamples = new ArrayList();
484
485
486         List<Resource> resources = new ArrayList<>();
487         OnapCommandSchemaInfo schemaInfo =  getSchemaInfo(cmd, version);
488
489         List<String> sampleFiles = new ArrayList<>();
490         if (schemaInfo != null && !schemaInfo.getSampleFiles().isEmpty()) { //NOSONAR
491             sampleFiles.addAll(schemaInfo.getSampleFiles());
492         }
493
494         for (String sampleFile : sampleFiles) {
495             try {
496                 Resource resource = OnapCommandDiscoveryUtils.findResource(sampleFile,
497                         OnapCommandConstants.VERIFY_SAMPLES_FILE_PATTERN);
498                 resources.add(resource);
499             } catch (IOException e) {
500                 throw new OnapCommandInvalidSample("Sample file does not exist : " + sampleFile , e);
501             }
502         }
503
504         for (Resource resource : resources) {
505
506             Map<String, ?> stringMap = OnapCommandDiscoveryUtils.loadYaml(resource);
507             Map<String, Map<String, String>> samples = (Map<String, Map<String, String>>) stringMap
508                     .get(OnapCommandConstants.VERIFY_SAMPLES);
509
510             for (Map.Entry<String,Map<String, String>> entry : samples.entrySet()) {
511                 String sampleId=entry.getKey();
512                 Map<String, String> sample = entry.getValue();
513
514                 List<String> inputArgs = new ArrayList<>();
515                 if (sample.get(OnapCommandConstants.VERIFY_INPUT) != null) {
516                     inputArgs.addAll(Arrays.asList(sample.get(OnapCommandConstants.VERIFY_INPUT).trim().split(" ")));
517                 }
518                 inputArgs.add(OnapCommandConstants.VERIFY_LONG_OPTION);
519
520                 HashMap<String, Object> map = new HashMap<>();
521                 map.put(OnapCommandConstants.VERIFY_INPUT, inputArgs);
522                 map.put(OnapCommandConstants.VERIFY_OUPUT, sample.get(OnapCommandConstants.VERIFY_OUPUT));
523                 map.put(OnapCommandConstants.VERIFY_MOCO, sample.get(OnapCommandConstants.VERIFY_MOCO));
524                 map.put(OnapCommandConstants.VERIFY_SAMPLE_FILE_ID, resource.getFilename());
525                 map.put(OnapCommandConstants.VERIFY_SAMPLE_ID, sampleId);
526                 testSamples.add(map);
527             }
528         }
529         return testSamples;
530     }
531
532     /**
533      * Get schema map.
534      *
535      * @param resource
536      *            resource obj
537      * @return map
538      * @throws OnapCommandInvalidSchema
539      *             exception
540      */
541     public static Map<String, Object> loadYaml(Resource resource) throws OnapCommandInvalidSchema {
542         Map<String, Object> values = null;
543         try {
544             values = loadYaml(resource.getInputStream());
545         } catch (Exception e) {
546             throw new OnapCommandInvalidSchema(resource.getFilename(), e);
547         }
548         return values;
549     }
550
551     /**
552      * Get schema map.
553      *
554      * @param filePath
555      * @return map
556      * @throws OnapCommandInvalidSchema
557      *             exception
558      */
559     public static Map<String, Object> loadYaml(String filePath) throws OnapCommandInvalidSchema {
560         Map<String, Object> values = null;
561         try {
562             values = loadYaml(new FileInputStream(new File(filePath)));
563         } catch (Exception e) {
564             throw new OnapCommandInvalidSchema(filePath, e);
565         }
566         return values;
567     }
568
569
570     /**
571      * Get schema map.
572      *
573      * @param inputStream
574      * @return map
575      * @throws OnapCommandInvalidSchema
576      *             exception
577      */
578     public static Map<String, Object> loadYaml(InputStream inputStream) throws OnapCommandInvalidSchema {
579         Map<String, Object> values = null;
580         try(InputStreamReader inputStreamReader = new InputStreamReader(inputStream);){
581             YamlReader reader = new YamlReader(inputStreamReader);
582             values = (Map<String, Object>) reader.read();
583             } catch (IOException e) {
584                 throw new OnapCommandInvalidSchema(inputStream.getClass().getName(),e.getMessage());
585             }
586         return values;
587     }
588 }
589