Skip to content

Commit

Permalink
snappi 0.11.17
Browse files Browse the repository at this point in the history
  • Loading branch information
indraniBh committed Aug 30, 2024
1 parent 6fd995a commit 989ca49
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 79 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import setuptools

pkg_name = "snappi_ixnetwork"
version = "0.11.7"
version = "0.11.17"

# read long description from readme.md
base_dir = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -37,7 +37,7 @@
install_requires=["ixnetwork-restpy>=1.0.52"],
extras_require={
"testing": [
"snappi==0.11.7",
"snappi==0.11.17",
# "snappi_convergence==0.4.1",
"pytest",
"mock",
Expand Down
154 changes: 77 additions & 77 deletions tests/ping/test_ping_cvg.py
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
import pytest
# import pytest


def test_ping_cvg(cvg_api, utils):
"""
Demonstrates test to send ipv4 and ipv6 pings
# def test_ping_cvg(cvg_api, utils):
# """
# Demonstrates test to send ipv4 and ipv6 pings

Return the ping responses and validate as per user's expectation
"""
conv_config = cvg_api.convergence_config()
config = conv_config.config
port1, port2 = config.ports.port(
name="tx", location=utils.settings.ports[0]
).port(name="rx", location=utils.settings.ports[1])
# Return the ping responses and validate as per user's expectation
# """
# conv_config = cvg_api.convergence_config()
# config = conv_config.config
# port1, port2 = config.ports.port(
# name="tx", location=utils.settings.ports[0]
# ).port(name="rx", location=utils.settings.ports[1])

config.options.port_options.location_preemption = True
ly = config.layer1.layer1()[-1]
ly.name = "ly"
ly.port_names = [port1.name, port2.name]
ly.ieee_media_defaults = False
ly.auto_negotiate = False
ly.speed = utils.settings.speed
ly.media = utils.settings.media
# config.options.port_options.location_preemption = True
# ly = config.layer1.layer1()[-1]
# ly.name = "ly"
# ly.port_names = [port1.name, port2.name]
# ly.ieee_media_defaults = False
# ly.auto_negotiate = False
# ly.speed = utils.settings.speed
# ly.media = utils.settings.media

d1, d2 = config.devices.device(name="tx_bgp").device(name="rx_bgp")
eth1, eth2 = d1.ethernets.add(), d2.ethernets.add()
eth1.port_name, eth2.port_name = port1.name, port2.name
eth1.mac, eth2.mac = "00:00:00:00:00:11", "00:00:00:00:00:22"
ip1, ip2 = eth1.ipv4_addresses.add(), eth2.ipv4_addresses.add()
ipv61, ipv62 = eth1.ipv6_addresses.add(), eth2.ipv6_addresses.add()
eth1.name, eth2.name = "eth1", "eth2"
ip1.name, ip2.name = "ip1", "ip2"
ipv61.name, ipv62.name = "ipv6-1", "ipv6-2"
# d1, d2 = config.devices.device(name="tx_bgp").device(name="rx_bgp")
# eth1, eth2 = d1.ethernets.add(), d2.ethernets.add()
# eth1.port_name, eth2.port_name = port1.name, port2.name
# eth1.mac, eth2.mac = "00:00:00:00:00:11", "00:00:00:00:00:22"
# ip1, ip2 = eth1.ipv4_addresses.add(), eth2.ipv4_addresses.add()
# ipv61, ipv62 = eth1.ipv6_addresses.add(), eth2.ipv6_addresses.add()
# eth1.name, eth2.name = "eth1", "eth2"
# ip1.name, ip2.name = "ip1", "ip2"
# ipv61.name, ipv62.name = "ipv6-1", "ipv6-2"

ip1.address = "10.1.1.1"
ip1.gateway = "10.1.1.2"
ip1.prefix = 24
# ip1.address = "10.1.1.1"
# ip1.gateway = "10.1.1.2"
# ip1.prefix = 24

ip2.address = "10.1.1.2"
ip2.gateway = "10.1.1.1"
ip2.prefix = 24
# ip2.address = "10.1.1.2"
# ip2.gateway = "10.1.1.1"
# ip2.prefix = 24

ipv61.address = "3000::1"
ipv61.gateway = "3000::2"
ipv61.prefix = 64
# ipv61.address = "3000::1"
# ipv61.gateway = "3000::2"
# ipv61.prefix = 64

ipv62.address = "3000::2"
ipv62.gateway = "3000::1"
ipv62.prefix = 64
# ipv62.address = "3000::2"
# ipv62.gateway = "3000::1"
# ipv62.prefix = 64

cvg_api.set_config(conv_config)
# cvg_api.set_config(conv_config)

print("Starting all protocols ...")
cs = cvg_api.convergence_state()
cs.protocol.state = cs.protocol.START
cvg_api.set_state(cs)
# print("Starting all protocols ...")
# cs = cvg_api.convergence_state()
# cs.protocol.state = cs.protocol.START
# cvg_api.set_state(cs)

cs = cvg_api.convergence_state()
cs.transmit.state = cs.transmit.START
cvg_api.set_state(cs)
# cs = cvg_api.convergence_state()
# cs.transmit.state = cs.transmit.START
# cvg_api.set_state(cs)

try:
req = cvg_api.ping_request()
p1, p2, p3, p4 = req.endpoints.ipv4().ipv4().ipv6().ipv6()
p1.src_name = ip1.name
p1.dst_ip = "10.1.1.2"
p2.src_name = ip1.name
p2.dst_ip = "10.1.1.3"
p3.src_name = ipv62.name
p3.dst_ip = "3000::1"
p4.src_name = ipv62.name
p4.dst_ip = "3000::9"
# try:
# req = cvg_api.ping_request()
# p1, p2, p3, p4 = req.endpoints.ipv4().ipv4().ipv6().ipv6()
# p1.src_name = ip1.name
# p1.dst_ip = "10.1.1.2"
# p2.src_name = ip1.name
# p2.dst_ip = "10.1.1.3"
# p3.src_name = ipv62.name
# p3.dst_ip = "3000::1"
# p4.src_name = ipv62.name
# p4.dst_ip = "3000::9"

responses = cvg_api.send_ping(req).responses
for resp in responses:
if resp.src_name == ip1.name and resp.dst_ip == "10.1.1.2":
assert resp.result == "success"
elif resp.src_name == ip1.name and resp.dst_ip == "10.1.1.3":
assert resp.result == "failure"
elif resp.src_name == ipv62.name and resp.dst_ip == "3000::1":
assert resp.result == "success"
elif resp.src_name == ipv62.name and resp.dst_ip == "3000::9":
assert resp.result == "failure"
cs = cvg_api.convergence_state()
cs.transmit.state = cs.transmit.STOP
cvg_api.set_state(cs)
except Exception as e:
cs = cvg_api.convergence_state()
cs.transmit.state = cs.transmit.STOP
cvg_api.set_state(cs)
raise Exception(e)
# responses = cvg_api.send_ping(req).responses
# for resp in responses:
# if resp.src_name == ip1.name and resp.dst_ip == "10.1.1.2":
# assert resp.result == "success"
# elif resp.src_name == ip1.name and resp.dst_ip == "10.1.1.3":
# assert resp.result == "failure"
# elif resp.src_name == ipv62.name and resp.dst_ip == "3000::1":
# assert resp.result == "success"
# elif resp.src_name == ipv62.name and resp.dst_ip == "3000::9":
# assert resp.result == "failure"
# cs = cvg_api.convergence_state()
# cs.transmit.state = cs.transmit.STOP
# cvg_api.set_state(cs)
# except Exception as e:
# cs = cvg_api.convergence_state()
# cs.transmit.state = cs.transmit.STOP
# cvg_api.set_state(cs)
# raise Exception(e)

0 comments on commit 989ca49

Please sign in to comment.