Skip to end of metadata
Go to start of metadata


Create your first Component. This wiki page serves as a helpful reference and source for creating a New Test Component and Register it with CR. We will take the example of Raspberry Pi device as reference to demonstrate the involved steps.

System Requirements

  • Raspberry Pi device
    Exercise will be executed on the Raspberry Pi device. A Raspberry Pi 2 or 3 device can function as a basic router through which a connected CPE device can access the admin portal and surf the Internet.
  • Source Code
    Sample component named "CcspTestComponent" is provided as part of this exercise

Data Model

In RDK-B, TR-181 data model is used for interacting with the CPE (Customer Premises Equipment). These data models contain objects and parameters that describe functions and capabilities available to devices, that are manageable via CWMP (Eg: SNMP, TR069). Each component has its own data model.

Data Model - Code Snippet
<dataModelInfo>
  <objects>
    <object>
      <name>TestComponent</name>
      <objectType>object</objectType>
      <functions>
        <func_GetParamUlongValue>TestComponent_GetParamUlongValue</func_GetParamUlongValue>
        <func_SetParamUlongValue>TestComponent_SetParamUlongValue</func_SetParamUlongValue>
      </functions>
      <parameters>
        <parameter>
          <name>TestSampleParamUlong</name>
          <type>unsignedInt</type>
          <syntax>uint32</syntax>
          <writable>true</writable>
        </parameter>
      </parameters>
    </object>
 </objects>
</dataModelInfo>

  • objects – Data Model can have multiple objects
    name  -  Name of the object ( Here, TestComponent)
    functions - Callback APIs to Get/Set Parameters of TestComponent object
    • TestComponent_GetParamUlongValue
    • TestComponent_SetParamUlongValue
  • parameters - Attributes of Parameter
    • name – Name of the Parameter (TestSampleParamUlong)
    • type – Type of the Parameter (unsignedInt)
    • syntax – Syntax representation of the parameter type (uint32)
    • writable – Read/Write access of the parameter (true - rw access)

Test Component API List

API NameDescription
  • TestComponent_GetParamUlongValue
 API is used to retrieve the parameter value of type “unsignedInt”
  • TestComponent_SetParamUlongValue
API is used to set the parameter value of type “unsignedInt”
  • TestComponent_GetParamStringValue 
API is used to retrieve the parameter value of type “string”
  • TestComponent_SetParamStringValue   
API is used to set the parameter value of type “string”
  • TestComponent_Commit                       
To Commit all the update to the data model

Build RDK-B Image for Raspberry Pi device

  1. mkdir <workspace dir>
    cd <workspace dir>
  2. repo init -u https://code.rdkcentral.com/r/manifests -m rdkb-raspberrypi.xml -b morty
  3. repo sync
  4. source meta-cmf-raspberrypi/setup-environment
  5. Select option raspberrypi-rdk-broadband.conf
  6. bitbake rdk-generic-broadband-image

Build ccsp-testcomponent for Raspberry Pi device

  1. Put the ccsp-testcomponent.bb recipe file inside meta-rdk-broadband/recipes-ccsp/ccsp  location.
  2.  Create folder names "files" under  "meta-rdk-broadband/recipes-ccsp/ccsp" path
  3. Put CcspTestComponent.tar.gz (source code of TestComponent) file inside meta-rdk-broadband/recipes-ccsp/ccsp/files   location.
  4. Build the test component inside build directory i.e. build-raspberrypi-rdk-broadband directory.
    bitbake ccsp-testcomponent
  5. Binary file of test component will be present inside build-raspberrypi-rdk-broadband/tmp/work/cortexa7hf-neon-vfpv4-rdk-linux-gnueabi/ccsp-testcomponent/1.0-r0/image/usr/bin/ location
  6. XML file of test component will be present inside 
    build-raspberrypi-rdk-broadband/tmp/work/cortexa7t2hf-neon-vfpv4-rdk-linux-gnueabi/ccsp-testcomponent/1.0-r0/image/usr/ccsp/testcomponent/ location.

