open-traffic-generator / snappi-ixnetwork

The Keysight IxNetwork implementation of the open-traffic-generator models.
MIT License
17 stars 11 forks source link

AN is not gettign disabled to the last ports in a loop #299

Closed selldinesh closed 3 years ago

selldinesh commented 3 years ago

Tried the below snippet

import pytest import snappi from tests.common.fixtures.conn_graph_facts import conn_graph_facts,fanout_graph_facts from tests.common.ixia.common_helpers import get_vlan_subnet, get_addrs_in_subnet,get_peer_ixia_chassis from tests.common.ixia.ixia_helpers import IxiaFanoutManager, get_tgen_location from tests.common.ixia.ixia_fixtures import tgen_ports,snappi_api from tests.common.helpers.assertions import pytest_assert from tests.common.utilities import wait_until logger = logging.getLogger(name) PORT_COUNT=6 MPATH=PORT_COUNT-1

@pytest.fixture(scope='module')

def test_bgp_convergence_config(snappi_api,tgen_ports): """ 1.Configure IPv4 EBGP sessions between the test ports 2.Advertise IPv4 routes 3.Configure and advertise same IPv4 routes 4.Configure another IPv4 session to send the traffic. """

config = snappi_api.config()
for i in range(1,PORT_COUNT+1):
    config.ports.port(name='Test Port %d'%i,location=tgen_ports[i-1]['location'])
    config.devices.device(name='Topology %d'%i,container_name=config.ports[i-1].name,device_count=1)

config.options.port_options.location_preemption = True

def confLayer1():
    for i in range(1,PORT_COUNT+1):
        layer1 = config.layer1.layer1()[-1]
        layer1.name = '%s port settings'%config.ports[i-1].name
        layer1.port_names = [config.ports[i-1].name]
        layer1.ieee_media_defaults = False
        layer1.auto_negotiation.rs_fec = False
        layer1.auto_negotiation.link_training = False
        layer1.speed= "speed_100_gbps"
        layer1.auto_negotiate = False

confLayer1()
snappi_api.set_config(config)
return config

After running this the last ports AN is not still disabled for the rest of the ports AN is off If I run the script once again then AN is turned off for the last port and link comes up

ANISH-GOTTAPU commented 3 years ago

@selldinesh : Hi Dinesh, not able to reproduce this issue with my Novus 100G setup. Can you replace the tgen_ports with your ports and try to run this script. The validation part is added as well, would be easy to find out where it is failing


def test_issue_229(api):
    PORT_COUNT = 4
    auto_negotiate = False
    ieee_media_defaults = False
    link_training = False
    rs_fec = False
    tgen_ports = [{'location': '10.36.87.215;1;5'},
                  {'location': '10.36.87.215;1;6'},
                  {'location': '10.36.87.215;1;7'},
                  {'location': '10.36.87.215;1;8'}]

    config = api.config()
    for i in range(1, PORT_COUNT+1):
        config.ports.port(name='Test Port %d' % i,
                          location=tgen_ports[i-1]['location'])
        config.devices.device(name='Topology %d' % i,
                              container_name=config.ports[i-1].name,
                              device_count=1)

    config.options.port_options.location_preemption = True

    def confLayer1():
        for i in range(1, PORT_COUNT+1):
            layer1 = config.layer1.layer1()[-1]
            layer1.name = '%s port settings' % config.ports[i-1].name
            layer1.port_names = [config.ports[i-1].name]
            layer1.ieee_media_defaults = False
            layer1.auto_negotiation.rs_fec = False
            layer1.auto_negotiation.link_training = False
            layer1.speed = "speed_100_gbps"
            layer1.auto_negotiate = False

    confLayer1()
    api.set_config(config)
    validate_layer1_config(api,
                           auto_negotiate,
                           ieee_media_defaults,
                           link_training,
                           rs_fec)

