From b3f7a5bb9f215b2fddb0ed44d9534b9868ad1fc8 Mon Sep 17 00:00:00 2001 From: rudranil Date: Fri, 25 Oct 2024 18:55:18 +0530 Subject: [PATCH] review comments closure --- feature/b2b/ospfv2/ospfv2_p2p_lsa_test.go | 66 +++++------------------ feature/b2b/ospfv2/test_ospfv2_p2p_lsa.py | 47 +++++----------- readme.md | 7 ++- 3 files changed, 32 insertions(+), 88 deletions(-) diff --git a/feature/b2b/ospfv2/ospfv2_p2p_lsa_test.go b/feature/b2b/ospfv2/ospfv2_p2p_lsa_test.go index 0a3f7e4..2c4883b 100644 --- a/feature/b2b/ospfv2/ospfv2_p2p_lsa_test.go +++ b/feature/b2b/ospfv2/ospfv2_p2p_lsa_test.go @@ -58,6 +58,10 @@ func TestOspfv2P2pLsa(t *testing.T) { ) } +// Please refer to ospfv2 model documentation under 'devices/[ospfv2]' of following url +// for more ospfv2 configuration attributes. +// model: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/master/artifacts/openapi.yaml&nocors#tag/Configuration/operation/set_config + func ospfv2P2pLsaConfig(api *otg.OtgApi, tc map[string]interface{}) gosnappi.Config { c := gosnappi.NewConfig() @@ -90,40 +94,24 @@ func ospfv2P2pLsaConfig(api *otg.OtgApi, tc map[string]interface{}) gosnappi.Con SetPrefix(tc["txPrefix"].(uint32)) dtxOspfv2 := dtx.Ospfv2(). - SetName(tc["txRouterName"].(string)) - - dtxOspfv2.RouterId().SetCustom(dtxIp.Address()) - dtxOspfv2.GracefulRestart().SetHelperMode(true) - - dtxOspfv2. - SetLsaRetransmitTime(4). - SetLsaRefreshTime(1800). - SetInterBurstLsuInterval(33). + SetName(tc["txRouterName"].(string)). SetStoreLsa(true) - dtxOspfv2.Capabilities(). - SetNpBit(true). - SetEBit(true) - dtxOspfv2Int := dtxOspfv2. Interfaces(). Add(). SetName("dtxOspfv2Int"). SetIpv4Name(dtxIp.Name()) + // Note: please change DUT default value for network-type from Broadcast to + // PointToPoint to make this test interoperable to a port-dut topology dtxOspfv2Int.NetworkType().PointToPoint() - dtxOspfv2Int.Advanced(). - SetHelloInterval(9). - SetDeadInterval(36). - SetPriority(0). - SetRoutingMetric(0) - dtxOspfv2RrV4 := dtxOspfv2. V4Routes(). Add(). SetName("dtxOspfv2RrV4"). - SetMetric(0) + SetMetric(10) dtxOspfv2RrV4. Addresses(). @@ -133,12 +121,6 @@ func ospfv2P2pLsaConfig(api *otg.OtgApi, tc map[string]interface{}) gosnappi.Con SetCount(tc["txRouteCount"].(uint32)). SetStep(1) - dtxOspfv2RrV4.RouteOrigin(). - InterArea(). - Flags(). - SetAFlag(true). - SetNFlag(true) - // recieve drxEth := drx.Ethernets(). Add(). @@ -157,40 +139,24 @@ func ospfv2P2pLsaConfig(api *otg.OtgApi, tc map[string]interface{}) gosnappi.Con SetPrefix(tc["rxPrefix"].(uint32)) drxOspfv2 := drx.Ospfv2(). - SetName(tc["rxRouterName"].(string)) - - drxOspfv2.RouterId().SetCustom(drxIp.Address()) - drxOspfv2.GracefulRestart().SetHelperMode(true) - - drxOspfv2. - SetLsaRetransmitTime(4). - SetLsaRefreshTime(1800). - SetInterBurstLsuInterval(33). + SetName(tc["rxRouterName"].(string)). SetStoreLsa(true) - drxOspfv2.Capabilities(). - SetNpBit(true). - SetEBit(true) - drxOspfv2Int := drxOspfv2. Interfaces(). Add(). SetName("drxOspfv2Int"). SetIpv4Name(drxIp.Name()) + // Note: please change DUT default value for network-type from Broadcast to + // PointToPoint to make this test interoperable to a port-dut topology drxOspfv2Int.NetworkType().PointToPoint() - drxOspfv2Int.Advanced(). - SetHelloInterval(9). - SetDeadInterval(36). - SetPriority(0). - SetRoutingMetric(0) - drxOspfv2RrV4 := drxOspfv2. V4Routes(). Add(). SetName("drxOspfv2RrV4"). - SetMetric(0) + SetMetric(10) drxOspfv2RrV4. Addresses(). @@ -200,12 +166,6 @@ func ospfv2P2pLsaConfig(api *otg.OtgApi, tc map[string]interface{}) gosnappi.Con SetCount(tc["rxRouteCount"].(uint32)). SetStep(1) - drxOspfv2RrV4.RouteOrigin(). - InterArea(). - Flags(). - SetAFlag(true). - SetNFlag(true) - // traffic for i := 1; i <= 2; i++ { flow := c.Flows().Add() @@ -281,7 +241,7 @@ func ospfv2P2pLsasOk(api *otg.OtgApi, tc map[string]interface{}) bool { // validate lsas nwSummaryLsas := m.NetworkSummaryLsas().Items() if len(nwSummaryLsas) == 1 && - nwSummaryLsas[0].Metric() == 0 && + nwSummaryLsas[0].Metric() == 10 && nwSummaryLsas[0].Header().AdvertisingRouterId() == advRouterId && nwSummaryLsas[0].Header().LsaId() == nwSummaryLsaId { lsaCount += 1 diff --git a/feature/b2b/ospfv2/test_ospfv2_p2p_lsa.py b/feature/b2b/ospfv2/test_ospfv2_p2p_lsa.py index 8b93d59..8b419e2 100644 --- a/feature/b2b/ospfv2/test_ospfv2_p2p_lsa.py +++ b/feature/b2b/ospfv2/test_ospfv2_p2p_lsa.py @@ -50,6 +50,11 @@ def test_ospfv2_p2p_lsa(): ) +# Please refer to ospfv2 model documentation under 'devices/[ospfv2]' of following url +# for more ospfv2 configuration attributes. +# model: https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/master/artifacts/openapi.yaml&nocors#tag/Configuration/operation/set_config + + def ospfv2_p2p_lsa_config(api, tc): c = api.api.config() ptx = c.ports.add(name="ptx", location=api.test_config.otg_ports[0]) @@ -73,32 +78,20 @@ def ospfv2_p2p_lsa_config(api, tc): dtx_ip.prefix = tc["txPrefix"] dtx.ospfv2.name = tc["txRouterName"] - dtx.ospfv2.router_id.custom = dtx_ip.address - - dtx.ospfv2.lsa_retransmit_time = 4 - dtx.ospfv2.lsa_refresh_time = 1800 - dtx.ospfv2.inter_burst_lsu_interval = 33 - dtx.ospfv2.graceful_restart.helper_mode = True dtx.ospfv2.store_lsa = True - dtx.ospfv2.capabilities.np_bit = True - dtx.ospfv2.capabilities.e_bit = True dtx_ospfv2_int = dtx.ospfv2.interfaces.add(name="dtx_ospfv2_int") dtx_ospfv2_int.ipv4_name = dtx_ip.name + + # Note: please change DUT default value for network-type from Broadcast to + # PointToPoint to make this test interoperable to a port-dut topology dtx_ospfv2_int.network_type.choice = dtx_ospfv2_int.network_type.POINT_TO_POINT - dtx_ospfv2_int.advanced.hello_interval = 9 - dtx_ospfv2_int.advanced.dead_interval = 36 - dtx_ospfv2_int.advanced.priority = 0 - dtx_ospfv2_int.advanced.routing_metric = 0 dtx_ospfv2_rr4 = dtx.ospfv2.v4_routes.add(name="dtx_ospfv2_rr4") + dtx_ospfv2_rr4.metric = 10 dtx_ospfv2_rr4.addresses.add( address=tc["txAdvRouteV4"], prefix=32, count=tc["txRouteCount"], step=1 ) - dtx_ospfv2_rr4.metric = 0 - dtx_ospfv2_rr4_origin = dtx_ospfv2_rr4.route_origin.inter_area - dtx_ospfv2_rr4_origin.flags.a_flag = True - dtx_ospfv2_rr4_origin.flags.n_flag = True # receive drx_eth = drx.ethernets.add(name="drx_eth") @@ -112,32 +105,20 @@ def ospfv2_p2p_lsa_config(api, tc): drx_ip.prefix = tc["rxPrefix"] drx.ospfv2.name = tc["rxRouterName"] - drx.ospfv2.router_id.custom = drx_ip.address - - drx.ospfv2.lsa_retransmit_time = 4 - drx.ospfv2.lsa_refresh_time = 1800 - drx.ospfv2.inter_burst_lsu_interval = 33 - drx.ospfv2.graceful_restart.helper_mode = True drx.ospfv2.store_lsa = True - drx.ospfv2.capabilities.np_bit = True - drx.ospfv2.capabilities.e_bit = True drx_ospfv2_int = drx.ospfv2.interfaces.add(name="drx_ospfv2_int") drx_ospfv2_int.ipv4_name = drx_ip.name + + # Note: please change DUT default value for network-type from Broadcast to + # PointToPoint to make this test interoperable to a port-dut topology drx_ospfv2_int.network_type.choice = drx_ospfv2_int.network_type.POINT_TO_POINT - drx_ospfv2_int.advanced.hello_interval = 9 - drx_ospfv2_int.advanced.dead_interval = 36 - drx_ospfv2_int.advanced.priority = 0 - drx_ospfv2_int.advanced.routing_metric = 0 drx_ospfv2_rr4 = drx.ospfv2.v4_routes.add(name="drx_ospfv2_rr4") + drx_ospfv2_rr4.metric = 10 drx_ospfv2_rr4.addresses.add( address=tc["rxAdvRouteV4"], prefix=32, count=tc["rxRouteCount"], step=1 ) - drx_ospfv2_rr4.metric = 0 - drx_ospfv2_rr4_origin = drx_ospfv2_rr4.route_origin.inter_area - drx_ospfv2_rr4_origin.flags.a_flag = True - drx_ospfv2_rr4_origin.flags.n_flag = True # traffic for i in range(0, 2): @@ -209,7 +190,7 @@ def ospfv2_lsas_ok(api, tc): # validate lsas if ( len(m.network_summary_lsas) == 1 - and m.network_summary_lsas[0].metric == 0 + and m.network_summary_lsas[0].metric == 10 and m.network_summary_lsas[0].header.advertising_router_id == adv_router_id and m.network_summary_lsas[0].header.lsa_id == nw_summary_lsa_id ): diff --git a/readme.md b/readme.md index a5f0f93..e6ee67b 100644 --- a/readme.md +++ b/readme.md @@ -12,8 +12,11 @@ This repository hosts equivalent Go and Python tests written using [snappi](http - Go 1.17+ or Python 3.6+ (with pip) - Docker Engine (Community Edition) - License: - - depending on ixia-c test platform in use, usage and scale of protocols and traffic, - there might be need of ixia-c licenses. For details, please refer to [ixia-c licensing documentation](https://github.com/open-traffic-generator/ixia-c/blob/main/docs/reference/licensing.md) or contact [ixia-c support](https://github.com/open-traffic-generator/ixia-c/blob/main/docs/support.md). + - Test(s) in this repository which contain only 'flows' or 'bgp' would not require license + with ixia-c. + - License of ixia-c would be required for test(s) which use other control-plane protocols e.g. 'isis', + 'lacp', "ospfv2" etc. + - For further details, please refer to [ixia-c licensing documentation](https://github.com/open-traffic-generator/ixia-c/blob/main/docs/reference/licensing.md) or contact [ixia-c support](https://github.com/open-traffic-generator/ixia-c/blob/main/docs/support.md). ### Usage: