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==========================================================================
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.equipment;
20 import java.util.HashMap;
21 import java.util.List;
22 import org.eclipse.jdt.annotation.NonNull;
23 import org.eclipse.jdt.annotation.Nullable;
24 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
25 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.extension.g.Extension;
28 * ValueNameList is an access Wrapper to NETCONF Extension lists Class is a specialized HashMap.
30 public class ValueNameList extends HashMap<String, String> {
32 private static final long serialVersionUID = 1L;
35 * Create ValueNameList for NETCONF extensions
37 * @param extensionList Parameters as received from device. Could be null.
39 public void put(@Nullable List<Extension> extensionList) {
41 if (extensionList != null) {
45 for (Extension e : extensionList) {
46 name = e.getValueName();
48 if (name != null && value != null) {
56 * Return value or null
58 * @param name key for element
59 * @return value if key exists; if not nul
61 public String getOrNull(String name) {
62 return containsKey(name) ? get(name) : null;
66 * 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;