Closed ANISH-GOTTAPU closed 2 years ago
Chained DG Compaction is not happening for VXLAN.
def test_vxlan_compact(api, utils): count = 4 config = api.config() edge1_macs = get_macs("001801000011", count) edge2_macs = get_macs("001601000011", count) p1, p2 = config.ports.port( name="tx", location=utils.settings.ports[0] ).port(name="rx", location=utils.settings.ports[1]) d1, d2 = config.devices.device(name="d1").device(name="d2") api.enable_scaling(True) e1, e2 = d1.ethernets.ethernet()[-1], d2.ethernets.ethernet()[-1] e1.port_name, e2.port_name = p1.name, p2.name e1.name, e2.name = "e1", "e2" e1.mac, e2.mac = "00:01:00:00:00:01", "00:01:00:00:00:02" ip1, ip2 = e1.ipv4_addresses.add(), e2.ipv4_addresses.add() ip1.name, ip2.name = "ip_d1", "ip_d2" ip1.address, ip2.address = "10.10.10.1", "10.10.10.2" ip1.gateway, ip2.gateway = "10.10.10.2", "10.10.10.1" bgp1, bgp2 = d1.bgp, d2.bgp bgp1.router_id, bgp2.router_id = "10.10.10.1", "10.10.10.2" bgp1_ipv4 = bgp1.ipv4_interfaces.add() bgp2_ipv4 = bgp2.ipv4_interfaces.add() bgp1_ipv4.ipv4_name, bgp2_ipv4.ipv4_name = ip1.name, ip2.name bgp1_peer, bgp2_peer = bgp1_ipv4.peers.add(), bgp2_ipv4.peers.add() bgp1_peer.name, bgp2_peer.name = "bgp_router1", "bgp_router2" bgp1_peer.peer_address, bgp2_peer.peer_address = "10.10.10.2", "10.10.10.1" bgp1_peer.as_type, bgp2_peer.as_type = "ebgp", "ebgp" bgp1_peer.as_number, bgp2_peer.as_number = 100, 200 # Create & advertise loopback under bgp in d1 & d2 d1_l1 = d1.ipv4_loopbacks.add() d1_l1.name = "d1_loopback1" d1_l1.eth_name = "e1" d1_l1.address = "1.1.1.1" bgp1_l1 = bgp1_peer.v4_routes.add(name="bgp_l1") bgp1_l1.addresses.add(address="1.1.1.1", prefix=32) d2_l1 = d2.ipv4_loopbacks.add() d2_l1.name = "d2_loopback1" d2_l1.eth_name = "e2" d2_l1.address = "2.2.2.2" bgp2_l1 = bgp2_peer.v4_routes.add(name="bgp2_l1") bgp2_l1.addresses.add(address="2.2.2.2", prefix=32) # Create vxlan on d1 d1_vxlan = d1.vxlan.v4_tunnels.add() d1_vxlan.vni = 1000 d1_vxlan.source_interface = d1_l1.name d1_vxlan.name = "d1_vxlan" # unicast communication vtep = d1_vxlan.destination_ip_mode.unicast.vteps.add() vtep.remote_vtep_address = "2.2.2.2" for i in range(1, count + 1): vtep.arp_suppression_cache.add(edge2_macs[i], "100.1.{}.2".format(i)) # Create vxlan on d2 d2_vxlan = d2.vxlan.v4_tunnels.add() d2_vxlan.vni = 1000 d2_vxlan.source_interface = d2_l1.name d2_vxlan.name = "d2_vxlan" # unicast communication vtep = d2_vxlan.destination_ip_mode.unicast.vteps.add() vtep.remote_vtep_address = "1.1.1.1" for i in range(1, count + 1): vtep.arp_suppression_cache.add(edge1_macs[i], "100.1.{}.1".format(i)) for i in range(1, count + 1): edge1_d = config.devices.device(name="edge1_d{}".format(i))[-1] edge2_d = config.devices.device(name="edge2_d{}".format(i))[-1] edge1_e = edge1_d.ethernets.ethernet()[-1] edge2_e = edge2_d.ethernets.ethernet()[-1] edge1_e.connection.vxlan_name = "d1_vxlan" edge2_e.connection.vxlan_name = "d2_vxlan" edge1_e.name = "edge1_e{}".format(i) edge2_e.name = "edge2_e{}".format(i) edge1_e.mac = edge1_macs[i] edge2_e.mac = edge2_macs[i] edge1_ip = edge1_e.ipv4_addresses.add() edge2_ip = edge2_e.ipv4_addresses.add() edge1_ip.name = "edge1_ip_d{}".format(i) edge2_ip.name = "edge2_ip_d{}".format(i) edge1_ip.address = "100.1.{}.1".format(i) edge2_ip.address = "100.1.{}.2".format(i) edge1_ip.gateway = "100.1.{}.2".format(i) edge2_ip.gateway = "100.1.{}.1".format(i) edge1_bgp, edge2_bgp = edge1_d.bgp, edge2_d.bgp edge1_bgp.router_id = "100.1.{}.1".format(i) edge2_bgp.router_id = "100.1.{}.2".format(i) edge1_bgp_ipv4 = edge1_bgp.ipv4_interfaces.add() edge2_bgp_ipv4 = edge2_bgp.ipv4_interfaces.add() edge1_bgp_ipv4.ipv4_name = "edge1_ip_d{}".format(i) edge2_bgp_ipv4.ipv4_name = "edge2_ip_d{}".format(i) edge1_bgp_peer = edge1_bgp_ipv4.peers.add() edge2_bgp_peer = edge2_bgp_ipv4.peers.add() edge1_bgp_peer.name = "edge1_bgp{}".format(i) edge2_bgp_peer.name = "edge2_bgp{}".format(i) edge1_bgp_peer.peer_address = "100.1.{}.2".format(i) edge2_bgp_peer.peer_address = "100.1.{}.1".format(i) edge1_bgp_peer.as_type, edge2_bgp_peer.as_type = "ibgp", "ibgp" edge1_bgp_peer.as_number, edge2_bgp_peer.as_number = 1000, 1000 edge1_bgp_rr = edge1_bgp_peer.v4_routes.add(name="A1{}".format(i)) edge1_bgp_rr.addresses.add( address="1.1.0.{}".format(i), count=180, prefix=32 ) edge1_bgp_rr2 = edge1_bgp_peer.v4_routes.add(name="D1{}".format(i)) edge1_bgp_rr2.addresses.add( address="2.1.0.{}".format(i), count=1, prefix=32 ) edge2_bgp_rr = edge2_bgp_peer.v4_routes.add(name="A2{}".format(i)) edge2_bgp_rr.addresses.add( address="3.1.0.{}".format(i), count=180, prefix=32 ) edge2_bgp_rr2 = edge2_bgp_peer.v4_routes.add(name="D2{}".format(i)) edge2_bgp_rr2.addresses.add( address="4.1.0.{}".format(i), count=1, prefix=32 ) a1_routes = ["A1{}".format(i) for i in range(1, count + 1)] d1_routes = ["D1{}".format(i) for i in range(1, count + 1)] a2_routes = ["A2{}".format(i) for i in range(1, count + 1)] d2_routes = ["D2{}".format(i) for i in range(1, count + 1)] flow = config.flows.flow(name="f1")[-1] flow.tx_rx.device.tx_names = a1_routes + d1_routes flow.tx_rx.device.rx_names = a2_routes + d2_routes flow.duration.fixed_packets.packets = count * 10 flow.metrics.enable = True flow.metrics.loss = True utils.start_traffic(api, config, start_capture=False) utils.wait_for( lambda: results_ok(api, ["f1"], count * 10), "stats to be as expected", timeout_seconds=30, ) utils.stop_traffic(api, config) def get_macs(mac, count, offset=1): """ Take mac as start mac returns the count of macs in a list """ mac_list = list() for i in range(count + 1): mac_address = "{:012X}".format(int(mac, 16) + offset * i) mac_address = ":".join( format(s, "02x") for s in bytearray.fromhex(mac_address) ) mac_list.append(mac_address) return mac_list def results_ok(api, flow_names, expected): """ Returns True if there is no traffic loss else False """ request = api.metrics_request() request.flow.flow_names = flow_names flow_results = api.get_metrics(request).flow_metrics flow_rx = sum([f.frames_rx for f in flow_results]) return flow_rx == expected if __name__ == "__main__": pytest.main(["-s", __file__])
Problem Statement: The left most DGs should be compacted but it is not happening
Chained DG Compaction is not happening for VXLAN.
Problem Statement: The left most DGs should be compacted but it is not happening