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
 
  29  * Class is a specialized HashMap.
 
  31 public class ValueNameList extends HashMap<String, String> {
 
  33     private static final long serialVersionUID = 1L;
 
  36      * 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
 
  57      * @param name key for element
 
  58      * @return value if key exists; if not nul
 
  60     public String getOrNull(String name) {
 
  61         return containsKey(name) ? get(name) : null;
 
  65      * Get element as id list
 
  66      * @param name key of element
 
  67      * @param topLevelEqUuidList as input to add elements
 
  68      * @return List<UniversalId>
 
  70     public  @NonNull List<UniversalId> getAsUniversalIdList(String name, List<UniversalId> topLevelEqUuidList) {
 
  71         if (containsKey(name)) {
 
  72             String[] result = get(name).split(",\\s*");
 
  73             if (result.length > 0) {
 
  74                 for (String e : result) {
 
  75                     topLevelEqUuidList.add(new UniversalId(e));
 
  79         return topLevelEqUuidList;