How to test Gateway with Redis connectivity
search cancel

How to test Gateway with Redis connectivity

book

Article ID: 391019

calendar_today

Updated On: 03-17-2025

Products

CA API Developer Portal CA API Gateway

Issue/Introduction

The gateway testing team does not have administration access to Redis, unable to test connect &  re-connect. 

Looking for assists with simulating gateway connectivity to Enterprise Redis for Rate & Quota Policy (counters)

Environment

Gateway 11.1.1 Portal 5.3.1 

Resolution

Recommend running port forward script on the gateway that provides test team the ability to break and re-establish connectivity during test runs

This can be accomplished with Python script. Sample script to forward by port on github: see https://github.com/vinodpandey/python-port-forward (Apache License 2.0) 

Step1  Configure the Gateway Redis to localhost

/opt/SecureSpan/Gateway/node/default/etc/bootstrap/providers

redis:

  default:

    testOnStart: true

    type: standalone

    keyPrefixGroupName: <redisPrefix name for counters>

    username: default

    # password: "<password if need>"

    # encodedPassword: "<encoded password if need>"

    commandTimeout: 5000

    connectTimeout: 10000

    standalone:

      host: localhost

      port: 6379

#    ssl:

#      enabled: true

#      cert: host.crt

#      verifyPeer: false

Step 2 Download the python script from github and run as followed 

# python3 port-forward.py 6379:my.redis.server:6379

The script receives request via localhost on port 6379 from the gateway, then forwards to Redis my.redis.server:6379

Run load test, to simulate connection failure CRTL-D stops the forwarding script