DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Low-Code Development: Leverage low and no code to streamline your workflow so that you can focus on higher priorities.

DZone Security Research: Tell us your top security strategies in 2024, influence our research, and enter for a chance to win $!

Launch your software development career: Dive head first into the SDLC and learn how to build high-quality software and teams.

Open Source Migration Practices and Patterns: Explore key traits of migrating open-source software and its impact on software development.

Related

  • A Deep Dive Into Distributed Tracing
  • Scaling Up With Kubernetes: Cloud-Native Architecture for Modern Applications
  • Designing Databases for Distributed Systems: Data Management Patterns for Microservices and Cloud-Native Applications
  • Building Resilient, Scalable Cloud-Native Applications: How To Meet Business Needs While Providing Redundant Solutions

Trending

  • Integration Testing With Keycloak, Spring Security, Spring Boot, and Spock Framework
  • Leveraging Microsoft Graph API for Unified Data Access and Insights
  • Front-End Application Performance Monitoring (APM)
  • Performance and Scalability Analysis of Redis and Memcached
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Using CNTI/CNF Test Catalog for Non-Telco Cloud-Native Microservices

Using CNTI/CNF Test Catalog for Non-Telco Cloud-Native Microservices

The CNTI/CNF Test Catalog is a versatile tool initially designed for telco applications but can also validate the cloud nativeness of non-telco microservices.

By 
Abhinav Garg user avatar
Abhinav Garg
·
Jun. 19, 24 · Tutorial
Like (2)
Save
Tweet
Share
4.5K Views

Join the DZone community and get the full member experience.

Join For Free

The Cloud Native Telecom Initiative (CNTI) and the Cloud-Native Network Functions (CNF) Test Catalog are powerful tools designed to ensure telco applications adhere to cloud-native principles and best practices. However, a common misconception is that this tool is limited to telco applications. In reality, the CNTI/CNF Test Catalog is highly versatile and can be effectively used to validate the cloud nativeness of non-telco microservices. 

This article aims to guide you through the process of utilizing the CNTI/CNF Test Catalog for non-telco microservices, overcoming potential challenges, and adding custom tests.

Installation

To get started, download the latest CNTI test suite binary from the GitHub releases page. Extract the zip file to your preferred location and provide executable permissions. Ensure your machine meets the prerequisites.

Execute the following command to set up the test suite:

./cnf-testsuite setup


This command will create a cnt-testsuite namespace in your cluster. For detailed preparation steps, refer to the installation guide.

Configuration

Before executing tests, note that the tool installs your microservice from the Helm charts or manifest location provided in the configuration file. This can be a challenge for non-telco applications, as they may have dependencies or require pre/post-scripting. To address this, you can run the suite on an already installed microservice using the same release name and namespace.

Here's a sample configuration file:

YAML
 
---
release_name: <release name of existing service>
helm_directory: <folder location>  # or use manifest directory
helm_install_namespace: <namespace of existing service>


Save this as cnf-testsuite.yml and ensure all paths are relative to the directory containing the CNTI binary. Use the following command to set up the test configuration:

cnf-testsuite cnf_setup cnf-config=./cnf-testsuite.yml


Execution

With the CNTI suite successfully configured, you can execute the suite for all categories, specific categories, or individual tests:

./cnf-testsuite compatibility


Refer to the test categories and execution guide to identify and run applicable tests for your service. Non-telco applications, for example, won't require 5G-specific tests.

Adding Custom Tests

To add custom tests, clone the CNTI test suite repository:

git clone https://github.com/cnti-testcatalog/testsuite


Navigate to the src/tasks/workload directory and edit the category test file where you want to add your custom test. The suite is written in Crystal, so it's advisable to use Ubuntu for development or perform changes on Windows and build on Ubuntu.

Custom Test Example

Here's an example of a custom test to check if resource requests are below specified limits:

Crystal
 
desc "Check if resource requests are less than 0.5 CPU and 512 MB memory"
task "resource_requests" do |t, args|
  CNFManager::Task.task_runner(args, task: t) do |args, config|
    resp = ""
    task_response = CNFManager.workload_resource_test(args, config) do |resource, container, initialized|
      test_passed = true
      resource_ref = "#{resource[:kind]}/#{resource[:name]}"
      cpu_request_value = 1
      memory_request_value = 1024
 
      begin
        cpu_request = container.as_h["resources"].as_h["requests"].as_h["cpu"].as_s
        memory_request = container.as_h["resources"].as_h["requests"].as_h["memory"].as_s
 
        cpu_request_value = if cpu_request.ends_with?("m")
                              cpu_request.gsub("m", "").to_i / 1000.0
                            else
                              cpu_request.to_i
                            end
 
        memory_request_value = if memory_request.ends_with?("Mi")
                                 memory_request.gsub("Mi", "").to_i
                               elsif memory_request.ends_with?("Gi")
                                 memory_request.gsub("Gi", "").to_i * 1024
                               else
                                 memory_request.to_i
                               end
 
        if cpu_request_value > 0.5 || memory_request_value > 512
          test_passed = false
          stdout_failure("Resource requests for container #{container.as_h["name"].as_s} part of #{resource_ref} in #{resource[:namespace]} namespace exceed limits (CPU: #{cpu_request}, Memory: #{memory_request})")
        end
      rescue ex
        test_passed = false
        stdout_failure("Error occurred while checking resource requests for container #{container.as_h["name"].as_s} part of #{resource_ref} in #{resource[:namespace]} namespace")
      end
 
      test_passed
    end
 
    if task_response
      CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Passed, "Resource requests within limits")
    else
      CNFManager::TestcaseResult.new(CNFManager::ResultStatus::Failed, "Resource requests exceed limits")
    end
  end
end


This test ensures that the CPU and memory requests for a container are within specified limits.

Conclusion

The CNTI/CNF Test Catalog is a robust tool, not just for telco applications, but for any cloud-native microservices. By following the steps outlined in this article, you can configure, execute, and even extend the capabilities of the CNTI test suite to fit your non-telco applications. Embrace the flexibility and power of the CNTI/CNF Test Catalog to enhance the reliability and performance of your microservices.

Test suite Tool Requests Cloud native computing microservice

Opinions expressed by DZone contributors are their own.

Related

  • A Deep Dive Into Distributed Tracing
  • Scaling Up With Kubernetes: Cloud-Native Architecture for Modern Applications
  • Designing Databases for Distributed Systems: Data Management Patterns for Microservices and Cloud-Native Applications
  • Building Resilient, Scalable Cloud-Native Applications: How To Meet Business Needs While Providing Redundant Solutions

Partner Resources


Comments

ABOUT US

  • About DZone
  • Send feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: