-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
303 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,95 @@ | ||
# import pytest | ||
import pytest | ||
|
||
@pytest.mark.skip(reason="Fix -convergence support TBD") | ||
# @pytest.fixture() | ||
def bgp_convergence_config(utils, cvg_api): | ||
""" | ||
1.Configure IPv4 EBGP sessions between Keysight ports(rx & tx) | ||
2.Configure and advertise IPv4 routes from rx | ||
""" | ||
|
||
# def test_ping_cvg(cvg_api, utils): | ||
# """ | ||
# Demonstrates test to send ipv4 and ipv6 pings | ||
conv_config = cvg_api.convergence_config() | ||
config = conv_config.config | ||
|
||
# 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]) | ||
tx, rx = 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 = [tx.name, rx.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" | ||
tx_device, rx_device = config.devices.device(name="tx_device").device( | ||
name="rx_device" | ||
) | ||
|
||
# ip1.address = "10.1.1.1" | ||
# ip1.gateway = "10.1.1.2" | ||
# ip1.prefix = 24 | ||
# tx_device config | ||
tx_eth = tx_device.ethernets.add() | ||
tx_eth.port_name = tx.name | ||
tx_eth.name = "tx_eth" | ||
tx_eth.mac = "00:00:00:00:00:aa" | ||
tx_ipv4 = tx_eth.ipv4_addresses.add() | ||
tx_ipv4.name = "tx_ipv4" | ||
tx_ipv4.address = "21.1.1.2" | ||
tx_ipv4.prefix = 24 | ||
tx_ipv4.gateway = "21.1.1.1" | ||
tx_bgpv4 = tx_device.bgp | ||
tx_bgpv4.router_id = "192.0.0.1" | ||
tx_bgpv4_int = tx_bgpv4.ipv4_interfaces.add() | ||
tx_bgpv4_int.ipv4_name = tx_ipv4.name | ||
tx_bgpv4_peer = tx_bgpv4_int.peers.add() | ||
tx_bgpv4_peer.name = "tx_bgpv4" | ||
tx_bgpv4_peer.as_type = "ebgp" | ||
tx_bgpv4_peer.peer_address = "21.1.1.1" | ||
tx_bgpv4_peer.as_number = 65201 | ||
|
||
# ip2.address = "10.1.1.2" | ||
# ip2.gateway = "10.1.1.1" | ||
# ip2.prefix = 24 | ||
# rx_device config | ||
rx_eth = rx_device.ethernets.add() | ||
rx_eth.port_name = rx.name | ||
rx_eth.name = "rx_eth" | ||
rx_eth.mac = "00:00:00:00:00:bb" | ||
rx_ipv4 = rx_eth.ipv4_addresses.add() | ||
rx_ipv4.name = "rx_ipv4" | ||
rx_ipv4.address = "21.1.1.1" | ||
rx_ipv4.prefix = 24 | ||
rx_ipv4.gateway = "21.1.1.2" | ||
rx_bgpv4 = rx_device.bgp | ||
rx_bgpv4.router_id = "192.0.0.2" | ||
rx_bgpv4_int = rx_bgpv4.ipv4_interfaces.add() | ||
rx_bgpv4_int.ipv4_name = rx_ipv4.name | ||
rx_bgpv4_peer = rx_bgpv4_int.peers.add() | ||
rx_bgpv4_peer.name = "rx_bgpv4" | ||
rx_bgpv4_peer.as_type = "ebgp" | ||
rx_bgpv4_peer.peer_address = "21.1.1.2" | ||
rx_bgpv4_peer.as_number = 65200 | ||
rx_rr = rx_bgpv4_peer.v4_routes.add(name="rx_rr") | ||
rx_rr.addresses.add(count=1000, address="200.1.0.1", prefix=32) | ||
|
||
# ipv61.address = "3000::1" | ||
# ipv61.gateway = "3000::2" | ||
# ipv61.prefix = 64 | ||
# flow config | ||
flow = config.flows.flow(name="convergence_test")[-1] | ||
flow.tx_rx.device.tx_names = [tx_device.name] | ||
flow.tx_rx.device.rx_names = [rx_rr.name] | ||
|
||
# ipv62.address = "3000::2" | ||
# ipv62.gateway = "3000::1" | ||
# ipv62.prefix = 64 | ||
flow.size.fixed = 1024 | ||
flow.rate.percentage = 50 | ||
flow.metrics.enable = True | ||
|
||
# cvg_api.set_config(conv_config) | ||
# flow2 config | ||
rx1_rr = rx_bgpv4_peer.v4_routes.add(name="rx1_rr") | ||
rx1_rr.addresses.add(count=1000, address="200.1.0.1", prefix=32) | ||
|
||
# print("Starting all protocols ...") | ||
# cs = cvg_api.convergence_state() | ||
# cs.protocol.state = cs.protocol.START | ||
# cvg_api.set_state(cs) | ||
# flow config | ||
flow2 = config.flows.flow(name="background_flow")[-1] | ||
flow2.tx_rx.device.tx_names = [tx_device.name] | ||
flow2.tx_rx.device.rx_names = [rx1_rr.name] | ||
|
||
# cs = cvg_api.convergence_state() | ||
# cs.transmit.state = cs.transmit.START | ||
# cvg_api.set_state(cs) | ||
flow2.size.fixed = 1024 | ||
flow2.rate.percentage = 50 | ||
flow2.metrics.enable = True | ||
|
||
# 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) | ||
return conv_config |
Oops, something went wrong.