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.

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

11 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 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 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,

  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,