Configuring UI persistent cache

This feature improves the UI Service startup time and implements a persistent cache for Resource types and Resource properties.

Overview

Update common ConfigMap

Perform these steps in both Kubernetes and OpenShift® Container Platform environments.

  1. Make sure that you are in noi project.
  2. Go to Workloads > ConfigMaps > common.
  3. Click the YAML tab.
  4. Add the following parameter to cache the needed Resource properties in the data section:
    cache.inventory.resourceProperties: '[accessIpAddress,ifName,ifSpeed]'
  5. Add the following parameter to cache the needed Resource types in the data section:
    cache.inventory.rootResourcesToCache: '[lac,gtpPeerEntityName]'
  6. Save the changes and restart the UI Service.
    Note: All the Resource types that are added and their immediate children are cached. All the Resource properties that are added and their associated Resource types are cached.
  1. Make sure that you are in tncp project.
  2. Go to Config and Storage > Config Maps > common.
  3. Click the Edit resource (Edit resource icon) icon.
  4. Add the following parameter to cache the needed Resource properties in the data section:
    cache.inventory.resourceProperties: '[accessIpAddress,ifName,ifSpeed]'
  5. Add the following parameter to cache the needed Resource types in the data section:
    cache.inventory.rootResourcesToCache: '[lac,gtpPeerEntityName]'
  6. Click Update.
  7. Restart the UI Service.

Optional: On-demand caching with REST API