NOTE : For rpi4 , yocto 3.1 use ccsp_testcomponent.zip to avoid build errors due to cfg directory missing

Run the Test Component

Copy the supported files to Raspberry Pi device

Copy test_component (Binary of ccsp-testcomponent, generated in step 4 of Build) and TestComponent.xml (present at location mentioned in step 5 of Build) to /tmp/ directory of Raspberry Pi device.

Execute the TestComponent in the Raspberry Pi device

Go to /tmp/ directory of Raspberry Pi 3 and start the ccsp-testcomponent
./test_component -subsys eRT.

You can check the status of the process by doing  ps in the RPi device.

Validate if component is registered with CR

DMCLI (Database Manager Command Line Interface) provides interface used to send and receive command/messages via CLI (Command Line Interface) over Telnet and SSH protocols.

List all the test component parameters using dmcli:

dmcli eRT getv Device.TestComponent.

Expected Output:
CR component name is: eRT.com.cisco.spvtg.ccsp.CR
subsystem_prefix eRT.
getv from/to component(eRT.com.cisco.spvtg.ccsp.testcomponent): Device.TestComponent.
Execution succeed.
Parameter    1 name: Device.TestComponent.TestSampleParamUlong
               type:       uint,    value: 1

Change the "TestSampleParamUlong" parameter value by using below command:

dmcli eRT setv Device.TestComponent.TestSampleParamUlong uint 5

Now verify the value by this command

dmcli eRT getv Device.TestComponent.TestSampleParamUlong


Include Newly Added Component in Package Group

Once the validation is successfully done and we can now include the new component (ccsp-testcomponent) in the package groups.

  1.  Open "packagegroup-rdk-ccsp-broadband.bb" file present at "meta-rdk/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bb" location.
  2. In the "RDEPENDS_packagegroup-rdk-ccsp-broadband" flag add the name of new component.
  • No labels

