1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
20 import java.util.HashMap;
21 import java.util.List;
23 import javax.annotation.Nonnull;
24 import javax.annotation.Nullable;
26 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
27 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension;
30 * ValueNameList is an access Wrapper to NETCONF Extension lists
31 * Class is a specialized HashMap.
33 public class ValueNameList extends HashMap<String, String> {
35 private static final long serialVersionUID = 1L;
38 * Create ValueNameList for NETCONF extensions
39 * @param extensionList Parameters as received from device. Could be null.
41 public void put(@Nullable List<Extension> extensionList) {
43 if (extensionList != null) {
47 for (Extension e : extensionList) {
48 name = e.getValueName();
50 if (name != null && value != null) {
58 * Return value or null
59 * @param name key for element
60 * @return value if key exists; if not nul
62 public String getOrNull(String name) {
63 return containsKey(name) ? get(name) : null;
67 * Get element as id list
68 * @param name key of element
69 * @param topLevelEqUuidList as input to add elements
70 * @return List<UniversalId>
72 public @Nonnull List<UniversalId> getAsUniversalIdList(String name, List<UniversalId> topLevelEqUuidList) {
73 if (containsKey(name)) {
74 String[] result = get(name).split(",\\s*");
75 if (result.length > 0) {
76 for (String e : result) {
77 topLevelEqUuidList.add(new UniversalId(e));
81 return topLevelEqUuidList;