If you do not want to restart the UI Service that is needed after you update the common Config Map, use the following REST API commands instead. Cache for the added Resource properties and types persists but these additions are not updated in the common Config Map.
Note: Recommend to update the common Config Map instead of using the REST API.
  1. Make sure that you are in noi or tncp project.
  2. Go to Workloads > Pods > ui-0.
  3. Click the Terminal tab.
  4. Click Exec into pod (Exec into pod icon) icon
  5. Run the following commands:
    • Get the authentication cookie with the following command:
      curl -k --cookie-jar cookies.txt "https://<ui-instance>:30021/core/login?username=<npiadmin>&password=<npiadmin>"
    • Load the Resource properties to be cached with the following command:
      curl --cookie cookies.txt -k "https://<ui-instance>:30021/service/cache/load?resourceProperties=ifOperStatus,ifAdminStatus"
      {"types":[],
                "props":["ifOperStatus","ifAdminStatus"],
                "msg":"Cache config rootResourcesToCache and resourceProperties updated. Updated config will pickup by next cache syncup.
                  If there are more ui instances, then apply the same to other instances to ensure all instances are in sync.
                  Recommendation - Update rootResourcesToCache and resourceProperties in  common config to avoid losing them on the ui service restart."}
    • Unload or remove the Resource properties to be cached with the following command:
      curl --cookie cookies.txt -k "https://<ui-instance>:30021/service/cache/unload?resourceProperties=ifOperStatus,ifAdminStatus"
      {"types":[],
                "props":["ifOperStatus","ifAdminStatus"],
                "msg":"Unloading just applicale for externally loaded types and properties via rest only. Updated config will pickup by next cache syncup.
                If there are more ui instances, then apply the same to other instances to ensure all instances are in sync.
                Recommendation - Update rootResourcesToCache and resourceProperties in  common config to avoid losing them on the ui service restart."}
    • Load the Resource types to be cached with the following command:
      curl --cookie cookies.txt -k "https://<ui-instance>:30021/service/cache/load?rootResourcesToCache=lac,gtpPeerEntityName"
      {"types":["lac","gtpPeerEntityName"],
                "props":[],
                "msg":"Cache config rootResourcesToCache and resourceProperties updated. Updated config will pickup by next cache syncup.
                  If there are more ui instances, then apply the same to other instances to ensure all instances are in sync.
                  Recommendation - Update rootResourcesToCache and resourceProperties in  common config to avoid losing them on the ui service restart."}
    • Unload or remove the Resource types to be cached with the following command:
      curl --cookie cookies.txt -k "https://<ui-instance>:30021/service/cache/unload?rootResourcesToCache=lac,gtpPeerEntityName"
      {"types":["lac"],
                "props":[],
                "msg":"Unloading just applicale for externally loaded types and properties via rest only. Updated config will pickup by next cache syncup.
                If there are more ui instances, then apply the same to other instances to ensure all instances are in sync.
                Recommendation - Update rootResourcesToCache and resourceProperties in  common config to avoid losing them on the ui service restart."}
    • List the all the Resource types and Resource properties added with the following command:
      curl --cookie cookies.txt -k "https://<ui-instance>:30021/service/cache/getConfig"
      {"syncupTime":"1714223818055",
                "status":"LOADED",
                "types":"channel,radioSlot,powerSupply,ResourcesGroup,ssid,interface,temperature,ap,opticalPort,fan,chassis,snmpAgent,cpu,pool,cfmTest,wirelessController,card,probe,device,memory",
                "properties":"displayName,npiParentEntityId,targetAddress,ifIndex,parent,namespace_name,typeTest,node_name,remoteContext,npiIfIdIn,outFlowEnabled,state,npiIfIdOut,tenant,phase,scope,ifDescr,apIpAddress,shortDisplayName,node_is_ready,nativeType,wlanAdminStatus,itnmEntityId,id,apLocation,wlanQos,inFlowEnabled,apAdminStatus,sourceAddress,loadBalancingAlgorithm,ifName,type,vendor,npiEntityId,cluster_id,parentId,vsIpAddress,index,isNetflow",
                "partialLoaded":"",
                "ondemandtypes":"",
                "ondemandproperties":"ifOperStatus,ifAdminStatus"
                }"
  6. To update a specific property to be added or deleted from cache. For example, enDevType, displayName, ifName properties are removed from cache if the reset flag is set to false. These resource types but not the resources are removed from the loaded cache config and update them again. If the reset flag is false, then load_types list from the API are added to the existing configuration and the cache is updated with these resources.
    curl --cookie cookies.txt -k "https://ui-instance:30021/service/cache/updateConfig?configName=LOADED_PROPERTIES&properties=enDevType&reset=true"

    Update multiple properties as a comma-separated list.

    curl --cookie cookies.txt -k "https://ui-instance:30021/service/cache/updateConfig?configName=LOADED_PROPERTIES&properties=displayName,vendor&reset=true"
    {
      "properties": "displayName,npiParentEntityId,targetAddress,ifIndex,parent,namespace_name,typeTest,node_name,remoteContext,npiIfIdIn,outFlowEnabled,state,npiIfIdOut,tenant,phase,scope,ifDescr,apIpAddress,shortDisplayName,ifSpeed,queueId,node_is_ready,nativeType,wlanAdminStatus,itnmEntityId,id,apLocation,wlanQos,inFlowEnabled,apAdminStatus,sourceAddress,loadBalancingAlgorithm,ifName,type,vendor,start,npiEntityId,cluster_id,parentId,vsIpAddress,index,isNetflow"
    }
  7. To update a specific resource types to be added or deleted from cache. For example, device, interface, DU, and GNB resource types are removed from cache if the reset flag is set to false. These resource types but not the resources are removed from the loaded cache config and update them again. If the reset flag is false, then load_properties list from the API are added to the existing configuration and the cache is updated with these properties.
    curl --cookie cookies.txt -k "https://ui-instance:30021/service/cache/updateConfig?configName=LOADED_TYPES&type=device&reset=true"
    {
      "types": "powerSupply,ResourcesGroup,interface,temperature,fan,chassis,snmpAgent,cpu,pool,cfmTest,card,probe,device,memory"
    }

    Update multiple resource types as a comma-separated list.

    curl --cookie cookies.txt -k "https://ui-instance:30021/service/cache/updateConfig?configName=LOADED_TYPES&type=device,interface,DU,GNB&reset=true"