def validate_layer1_config(api,
                           auto_negotiate,
                           ieee_media_defaults,
                           link_training,
                           rs_fec):
    """
    Validate Layer1 Configs using Restpy
    """
    ixnetwork = api._ixnetwork
    for port in ixnetwork.Vport.find():
        print(port.Location)
        type = (port.Type)[0].upper() + (port.Type)[1:]
        assert getattr(port.L1Config, type).EnableAutoNegotiation \
            == auto_negotiate
        assert getattr(port.L1Config, type).IeeeL1Defaults \
            == ieee_media_defaults
        assert getattr(port.L1Config, type).EnableRsFec \
            == rs_fec
        assert getattr(port.L1Config, type).LinkTraining \
            == link_training```
selldinesh commented 3 years ago

Hi Anish,

Sure, Will run it by tmrw and let you know the status.

Thanks, Dinesh

From: ANISH-GOTTAPU notifications@github.com Sent: Sunday, February 28, 2021 11:21 PM To: open-traffic-generator/ixnetwork ixnetwork@noreply.github.com Cc: Dinesh Sellappan dinesh.sellappan@keysight.com; Mention mention@noreply.github.com Subject: Re: [open-traffic-generator/ixnetwork] AN is not gettign disabled to the last ports in a loop (#299)

CAUTION: This message originates from an external sender.

@selldineshhttps://urldefense.com/v3/__https:/github.com/selldinesh__;!!I5pVk4LIGAfnvw!2yNQouFZYMkqf0CfZo8GBxje1SN8GKYxswY-hB-H2saxPawTlXahf41qoFA61OU141Etz_E$ : Hi Dinesh, not able to reproduce this issue with my Novus 100G setup. Can you replace the tgen_ports with your ports and try to run this script. The validation part is added as well, would be easy to find out where it is failing

def test_issue_229(api):

PORT_COUNT = 4

auto_negotiate = False

ieee_media_defaults = False

link_training = False

rs_fec = False

tgen_ports = [{'location': '10.36.87.215;1;5'},

              {'location': '10.36.87.215;1;6'},

              {'location': '10.36.87.215;1;7'},

              {'location': '10.36.87.215;1;8'}]

config = api.config()

for i in range(1, PORT_COUNT+1):

    config.ports.port(name='Test Port %d' % i,

                      location=tgen_ports[i-1]['location'])

    config.devices.device(name='Topology %d' % i,

                          container_name=config.ports[i-1].name,

                          device_count=1)

config.options.port_options.location_preemption = True

def confLayer1():

    for i in range(1, PORT_COUNT+1):

        layer1 = config.layer1.layer1()[-1]

        layer1.name = '%s port settings' % config.ports[i-1].name

        layer1.port_names = [config.ports[i-1].name]

        layer1.ieee_media_defaults = False

        layer1.auto_negotiation.rs_fec = False

        layer1.auto_negotiation.link_training = False

        layer1.speed = "speed_100_gbps"

        layer1.auto_negotiate = False

confLayer1()

api.set_config(config)

validate_layer1_config(api,

                       auto_negotiate,

                       ieee_media_defaults,

                       link_training,

                       rs_fec)

def validate_layer1_config(api,

                       auto_negotiate,

                       ieee_media_defaults,

                       link_training,

                       rs_fec):

"""

Validate Layer1 Configs using Restpy

"""

ixnetwork = api._ixnetwork

for port in ixnetwork.Vport.find():

    print(port.Location)

    type = (port.Type)[0].upper() + (port.Type)[1:]

    assert getattr(port.L1Config, type).EnableAutoNegotiation \

        == auto_negotiate

    assert getattr(port.L1Config, type).IeeeL1Defaults \

        == ieee_media_defaults

    assert getattr(port.L1Config, type).EnableRsFec \

        == rs_fec

    assert getattr(port.L1Config, type).LinkTraining \

        == link_training```

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/open-traffic-generator/ixnetwork/issues/299*issuecomment-787716079__;Iw!!I5pVk4LIGAfnvw!2yNQouFZYMkqf0CfZo8GBxje1SN8GKYxswY-hB-H2saxPawTlXahf41qoFA61OU1OUCBBIs$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AJYBFH2I6UQK4S3V2WDERILTBM56DANCNFSM4YFSFROA__;!!I5pVk4LIGAfnvw!2yNQouFZYMkqf0CfZo8GBxje1SN8GKYxswY-hB-H2saxPawTlXahf41qoFA61OU1yM6Bbgg$.

ashutshkumr commented 3 years ago

@selldinesh any update on this ?

ANISH-GOTTAPU commented 3 years ago

closing the issue, please re-open if issue is seen again