30 Comments

  1. Is it possible to run the TestComponent in the Emulator?

    1. I have copied the files to
      Recipe: /home/rdkb/emulator/meta-rdk-broadband/recipes-ccsp/ccsp
      File: /home/rdkb/emulator/meta-rdk-broadband/recipes-ccsp/ccsp/files
    2. Built using bitbake ccsp-testcomponent
    3. Copied the binaries to emulator
      scp ./tmp/work/i586-rdk-linux/ccsp-testcomponent/1.0-r0/package/usr/bin/test_component root@192.168.15.13:/
      scp ./tmp/work/i586-rdk-linux/ccsp-testcomponent/1.0-r0/package/usr/bin/TestComponent.xml root@192.168.15.13:/
    4. Run the executable in Emulator
      root@qemux86broadband-dev:/# ./test_component -subsys simu
      root@qemux86broadband-dev:/# Conf file /etc/debug.ini open success
      rdk_logger_init /etc/debug.ini Already Stack Level Logging processed... not processing again.
      root@qemux86broadband-dev:/# ps -aux | grep test*
      root 12321 0.0 0.1 35948 4112 ? Ssl 22:10 0:00 ./test_component -subsys simu
      root 13136 0.0 0.0 1756 380 pts/0 S+ 22:11 0:00 grep test_component
    5. But,
      root@qemux86broadband-dev:/# dmcli simu getv Device.TestComponent.
      CR component name is: com.cisco.spvtg.ccsp.CR
      subsystem_prefix
      Can't find destination component.

    Am I missing anything? Thank you in advance!

    1. Hi Z-Thiago Navarro

      The test component is verified for Raspberry Pi only and not for Emulator, though it should be working in emulator build too. We will try it in an emulator build and let you know

      1. It worked! I have looked at the source code (ssp_main.c) of the TestComponent and I noticed that the subSys variable is set to NULL. Besides, I noticed the code snippet below:

        if(g_Subsystem[0] != 0) {
        _ansc_sprintf(CName, "%s%s", g_Subsystem, CCSP_COMPONENT_ID_TESTCOMPONENT);
        } else {
        _ansc_sprintf(CName, "%s", CCSP_COMPONENT_ID_TESTCOMPONENT);
        }

        ssp_Mbi_MessageBusEngage(CName, CCSP_MSG_BUS_CFG, CCSP_COMPONENT_PATH_TESTCOMPONENT)

        So, I tried to execute the test_component passing without the -subsys argument (./test_component) in order to pass in the else code, because g_Subsystem[0] would be 0.

        Does it make sense? Thank you in advance.

        1. Hi Z-Thiago Navarro Glad to know that it worked for you. Yes, the starting command in the document is mentioned specific to Raspberry Pi environment, so it might not be the direct one for emulator

  2. Hi 

    I followed the above mentioned steps, but i am getting some Fetch Error. The link mentioned in failure "code.rdkcentral.com/r/devices/raspberrypi/fwupgrade-lib" seems to be not found. Is this the issue.


    ERROR: /home/Saran/RDKB/meta-cmf-raspberrypi/recipes-oem/fwupgrade-lib/fwupgrade-lib.bb: Error executing a python function in <code>:

    The stack trace of python calls that resulted in this exception/failure was:
    File: '<code>', lineno: 4, function: <module>
         0001:__anon_25__home_Saran_RDKB_openembedded_core_meta_conf_machine_include_arm_feature_arm_thumb_inc(d)
         0002:__anon_145__home_Saran_RDKB_openembedded_core_meta_classes_base_bbclass(d)
         0003:__anon_656__home_Saran_RDKB_openembedded_core_meta_classes_base_bbclass(d)
     *** 0004:__anon_119__home_Saran_RDKB_openembedded_core_meta_classes_externalsrc_bbclass(d)
         0005:__anon_1318__home_Saran_RDKB_openembedded_core_meta_classes_insane_bbclass(d)
         0006:__anon_242__home_Saran_RDKB_openembedded_core_meta_classes_package_bbclass(d)
         0007:__anon_284__home_Saran_RDKB_openembedded_core_meta_classes_package_ipk_bbclass(d)
         0008:__anon_25__home_Saran_RDKB_openembedded_core_meta_classes_debian_bbclass(d)
    File: '/home/Saran/RDKB/openembedded-core/meta/classes/externalsrc.bbclass', lineno: 59, function: __anon_119__home_Saran_RDKB_openembedded_core_meta_classes_externalsrc_bbclass
         0055:            d.setVar('B', '${WORKDIR}/${BPN}-${PV}/')
         0056:
         0057:        local_srcuri = []
         0058:        fetch = bb.fetch2.Fetch((d.getVar('SRC_URI', True) or '').split(), d)
     *** 0059:        for url in fetch.urls:
         0060:            url_data = fetch.ud[url]
         0061:            parm = url_data.parm
         0062:            if (url_data.type == 'file' or
         0063:                    'type' in parm and parm['type'] == 'kmeta'):
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/__init__.py', lineno: 1550, function: __init__
         1546:
         1547:        for url in urls:
         1548:            if url not in self.ud:
         1549:                try:
     *** 1550:                    self.ud[url] = FetchData(url, d, localonly)
         1551:                except NonLocalMethod:
         1552:                    if localonly:
         1553:                        self.ud[url] = None
         1554:                        pass
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/__init__.py', lineno: 1229, function: __init__
         1225:            logger.warning('Consider updating %s recipe to use "protocol" not "proto" in SRC_URI.', d.getVar('PN', True))
         1226:            self.parm["protocol"] = self.parm.get("proto", None)
         1227:
         1228:        if hasattr(self.method, "urldata_init"):
     *** 1229:            self.method.urldata_init(self, d)
         1230:
         1231:        if "localpath" in self.parm:
         1232:            # if user sets localpath for file, use it instead.
         1233:            self.localpath = self.parm["localpath"]
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/git.py', lineno: 189, function: urldata_init
         0185:        ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git -c core.fsyncobjectfiles=0"
         0186:
         0187:        ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0") or ud.rebaseable
         0188:
     *** 0189:        ud.setup_revisons(d)
         0190:
         0191:        for name in ud.names:
         0192:            # Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
         0193:            if not ud.revisions[name] or len(ud.revisions[name]) != 40  or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/__init__.py', lineno: 1259, function: setup_revisons
         1255:
         1256:    def setup_revisons(self, d):
         1257:        self.revisions = {}
         1258:        for name in self.names:
     *** 1259:            self.revisions[name] = srcrev_internal_helper(self, d, name)
         1260:
         1261:        # add compatibility code for non name specified case
         1262:        if len(self.names) == 1:
         1263:            self.revision = self.revisions[self.names[0]]
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/__init__.py', lineno: 1124, function: srcrev_internal_helper
         1120:
         1121:    if srcrev == "INVALID" or not srcrev:
         1122:        raise FetchError("Please set a valid SRCREV for url %s (possible key names are %s, or use a ;rev=X URL parameter)" % (str(attempts), ud.url), ud.url)
         1123:    if srcrev == "AUTOINC":
     *** 1124:        srcrev = ud.method.latest_revision(ud, d, name)
         1125:
         1126:    return srcrev
         1127:
         1128:def get_checksum_file_list(d):
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/__init__.py', lineno: 1519, function: latest_revision
         1515:        key = self.generate_revision_key(ud, d, name)
         1516:        try:
         1517:            return revs[key]
         1518:        except KeyError:
     *** 1519:            revs[key] = rev = self._latest_revision(ud, d, name)
         1520:            return rev
         1521:
         1522:    def sortable_revision(self, ud, d, name):
         1523:        latest_rev = self._build_revision(ud, d, name)
    File: '/home/Saran/RDKB/openembedded-core/bitbake/lib/bb/fetch2/git.py', lineno: 411, function: _latest_revision
         0407:                sha1, ref = l.split()
         0408:                if s == ref:
         0409:                    return sha1
         0410:        raise bb.fetch2.FetchError("Unable to resolve '%s' in upstream git repository in git ls-remote output for %s" % \
     *** 0411:            (ud.unresolvedrev[name], ud.host+ud.path))
         0412:
         0413:    def latest_versionstring(self, ud, d):
         0414:        """
         0415:        Compute the latest release name like "x.y.x" in "x.y.x+gitHASH"
    Exception: bb.fetch2.FetchError: Fetcher failure: Unable to resolve 'rdkb-2020q4' in upstream git repository in git ls-remote output for code.rdkcentral.com/r/devices/raspberrypi/fwupgrade-lib

    ERROR: Failed to parse recipe: /home/Saran/RDKB/meta-cmf-raspberrypi/recipes-oem/fwupgrade-lib/fwupgrade-lib.bb


  3. Hi Saran,   

    This fetch issue can be fixed by masking the recipe. Could you use latest dunfell rdkb release (rdkb-2021q1-dunfell), where you won't see this issue.

    Else, you can add below line in  /meta-cmf-raspberrypi/conf/include/rdk-bbmasks-rdkb-platform.inc  file to MASK the recipe.

    BBMASK .= "|meta-cmf-raspberrypi/recipes-oem/fwupgrade-lib/"


    The file for your reference from rdkb-2021q1-dunfell release -

    https://code.rdkcentral.com/r/plugins/gitiles/components/generic/rdk-oe/meta-cmf-raspberrypi/+/rdkb-2021q1-dunfell/conf/include/rdk-bbmasks-rdkb-platform.inc

  4. Hi, 

    I have tried build ccsp-testcomponent for Raspberry Pi 4 device. I am using  RDK-B R-Pi Yocto 3.1 - Dunfell.

    I have faced with compilation error:

    /usr/share/aclocal/ --force
    | aclocal: error: couldn't open directory 'cfg': No such file or directory
    | autoreconf: aclocal failed with exit status: 1
    | WARNING: exit code 1 from a shell command.

    ERROR: Task (/home/oleksandr/WORKING_DIRECTORY/RDK/Yocto/meta-cmf-broadband/recipes-ccsp/ccsp/ccsp-testcomponent.bb:do_configure) failed with exit code '1'
    NOTE: Tasks Summary: Attempted 1685 tasks of which 1679 didn't need to be rerun and 1 failed.


    I have fixed bugs in the example and now it work fine. 

    Where can I attach tar archive ?


    1. Hi Oleksandr Ponomarenko ,

      Please share the changes to supprot@rdkcentral.com . You can also attach it in your comment .

      Yogomaya Maharana  please share the ticket to me .

      Regards,
      Priyankaa KVB

  5. Hi, 

    Priyankaa K V B Please share the changes to supprot@rdkcentral.com . You can also attach it in your comment .

    look like I do not have right to attach the archive.

    I have shared the archive to support@rdkcentral.com


    Regards,

    1. Hi Oleksandr Ponomarenko ,

      Ok thanks for sharing . We will check it

      Yogomaya Maharana 

      Please check and share the ticket details

      Regards,
      Priyankaa KVB

  6. Hi,
    Don't know if it is the right place but is there a way to get some details/explanations on the following API and how to use custom events
     - CcspBaseIf_Register_Event

    Regards,

    1. Hi Gilles Printemps ,

      All CCSP components extend from a Base CCSP Component that defines the core methods common to all CCSP components.The base interface defines core APIs that are common to all CCSP components.More information on this is available at https://wiki.rdkcentral.com/display/RDK/CCSP+High+Level+Architecture.

      CcspBaseIf_Register_Event Api is used to register events to Component Registrar (CR)  via the message bus(dbus) .


      The code implementation for the same is present in

      Header file →https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspCommonLibrary/+blame/refs/heads/rdk-next/source/ccsp/include/ccsp_base_api.h

      C source file -->https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspCommonLibrary/+blame/refs/heads/rdk-next/source/util_api/ccsp_msg_bus/ccsp_base_api.c( line 5464 )

      The sample implementation in CcspWifiAgent in file https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspWifiAgent/+/refs/heads/rdk-next/source/WifiSsp/ssp_messagebus_interface.c is as below :

      /* Register event/signal */
          returnStatus = 
              CcspBaseIf_Register_Event
                  (
                      bus_handle,
                      0,
                      "currentSessionIDSignal"
                  );


      Regards

      Karthika

      1. Thanks Karthika for your answer but it didn't explain why do we have to register this event ("currentSessionIDSignal").
        Indeed, it seems all CCSP plugins are calling this function with the same event.

        _ How is it used internally?
        _ How is this event used?
        _ When is DBus/RBus receiving it?
        _ What's happening if this event is not registered?

        Regards,
        Gilles 

        1. Hi Gilles Printemps ,

          Please find the answers below:

          _ How is it used internally?


          There are multiple events/signals that use the above api CcspBaseIf_Register_Event like "systemReadySignal" ,"deviceProfileChangeSignal" ,"requestSessionID" etc..
          The api CcspBaseIf_Register_Event allows a client to indicate its interest in receiving a particular event. If the interest is registered using this API, then the callback registered using CcspBaseIf_SetCallback() API will be called when the server sends the event. Otherwise, the callback will not be called.
          Sample snippets from component CcspTr069Pa as below:

          /* set callback function on Message Bus to handle systemReadySignal */
          if ( sysReadySignalCB )
          {
          CcspBaseIf_Register_Event(hMBusHandle, NULL, "systemReadySignal");


          CcspBaseIf_SetCallback2
          (
          hMBusHandle,
          "systemReadySignal",
          sysReadySignalCB,
          (void*)cbContext
          );
          }


          /* set callback function on Message Bus to handle diagCompleteSignal */
          if ( diagCompleteSignalCB )
          {
          CcspBaseIf_Register_Event(hMBusHandle, NULL, "diagCompleteSignal");


          CcspBaseIf_SetCallback2
          (
          hMBusHandle,
          "diagCompleteSignal",
          diagCompleteSignalCB,
          (void*)cbContext
          );
          }


          _ How is this event used?


          The event "currentSessionIDSignal" returns the current session ID and its associated priority. See below:


          " <signal name=\"currentSessionIDSignal\">\n"
          " <arg type=\"i\" name=\"priority\" direction=\"out\"/>\n"
          " <arg type=\"i\" name=\"sessionID\" direction=\"out\"/>\n"
          " </signal>\n"


          _ When is DBus/RBus receiving it?

          The Ccsp components register events with CR via the message bus after message bus intialization and it has successfully registered path for the component. See sample log from CRlog.txt.0



          200729-16:49:39.300637 [mod=CR, lvl=WARN] [tid=3386] CR Name: com.cisco.spvtg.ccsp.CR
          200729-16:49:39.302447 [mod=CR, lvl=INFO] [tid=3386] connection opened for eRT.com.cisco.spvtg.ccsp.CR
          200729-16:49:39.302844 [mod=CR, lvl=INFO] [tid=3386] Registered object eRT.com.cisco.spvtg.ccsp.CR
          200729-16:49:39.303059 [mod=CR, lvl=INFO] [tid=3386] Registered event eRT.com.cisco.spvtg.ccsp.CR::systemReadySignal.
          200729-16:49:39.303162 [mod=CR, lvl=INFO] [tid=3386] Adding handler for subscription requests for eRT.com.cisco.spvtg.ccsp.CR.
          200729-16:49:39.303267 [mod=CR, lvl=INFO] [tid=3386] Successfully registered method _subscribe with object eRT.com.cisco.spvtg.ccsp.CR
          200729-16:49:39.303327 [mod=CR, lvl=INFO] [tid=3386] Successfully registered method _unsubscribe with object eRT.com.cisco.spvtg.ccsp.CR
          200729-16:49:39.303409 [mod=CR, lvl=INFO] [tid=3386] Successfully registered subscription handlers for eRT.com.cisco.spvtg.ccsp.CR.
          200729-16:49:39.303470 [mod=CR, lvl=INFO] [tid=3386] Registered event eRT.com.cisco.spvtg.ccsp.CR::currentSessionIDSignal.
          200729-16:49:39.303524 [mod=CR, lvl=INFO] [tid=3386] Registered event eRT.com.cisco.spvtg.ccsp.CR::deviceProfileChangeSignal.



          _ What's happening if this event is not registered?


          If any particular event is not registered properly ,then you will receive an Error in logs with a corresponding exit code .


          CcspTraceError((" !!! CCSP_Message_Bus_Register_Event: CurrentSessionIDSignal ERROR returnStatus: %d!!!\n", returnStatus));


          Regards

          Karthika

          1. Thanks a lot Karthika A B .

            It is more clear now with your explanation. Just only 2 additional points:
              - When I asked "What's happening if this event is not registered", I was not talking about the case where the event was not registered correctly but if we are not registering it. is it really mandatory to register it?

              - Is there a way to define/registered custom events? if yes, can you provide an example?


            Thanks again for your answers

            1. Hi Gilles Printemps ,

              The event currentSessionIDSignal returns the sessionID of the component which is used internally by other events/methods like SetParameterValues,AddTblRow etc..There are checks in code as below to match the sessionID:


              if ( (sessionId != 0) && (sessionId != g_currentSessionID) )
                  {
                      AnscTraceWarning(("!!! SetParameterValues discarded, session id is NOT match !!!\n"));
                      return ANSC_STATUS_DISCARD;
                  }


              So if we dont register for the above event we might see corresponding failures from other events that use the above event .You can refer the CcspCommonLibrary source code in the below link: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspCommonLibrary/+/refs/heads/rdk-next


               - Is there a way to define/registered custom events? if yes, can you provide an example?

              Yes ,we can register custom events. Please refer the below checkin as an example to understand how to define/register custom events:
              https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspCommonLibrary/+/6b9d702bfbe6d896fcda4bbf2f2922a34cff2b29


              Regards

              Karthika

              1. Thanks again for your explanation

  7. Hi,
    I'm studying the provided example and I have some questions:

    In the main file, "pComponentName" is defined as extern char *.
    It is used but the Cdm_Init function as follows:
       Cdm_Init(bus_handle, subSys, NULL, NULL, pComponentName);

    _ Where is this global variable defined?
    _ Why is it defined as global? Does it mean it is used internally by some others functions?
    _ What will happen if we are providing this parameter without going through this variable?

    Regards,

    1. In the same way, 2 additional global variables are defined as external too:
        - g_SubSysPrefix_Irep
        - g_MessageBusHandle_Irep

      I have exactly the same questions for these 2 ones. Any inputs/clarifications?

      Regards,

  8. EDIT: This was a rabbit hole and a half (lots of fun). What ultimately worked for me was uncommenting the systemd parts of the recipe and enabling the unit file on first boot. The TestComponent only registered on startup as a system service despite otherwise functioning normally when started manually.

    Quick question on using the emulator build as described here.

    I am able to see the test_component process running (after manually starting) but unlike the emulator thread above I am not able to find the component with dmcli for any subsystem regardless if I use or skip the -subsys switch on test_component binary.

    Has the component registration process changed at all since the emulator build I linked to was published?

    1. Hi Max Lajauskas ,

      On top of the emulator build after doing the steps specified here Buildccsp-testcomponentforRaspberryPidevice ,you can copy the binary and xml specified in step 5 and step 6 to /tmp of your emulator .

      You can then start the binary manually using the command from /tmp  : ./test_component

      After the above steps the binary will be executed and you can check the same using ps command and also check dmcli  get and set operations.

      See below:

      root@qemux86broadband-morty:/# ps -aux | grep "test"
      root       299  0.0  0.8  37284  4148 ?        Ssl  13:01   0:00 /usr/bin/test_component
      root      2070  0.0  0.0   1756   352 pts/0    S+   13:02   0:00 grep test


      root@qemux86broadband-morty:/# dmcli simu getv Device.TestComponent.
      CR component name is: com.cisco.spvtg.ccsp.CR
      subsystem_prefix
      getv from/to component(com.cisco.spvtg.ccsp.testcomponent): Device.TestComponent.
      Execution succeed.
      Parameter    1 name: Device.TestComponent.TestSampleParamUlong
                     type:       uint,    value: 1
      Parameter    2 name: Device.TestComponent.Enable
                     type:       bool,    value: false

      root@qemux86broadband-morty:/#


      You can add the component in packagegroup-rdk-ccsp-broadband.bb specified here IncludeNewlyAddedComponentinPackageGroup so that the binary and xml gets copied to the device by default as part of image.


      Regards

      Karthika


      1. Hi Karthika,

        Thank you for your reply.


        I am afraid I am not able to get the same output from dmcli in either the emulator (morty) using qemu or on an actual Pi (dunfell as the morty Pi build is missing dependencies on the code server it seems).

        The application runs (verified with "ps") and I was able to trace that both Cdm_Init and ssp_Mbi_MessageBusEngage return success codes when I run "./test_component -subsys eRT." (with the dot) on the Pi.


        Would you have any insights as to why I am not able to see the test component through dmcli even if it returns success codes internally?


        Running "dmcli eRT getv Device.TestComponent." gives the following:


        root@raspberrypi-rdk-broadband:/# dmcli eRT getv Device.TestComponent.
        CR component name is: eRT.com.cisco.spvtg.ccsp.CR
        subsystem_prefix eRT.
        Can't find destination component.
        1. Hi Max Lajauskas ,

          Can u share the dunfell build steps for rpi that you have build.

          Also ,the tar file for the test component have been updated for dunfell build herehttps://wiki.rdkcentral.com/download/attachments/23594417/ccsp_testcomponent.zip?version=1&modificationDate=1624474753000&api=v2 .So are you following this tar file or the old one?


          Regards

          Karthika

          1. Hi Karthika A B ,


            Thanks for the quick reply. I should have specified earlier, my apologies. The build steps I used for the Pi (3B+ if important for anything) are from this page (I had to add a "–postread" to let it pick up my JAVA_HOME directory to the bitbake command). Also, you are right, I did use the newer tar file for the build (the old one fails at build time for me).

            Kind Regards,
            Max

            1. Hi Max Lajauskas,

              On top of the dunfell build that you shared ,i tried the steps with the new tar file and bb file .I can see the testcomponent coming up and the dmcli returns are all a success.See below:

              root@RaspberryPi-Gateway:/usr/bin# cat /version.txt
              imagename:rdkb-generic-broadband-image_rdk-next_20210713152425
              BRANCH=rdk-next
              YOCTO_VERSION=dunfell
              VERSION=4.07.13.21
              SPIN=0
              BUILD_TIME="2021-07-13 15:24:25"
              Generated on Tue Jul 13  15:24:25 UTC 2021
              root@RaspberryPi-Gateway:/usr/bin#

              root@RaspberryPi-Gateway:/usr/bin# ./test_component -subsys eRT.
              root@RaspberryPi-Gateway:/usr/bin# Conf file /etc/debug.ini open success
              rdk_dyn_log_initg_dl_socket = 7 __progname = test_component
              rdk_logger_init /etc/debug.ini Already Stack Level Logging processed... not processing again.

              root@RaspberryPi-Gateway:/usr/bin# dmcli eRT getv Device.TestComponent.
              CR component name is: eRT.com.cisco.spvtg.ccsp.CR
              subsystem_prefix eRT.
              getv from/to component(eRT.com.cisco.spvtg.ccsp.testcomponent): Device.TestComponent.
              Execution succeed.
              Parameter    1 name: Device.TestComponent.TestSampleParamUlong
                             type:       uint,    value: 1

              root@RaspberryPi-Gateway:/usr/bin# ps | grep test
               9258 root      0:01 ./test_component -subsys eRT.
              root@RaspberryPi-Gateway:/usr/bin#


              I have tried this in a RPI 3B device and have added the component name in "meta-rdk/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bb" while verifying the above.


              Regards

              Karthika

              1. Hi, Karthika A B ,

                Thank you for that. I re-did everything again yesterday with the recommended setup on the reference dunfell build (Ubuntu 18.04.5, linux 5.4.75 (.72 not as easily available), openjdk11) on a clean new VM installation, still no luck (although I no longer needed to  pass a --postread config file and everything built first try). Would you be able to share your build environment setup that you used to produce the above? If we are both using the same .bb and .tar.gz from the updated zip file and the same build steps I can only think that there is some build environment difference?

                Kind Regards,
                Max

                1. Hi Max Lajauskas ,

                  Please find my build envt details:

                  Ubuntu version

                  $ cat /etc/os-release
                  NAME="Ubuntu"
                  VERSION="18.04.5 LTS (Bionic Beaver)"

                  Linux kernel version

                  $ uname -r
                  5.4.0-77-generic

                  JDK version

                  $ java --version
                  openjdk 11.0.10 2021-01-19
                  OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.18.04)
                  OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)


                  Also ,other components dmcli get are working as expected ?


                  Regards

                  Karthika



                  1. Hi Karthika A B ,

                    Thank you for sharing this. It seems there's very little difference indeed. Yes, the other components seem to be working - I am able to get and set values for what is accessible from dmcli except the newly added test component.

                    Thanks,
                    Max

                    1. Running the component directly regardless of installation location has not worked for me neither in an emulator (qemu, morty build) or natively on an Rpi3B+ (dunfell build).

                      What worked was:

                      1. Uncommenting the lines pertaining to registering the component as a service with systemd in the test component bitbake recipe.
                      2. Enabling the service via CLI (likely there is a setting to enable by default) on first boot and rebooting.

                      It seems there are some steps taken, likely for security if not a bug, to only allow the CCSP components to register with their CR as a system service on startup rather than manually after the fact.