Ixia Open Traffic generator & DUT

Ixia Open Traffic generator & DUT

Hey,

this will be a small post about using ixia open traffic generator, how it can generate some traffic so that dataplane of a Routing device can be verified. I have used Juniper CRPD as a Routing device for my test, & these set up dont need much memory and space requirement. For the lab i used containerab as all these images are container based images.

I wont be writing too much about each step, just providing the steps so that any one can follow and give it a try.

Installation Requirements:

Install Container Lab

root@dshaw-pc:~# clab version


? ? ? ? ? ? ? ? ? ? ? ? ? ?_? ? ? ? ? ? ? ? ? ?_? ? ? ?_? ? ?
? ? ? ? ? ? ? ? ?_? ? ? ? (_)? ? ? ? ? ? ? ? ?| |? ? ?| |? ??
?____ ___? ____ | |_? ____ _ ____? ?____? ____| | ____| | _??
/ ___) _ \|? _ \|? _)/ _? | |? _ \ / _? )/ ___) |/ _? | || \?
( (__| |_|| | | | |_( ( | | | | | ( (/ /| |? ?| ( ( | | |_) )
\____)___/|_| |_|\___)_||_|_|_| |_|\____)_|? ?|_|\_||_|____/?


? ? version: 0.38.0
? ? ?commit: 9626907f
? ? ? ?date: 2023-03-13T11:56:08Z
? ? ?source: https://github.com/srl-labs/containerlab
?rel. notes: https://containerlab.dev/rn/0.38/
        

Install Docker

root@dshaw-pc:~# docker version
Client: Docker Engine - Community
?Version:? ? ? ? ? ?23.0.1
?API version:? ? ? ?1.42
?Go version:? ? ? ? go1.19.5
?Git commit:? ? ? ? a5ee5b1
?Built:? ? ? ? ? ? ?Thu Feb? 9 19:47:01 2023
?OS/Arch:? ? ? ? ? ?linux/amd64
?Context:? ? ? ? ? ?default


Server: Docker Engine - Community
?Engine:
? Version:? ? ? ? ? 23.0.1
? API version:? ? ? 1.42 (minimum version 1.12)
? Go version:? ? ? ?go1.19.5
? Git commit:? ? ? ?bc3805a
? Built:? ? ? ? ? ? Thu Feb? 9 19:47:01 2023
? OS/Arch:? ? ? ? ? linux/amd64
? Experimental:? ? ?false
?containerd:
? Version:? ? ? ? ? 1.6.18
? GitCommit:? ? ? ? 2456e983eb9e37e47538f59ea18f2043c9a73640
?runc:
? Version:? ? ? ? ? 1.1.4
? GitCommit:? ? ? ? v1.1.4-0-g5fd4c4d
?docker-init:
? Version:? ? ? ? ? 0.19.0
? GitCommit:? ? ? ? de40ad0        


Install go


root@dshaw-pc:~# go version
go version go1.18.1 linux/amd64        

Clone the Repository

#### Command  ###
git clone --recurse-submodules https://github.com/open-traffic-generator/ixia-c && cd ixia-c

root@dshaw-pc:~/ixia-c# ls -lrt
total 40
-rw-r--r-- 1 root root 1527 Mar 29 23:55 CONTRIBUTING.md
drwxr-xr-x 2 root root 4096 Mar 29 23:55 conformance
-rw-r--r-- 1 root root 5506 Mar 29 23:55 CODE_OF_CONDUCT.md
drwxr-xr-x 3 root root 4096 Mar 29 23:55 deployments
drwxr-xr-x 2 root root 4096 Mar 29 23:55 snappi-tests
-rw-r--r-- 1 root root 8016 Mar 29 23:55 readme.md
-rw-r--r-- 1 root root 1078 Mar 29 23:55 license
drwxr-xr-x 3 root root 4096 Mar 29 23:55 docs        

Topology Definition in Container-lab

Create the topology defintion file

dshaw@dshaw-pc:~/clab$ ls -lrt
total 8
-rw-rw-r-- 1 dshaw dshaw? 392 Mar 29 23:37 ixia01.clab.yml

dshaw@dshaw-pc:~/clab$ cat ixia01.clab.yml?
name: ixiac01


topology:
? nodes:
? ? ixia-c:
? ? ? kind: keysight_ixia-c-one
? ? ? image: ghcr.io/open-traffic-generator/ixia-c-one:0.0.1-3865
? ? ? exec:
? ? ? ? - "./ifcfg add eth1 10.1.1.2 24"
? ? ? ? - "./ifcfg add eth2 10.2.2.2 24"
? ? crpd1:
? ? ? kind: crpd
? ? ? image: crpd:latest


? links:
? ? - endpoints: ["ixia-c:eth1", "crpd1:eth1"]
? ? - endpoints: ["ixia-c:eth2", "crpd1:eth2"]        

A visual View of what we are doing:

No alt text provided for this image


Inpect the docker nodes:

root@dshaw-pc:/home/dshaw/clab# clab inspect
INFO[0000] Parsing & checking topology file: ixia01.clab.yml?
+---+---------------------+--------------+------------------------------------------------------+---------------------+---------+----------------+----------------------+
| # |? ? ? ? Name? ? ? ? ?| Container ID |? ? ? ? ? ? ? ? ? ? ? ? Image? ? ? ? ? ? ? ? ? ? ? ? ?|? ? ? ? Kind? ? ? ? ?|? State? |? IPv4 Address? |? ? ?IPv6 Address? ? ?|
+---+---------------------+--------------+------------------------------------------------------+---------------------+---------+----------------+----------------------+
| 1 | clab-ixiac01-ixia-c | 597c9f4e2da5 | ghcr.io/open-traffic-generator/ixia-c-one:0.0.1-3865 | keysight_ixia-c-one | running | 172.20.20.3/24 | 2001:172:20:20::3/64 |
| 2 | clab-ixiac01-crpd1? ?| 7cb2349d3a14 | crpd:latest? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | crpd? ? ? ? ? ? ? ? | running | 172.20.20.2/24 | 2001:172:20:20::2/64 |
+---+---------------------+--------------+------------------------------------------------------+---------------------+---------+----------------+----------------------+        

Juniper box configation:

root@dshaw-pc:/home/dshaw/clab# docker exec -it clab-ixiac01-crpd1 cli
root@crpd1> edit?
Entering configuration mode


[edit]
root@crpd# run show configuration | display set?

set interfaces eth1 unit 0 family inet address 10.1.1.1/24
set interfaces eth2 unit 0 family inet address 10.2.2.1/24        

Whats there in IXIA-C

Now if we inspect the ixia-c container its not a simple container, its a Container of cotainers


root@dshaw-pc:/home/dshaw/clab# docker exec -it clab-ixiac01-ixia-c sh

/home/keysight/ixia-c-one # docker ps -a
CONTAINER ID? ?IMAGE? ? ? ? ? ? ? ? ? ? ? ? ? ? COMMAND? ? ? ? ? ? ? ? ? CREATED? ? ? ? ? STATUS? ? ? ? ? ? ? ? ? ? ? PORTS? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NAMES
a3547b18c1b1? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Up 25 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-eth1
12ce786cbf72? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Up 25 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-eth2
bdff88bed11f? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Up 25 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-ip6tnl0
0e0e9b6c88e9? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Up 25 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-sit0
066d67b2a283? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Exited (0) 25 minutes ago? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-erspan0
5617cffb6aa1? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Exited (0) 25 minutes ago? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-gretap0
03007de8d2eb? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 25 minutes ago? ?Up 25 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-gre0
6a2d96e73f9c? ?ixia-c-controller:0.0.1-3865? ? ?"./bin/controller --…"? ?25 minutes ago? ?Up 25 minutes? ? ? ? ? ? ? ?0.0.0.0:8443->8443/tcp, 0.0.0.0:40051->40051/tcp, 0.0.0.0:50051->50051/tcp? ?ixia-c-controller

/home/keysight/ixia-c-one # docker exec -it a3547b18c1b1 sh
sh-4.4# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
? ? link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
? ? inet 127.0.0.1/8 scope host lo
? ? ? ?valid_lft forever preferred_lft forever
? ? inet6 ::1/128 scope host?
? ? ? ?valid_lft forever preferred_lft forever
... deleted ...
13: eth1@if12: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 9500 qdisc noqueue state UP group default?
? ? link/ether aa:c1:ab:6b:d8:7c brd ff:ff:ff:ff:ff:ff link-netnsid 1
? ? inet 10.1.1.2/24 scope global eth1
? ? ? ?valid_lft forever preferred_lft forever
? ? inet6 fe80::a8c1:abff:fe6b:d87c/64 scope link?
? ? ? ?valid_lft forever preferred_lft forever
26: eth0@if27: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default?
? ? link/ether 02:42:ac:11:00:07 brd ff:ff:ff:ff:ff:ff link-netnsid 0
? ? inet 172.17.0.7/16 brd 172.17.255.255 scope global eth0
? ? ? ?valid_lft forever preferred_lft forever
? ? inet6 fe80::42:acff:fe11:7/64 scope link?
? ? ? ?valid_lft forever preferred_lft forever
sh-4.4# exit
exit
/home/keysight/ixia-c-one # docker ps -a
CONTAINER ID? ?IMAGE? ? ? ? ? ? ? ? ? ? ? ? ? ? COMMAND? ? ? ? ? ? ? ? ? CREATED? ? ? ? ? STATUS? ? ? ? ? ? ? ? ? ? ? PORTS? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NAMES
a3547b18c1b1? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Up 26 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-eth1
12ce786cbf72? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Up 26 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-eth2
bdff88bed11f? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Up 26 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-ip6tnl0
0e0e9b6c88e9? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Up 26 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-sit0
066d67b2a283? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Exited (0) 26 minutes ago? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-erspan0
5617cffb6aa1? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Exited (0) 26 minutes ago? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-gretap0
03007de8d2eb? ?ixia-c-traffic-engine:1.6.0.35? ?"./entrypoint.sh"? ? ? ? 26 minutes ago? ?Up 26 minutes? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ixia-c-port-dp-gre0
6a2d96e73f9c? ?ixia-c-controller:0.0.1-3865? ? ?"./bin/controller --…"? ?26 minutes ago? ?Up 26 minutes? ? ? ? ? ? ? ?0.0.0.0:8443->8443/tcp, 0.0.0.0:40051->40051/tcp, 0.0.0.0:50051->50051/tcp? ?ixia-c-controller

/home/keysight/ixia-c-one # docker exec -it 12ce786cbf72 sh
sh-4.4# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
? ? link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
? ? inet 127.0.0.1/8 scope host lo
? ? ? ?valid_lft forever preferred_lft forever
? ? inet6 ::1/128 scope host?
? ? ? ?valid_lft forever preferred_lft forever
... deleted ...
11: eth2@if10: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 9500 qdisc noqueue state UP group default?
? ? link/ether aa:c1:ab:12:12:88 brd ff:ff:ff:ff:ff:ff link-netnsid 1
? ? inet 10.2.2.2/24 scope global eth2
? ? ? ?valid_lft forever preferred_lft forever
? ? inet6 fe80::a8c1:abff:fe12:1288/64 scope link?
? ? ? ?valid_lft forever preferred_lft forever
24: eth0@if25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default?
? ? link/ether 02:42:ac:11:00:05 brd ff:ff:ff:ff:ff:ff link-netnsid 0
? ? inet 172.17.0.5/16 brd 172.17.255.255 scope global eth0
? ? ? ?valid_lft forever preferred_lft forever
? ? inet6 fe80::42:acff:fe11:5/64 scope link?
? ? ? ?valid_lft forever preferred_lft forever        

Do some ping pong

From Juniper boxes u can ping IXIA-C interface IP's

# ping 10.1.1.2
PING 10.1.1.2 (10.1.1.2) 56(84) bytes of data.
64 bytes from 10.1.1.2: icmp_seq=1 ttl=64 time=0.054 ms
^C
--- 10.1.1.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.054/0.054/0.054/0.000 ms


# ping 10.2.2.2
PING 10.2.2.2 (10.2.2.2) 56(84) bytes of data.
64 bytes from 10.2.2.2: icmp_seq=1 ttl=64 time=0.069 ms
^C
--- 10.2.2.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.069/0.069/0.069/0.000 ms        

Now to start and run traffic.

You need to clone below Repo, and there will be some examples under below directory.

root@dshaw-pc:~# git clone https://github.com/open-traffic-generator/snappi-tests.git

root@dshaw-pc:~/snappi-tests/scripts# ls -lrt
total 92
-rw-r--r-- 1 root root 5093 Mar 30 00:11 udp_bidirectional_flow.py
-rw-r--r-- 1 root root 5859 Mar 30 00:11 snappi-trex.py
-rw-r--r-- 1 root root 5879 Mar 30 00:11 snappi-ixnetwork.py
-rw-r--r-- 1 root root 5868 Mar 30 00:11 snappi-ixia-c.py
-rw-r--r-- 1 root root? 373 Mar 30 00:11 setup-veth-pair.sh
-rwxr-xr-x 1 root root? 295 Mar 30 00:11 setup-env.sh
-rw-r--r-- 1 root root? 817 Mar 30 00:11 setup-bridged-veth.sh
-rw-r--r-- 1 root root? 945 Mar 30 00:11 quickstart_snappi.py
-rw-r--r-- 1 root root 8878 Mar 30 00:11 packet_forward_old.go
-rw-r--r-- 1 root root 9247 Mar 30 00:11 packet_forward.go
-rw-r--r-- 1 root root 3514 Mar 30 00:11 ipv4_forwarding.go
-rw-r--r-- 1 root root 5320 Mar 30 00:11 hello_snappi.py
-rw-r--r-- 1 root root 5787 Mar 30 00:11 bgpv4_forwarding.go



        

Create a copy of the file ipv4_forwarding.go and Modify few parameters : like dst mac(CRPD eth1 MAC), src ip(IXIA eth1 IP) and Dest IP (ixia Eth 2 IP)

root@dshaw-pc:~/snappi-tests/scripts# cat dshaw.go
/*
Test IPv4 Forwarding with
- Endpoints: OTG 1.1.1.1 -----> 1.1.1.2 DUT 2.2.2.1 ------> OTG 2.2.2.2
- Static Route on DUT: 20.20.20.0/24 -> 2.2.2.2
- TCP flow from OTG: 10.10.10.1 -> 20.20.20.1+
To run: go run ipv4_forwarding.go -dstMac=<MAC of 1.1.1.2>
*/


package main


import (
? ? ? ? "flag"
? ? ? ? "log"
? ? ? ? "time"


? ? ? ? "github.com/open-traffic-generator/snappi/gosnappi"
)


// hostname and interfaces of ixia-c-one node from containerlab topology
const (
? ? ? ? otgHost? = "https://clab-ixiac01-ixia-c:8443"
? ? ? ? otgPort1 = "eth1"
? ? ? ? otgPort2 = "eth2"
)


var (
? ? ? ? dstMac? ?= "aa:c1:ab:ed:20:b4"
? ? ? ? srcMac? ?= "00:00:00:00:00:aa"
? ? ? ? pktCount = 10000
)


func main() {
? ? ? ? // replace value of dstMac with actual MAC of DUT interface connected to otgPort1
? ? ? ? flag.StringVar(&dstMac, "dstMac", dstMac, "Destination MAC address to be used for all packets")
? ? ? ? flag.Parse()


? ? ? ? api, config := newConfig()


? ? ? ? // push traffic configuration to otgHost
? ? ? ? res, err := api.SetConfig(config)
? ? ? ? checkResponse(res, err)


? ? ? ? // start transmitting configured flows
? ? ? ? ts := api.NewTransmitState().SetState(gosnappi.TransmitStateState.START)
? ? ? ? res, err = api.SetTransmitState(ts)
? ? ? ? checkResponse(res, err)


? ? ? ? // fetch flow metrics and wait for received frame count to be correct
? ? ? ? mr := api.NewMetricsRequest()
? ? ? ? mr.Flow()
? ? ? ? waitFor(
? ? ? ? ? ? ? ? func() bool {
? ? ? ? ? ? ? ? ? ? ? ? res, err := api.GetMetrics(mr)
? ? ? ? ? ? ? ? ? ? ? ? checkResponse(res, err)


? ? ? ? ? ? ? ? ? ? ? ? fm := res.FlowMetrics().Items()[0]
? ? ? ? ? ? ? ? ? ? ? ? return fm.Transmit() == gosnappi.FlowMetricTransmit.STOPPED && fm.FramesRx() == int64(pktCount)
? ? ? ? ? ? ? ? },
? ? ? ? ? ? ? ? 20*time.Second,
? ? ? ? )
}


func checkResponse(res interface{}, err error) {
? ? ? ? if err != nil {
? ? ? ? ? ? ? ? log.Fatal(err)
? ? ? ? }
? ? ? ? switch v := res.(type) {
? ? ? ? case gosnappi.MetricsResponse:
? ? ? ? ? ? ? ? log.Printf("Metrics Response:\n%s\n", v)
? ? ? ? case gosnappi.ResponseWarning:
? ? ? ? ? ? ? ? for _, w := range v.Warnings() {
? ? ? ? ? ? ? ? ? ? ? ? log.Println("WARNING:", w)
? ? ? ? ? ? ? ? }
? ? ? ? default:
? ? ? ? ? ? ? ? log.Fatal("Unknown response type:", v)
? ? ? ? }
}


func newConfig() (gosnappi.GosnappiApi, gosnappi.Config) {
? ? ? ? // create a new API handle to make API calls against otgHost
? ? ? ? api := gosnappi.NewApi()
? ? ? ? api.NewHttpTransport().SetLocation(otgHost).SetVerify(false)


? ? ? ? // create an empty traffic configuration
? ? ? ? config := api.NewConfig()
? ? ? ? // create traffic endpoints
? ? ? ? p1 := config.Ports().Add().SetName("p1").SetLocation(otgPort1)
? ? ? ? p2 := config.Ports().Add().SetName("p2").SetLocation(otgPort2)
? ? ? ? // create a flow and set the endpoints
? ? ? ? f1 := config.Flows().Add().SetName("p1.v4.p2")
? ? ? ? f1.TxRx().Port().SetTxName(p1.Name()).SetRxName(p2.Name())


? ? ? ? // enable per flow metrics tracking
? ? ? ? f1.Metrics().SetEnable(true)
? ? ? ? // set size, count and transmit rate for all packets in the flow
? ? ? ? f1.Size().SetFixed(512)
? ? ? ? f1.Rate().SetPps(100)
? ? ? ? f1.Duration().FixedPackets().SetPackets(int32(pktCount))


? ? ? ? // configure headers for all packets in the flow
? ? ? ? eth := f1.Packet().Add().Ethernet()
? ? ? ? ip := f1.Packet().Add().Ipv4()


? ? ? ? eth.Src().SetValue(srcMac)
? ? ? ? eth.Dst().SetValue(dstMac)


? ? ? ? ip.Src().SetValue("10.1.1.2")
? ? ? ? ip.Dst().SetValue("10.2.2.2")


? ? ? ? log.Printf("OTG configuration:\n%s\n", config)
? ? ? ? return api, config
}


func waitFor(fn func() bool, timeout time.Duration) {
? ? ? ? start := time.Now()
? ? ? ? for {
? ? ? ? ? ? ? ? if fn() {
? ? ? ? ? ? ? ? ? ? ? ? return
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? if time.Since(start) > timeout {
? ? ? ? ? ? ? ? ? ? ? ? log.Fatal("Timeout occurred !")
? ? ? ? ? ? ? ? }


? ? ? ? ? ? ? ? time.Sleep(500 * time.Millisecond)
? ? ? ? }
}?        


go install github.com/open-traffic-generator/snappi/[email protected]


Incase u face issues to run the command "go run dshaw.go" ensure below steps

go mod init
go mood tidy
go get github.com/open-traffic-generator/snappi/[email protected]
        

my test was giving error if i was using the version v0.11.5, hence i had to downgrade to 0.11.4.

Now if u run "go run dshaw.go", This will be your Open traffic Generator configuration.

2023/03/30 01:36:42 OTG configuration:
flows:
- duration:
? ? choice: fixed_packets
? ? fixed_packets:
? ? ? gap: 12
? ? ? packets: 10000
? metrics:
? ? enable: true
? ? loss: false
? ? timestamps: false
? name: p1.v4.p2
? packet:
? - choice: ethernet
? ? ethernet:
? ? ? dst:
? ? ? ? choice: value
? ? ? ? value: aa:c1:ab:ed:20:b4
? ? ? src:
? ? ? ? choice: value
? ? ? ? value: 00:00:00:00:00:aa
? - choice: ipv4
? ? ipv4:
? ? ? dst:
? ? ? ? choice: value
? ? ? ? value: 10.2.2.2
? ? ? src:
? ? ? ? choice: value
? ? ? ? value: 10.1.1.2
? rate:
? ? choice: pps
? ? pps: "100"
? size:
? ? choice: fixed
? ? fixed: 512
? tx_rx:
? ? choice: port
? ? port:
? ? ? rx_name: p2
? ? ? tx_name: p1
ports:
- location: eth1
? name: p1
- location: eth2
? name: p2



        

You will get some continuous pages, showing traffic statistics.

## this is Traffic Generator config, after running the test u will see some stats like this **

choice: flow_metrics
flow_metrics:
- bytes_rx: "1031168"
? bytes_tx: "0"
? frames_rx: "2014"
? frames_rx_rate: 100
? frames_tx: "2014"
? frames_tx_rate: 100
? name: p1.v4.p2
? transmit: started*        

there is a code section, which times out the traffic, so can modify the dshaw.go file, & make total packets to 1000 and u can get some proper Result.

Thank you , thats about it tongiht.

要查看或添加评论,请登录

Dipankar Shaw的更多文章

  • SRv6 L3VPN with Flex-Algo

    SRv6 L3VPN with Flex-Algo

    In my last article i explained a best effort uDT6 service, that sets the foundation for srv6 services & tunnels. Now…

  • SRv6 Tunnel with uDT6 Service SID

    SRv6 Tunnel with uDT6 Service SID

    In this article, I will provide an explanation of SRv6 (Segment Routing over IPv6) and delve into the uDT6 service…

  • UDPPing : Ping-pong with Layer 4

    UDPPing : Ping-pong with Layer 4

    Introduction: Recently i was watching a NANOG Presentation, where they showcased PINGO Project, which is able to…

    2 条评论
  • Sending BGP routes using ExaBGP

    Sending BGP routes using ExaBGP

    Hey all, Recently i came across a problem statement where i wanted to send some good amount of routes via BGP. While…

    3 条评论
  • Arista Segment Routing Config & show commands

    Arista Segment Routing Config & show commands

    Introduction : Will be keeping this post very very short, intention is to capture, how we can configure segment routing…

    2 条评论
  • EVPN VXLAN Inter subnet Routing using Asymmetric IRB model

    EVPN VXLAN Inter subnet Routing using Asymmetric IRB model

    Hello Guys, Frankly speaking, this topic is a complex one to understand if you dont work with evpn, VXLAN and IRB. I…

    1 条评论
  • BGP Unnumbered by Bard

    BGP Unnumbered by Bard

    Introduction BGP unnumbered is a feature that allows BGP to establish peering sessions without explicitly configuring…

    1 条评论
  • Metallb Loadbalancer With BGP for k8s, Not Rock Music

    Metallb Loadbalancer With BGP for k8s, Not Rock Music

    Ok, 2023 is On. This article will be the 1st one of this year.

  • Default Route to Container lab

    Default Route to Container lab

    inuz Containers are awesome. They are lightweight, spins up too fast.

  • Route Target Constraint Intra-AS

    Route Target Constraint Intra-AS

    Problem Statement :- In MPLS VPN case, Each PE router needs to hold Routes for a particular VRF from all other PE's…

    8 条评论

社区洞察

其他会员也浏览了