Example #1
0
def main():
	print("""
#Description: Stop traffic generators
#Procedure:
#1 - Delete all traffic generator containers.
""")

	parser = argparse.ArgumentParser()
	parser.add_argument("--config", help="Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml")
	args = parser.parse_args()


	tree=etree.parse(args.config)
	network = tree.xpath('/nc:config/nd:networks/nd:network', namespaces=namespaces)[0]

	conns = tntapi.network_connect(network)
	yconns = tntapi.network_connect_yangrpc(network)

	mylinks = tntapi.parse_network_links(network)


	print("#1 - Stop all traffic generators.")
	nodes = network.xpath('nd:node', namespaces=namespaces)
	for node in nodes:
		node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
		config=""

		termination_points = node.xpath('./nt:termination-point', namespaces=namespaces)
		for termination_point in termination_points:
			tp_id = termination_point.xpath('nt:tp-id', namespaces=namespaces)[0].text
			result=yangcli(yconns[node_id],"""delete /interfaces/interface[name='%(name)s']/traffic-generator"""%{'name':tp_id})

	tntapi.network_commit(conns)
Example #2
0
def validate_step_1(before, after):
    mylinks = tntapi.parse_network_links(before)
    t1 = tntapi.parse_network_nodes(before)
    t2 = tntapi.parse_network_nodes(after)
    delta = tntapi.get_network_counters_delta(before, after)

    testsuiteapi.print_state(before, after)

    print("#1.1 - Validate no counters are being incremented.")
    #validate no counters were incremented
    for node in {"local", "middle"}:
        for if_name in {
                "ge0", "ge1", "ge2", "ge3", "ge4", "ge5", "ge6", "ge7", "ge8",
                "ge9"
        }:
            interface = delta[node][if_name]
            increment = 0
            for v in dir(interface):
                if not v[0].startswith(
                        '_') and not v == 'count' and not v == 'index':
                    value = getattr(interface, v)
                    if (value != None and value != 0):
                        print node + ":" + if_name + "." + v + "=" + str(value)
                        #assert(0)
                        increment = increment + 1
        if (increment == 0):
            print node + ":" + if_name + " has no incremented counters"
Example #3
0
def main():
    print("""
#Description: Setup fusion streams
#Procedure:
#1 - Load the fusion streams configuration on the local and remote h100.
#1.1 - Validate all analyzer interfaces have oper-status=up.
#1.2 - Validate no counters are being incremented.
""")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)

    mylinks = tntapi.parse_network_links(network)

    filter = testsuiteapi.get_filter()

    print("#Running ...")
    print(
        "#1 - Load the fusion streams configuration on the local and remote h100."
    )
    step_1(network, conns, yconns, filter=filter)
Example #4
0
def validate_step_1(before, after):
	mylinks = tntapi.parse_network_links(before)
	t1 = tntapi.parse_network_nodes(before)
	t2 = tntapi.parse_network_nodes(after)
	delta = tntapi.get_network_counters_delta(before,after)

	testsuiteapi.print_state(before, after)

	print("#1.1 - Validate all analyzer interfaces have oper-status=up.")
	for node in {"local", "remote"}:
		for if_name in {"xe0", "ge15", "ge0"}:
			interface = delta[node][if_name]
			for v in dir(interface):
				if not v[0].startswith('_') and not v=='count' and not v=='index':
					value = getattr(interface,v)
					if(value!=None and value!=0):
						print node + ":" + if_name + "." + v + "=" + str(value)
						assert(0)
	for node in {"middle"}:
		for if_name in {"ge0", "ge1", "xe0", "xe1"}:
			interface = delta[node][if_name]
			for v in dir(interface):
				if not v[0].startswith('_') and not v=='count' and not v=='index':
					value = getattr(interface,v)
					if(value!=None and value!=0):
						print node + ":" + if_name + "." + v + "=" + str(value)
						assert(0)
def validate_init(before, after):
    mylinks = tntapi.parse_network_links(before)
    t1 = tntapi.parse_network_nodes(before)
    t2 = tntapi.parse_network_nodes(after)
    delta = tntapi.get_network_counters_delta(before, after)

    testsuiteapi.print_state(before, after)
    after = tntapi.strip_namespaces(after)

    #validate no counters were incremented
    for node in {"analyzer"}:
        for if_name in {"ge0", "ge1", "xe0", "xe1"}:
            interface = delta[node][if_name]
            for v in dir(interface):
                if not v[0].startswith(
                        '_') and not v == 'count' and not v == 'index':
                    value = getattr(interface, v)
                    if (value != None and value != 0):
                        print node + ":" + if_name + "." + v + "=" + str(value)
                        assert (0)
    for node in {"local", "remote"}:
        for if_name in {"xe0", "ge15", "ge0"}:
            interface = delta[node][if_name]
            for v in dir(interface):
                if not v[0].startswith(
                        '_') and not v == 'count' and not v == 'index':
                    value = getattr(interface, v)
                    if (value != None and value != 0):
                        print node + ":" + if_name + "." + v + "=" + str(value)
                        assert (0)
Example #6
0
def main():
    print("""
#Description: Stat traffic
#Procedure:
#1 - Start traffic generators on the local and middle h100 ge0-9 interfaces.
#1.1 - Validate counters are being incremented.
""")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)

    mylinks = tntapi.parse_network_links(network)

    filter = testsuiteapi.get_filter()

    print("#Running ...")
    print(
        "#1 - Start traffic generators on the local and middle h100 ge0-9 interfaces."
    )
    step_1(network, conns, yconns, filter=filter)
def main():
    print("""
#Description: Stop traffic generators
#Procedure:
#1 - Delete all traffic generator containers.
""")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    mylinks = tntapi.parse_network_links(network)

    print("#1 - Stop all traffic generators.")
    nodes = network.xpath('nd:node', namespaces=namespaces)
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            os.system(
                """curl -X DELETE -H "Content-Type: application/json" -H "Accept: application/json" --user admin:admin http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/%s/yang-ext:mount/ietf-interfaces:interfaces/interface/%s/transpacket-traffic-generator:traffic-generator"""
                % (node_id, tp_id))
def main():
	print("""
<test-spec>
===Objective===
In iterrative steps reproduce the configuration example presented as part of the User Guide Complex Loopback Example
===Procedure===
Only the analyzer.ge0 (1G) and analyzer.xe0 (10G) generators are used. Note there is significant difference from the original userguide example. The 1G traffic is GST and the 10G generator is SM.
In itterative steps loopbacks are created so that the SM traffic forms a serpentine going through a loopback on each of the ge1-ge9 interfaces and the xe0 (n1) while GST is multicasted to all ge1-ge9 interfaces and after contention returned to the origin.
After each iterrative step the traffic generated should return with the corresponding traffic class properties.
===DUT configuration===
This testcase is enhancing the [[H100_r.1.6_NETCONF/YANG_usecase_examples_using_the_low_level_Fusion_core_model#Complex_loopback_example]] configuration by adding identical data paths for ge4-9 interfaces.

====Steps====
# Create near-end loopbacks on xe0 and ge0-9.
# Configure the DUT to aggregte ingress SM traffic from ep0 to np1 with vlan tag vlan-id=vlan_id_base(=100)+1 and forward ingress from np1 with vlan tag to ep0 after removing the tag.
## Generate traffic on ep0 and validate traffic returns without losses.
# Change the configuration so that ingress traffic on np1 with vlan tag is forwarded to ep1 instead of ep0. Create near-end loopback on ep1. Configure multiplexed sm/gst mode and forward ingress SM traffic to np1 with vlan-id=vlan_id_base+1 and forward the returning ingress traffic back to ep0.
##assert(delta["analyzer"]['xe0'].testframe_payload_errors==0)
##assert(delta["analyzer"]['xe0'].out_pkts>=1000000)
##assert(delta["analyzer"]['xe0'].out_pkts==delta["analyzer"]['xe0'].in_pkts+sum)
##assert(delta["analyzer"]['xe0'].out_pkts==delta["analyzer"]['xe0'].in_pkts)
##assert(delta["analyzer"]['xe0'].testframe_sequence_errors<=1)
##assert(delta["analyzer"]['ge0'].testframe_payload_errors==0)
##assert(delta["analyzer"]['ge0'].out_pkts>=1000000)
##assert(delta["analyzer"]['ge0'].in_pkts>=1000000)
##assert((delta["analyzer"]['ge0'].in_pkts+delta["local"]['ge15'].fusion_np_tx_gst_multicast_contentions)==delta["analyzer"]['ge0'].out_pkts)
##assert(step==2 or delta["analyzer"]['ge0'].out_pkts==(sum(delta["local"][interface].fusion_ep_to_np0_gst_multicast_contentions))/(step-2)))
##assert(gst_pdv<400)
# Repeat the previous step for all remaining ge2-9 ports.

===Results===
# N.A.
===Acceptance criteria===
# N.A.

</test-spec>
""")

	parser = argparse.ArgumentParser()
	parser.add_argument("--config", help="Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml")
	args = parser.parse_args()


	tree=etree.parse(args.config)
	network = tree.xpath('/nc:config/nd:networks/nd:network', namespaces=namespaces)[0]

	conns = tntapi.network_connect(network)
	yconns = tntapi.network_connect_yangrpc(network)
	mylinks = tntapi.parse_network_links(network)

	filter = testsuiteapi.get_filter()

	init(network, conns, yconns, filter)
	step_1(network, conns, yconns, filter)
	for step in range(1,10):
		step_common(network, conns, yconns, filter, step+1)
	terminate(network, conns, yconns, filter)
def validate_step_common(before, after, step, with_sm, with_gst):
	mylinks = tntapi.parse_network_links(before)
	t1 = tntapi.parse_network_nodes(before)
	t2 = tntapi.parse_network_nodes(after)
	delta = tntapi.get_network_counters_delta(before,after)

        testsuiteapi.print_state(before, after)
        after=tntapi.strip_namespaces(after)

	print("#1.1 - Asserts for step_%d."%(step))
	if(with_sm):
		assert(delta["analyzer"]['xe0'].testframe_payload_errors==0)
		latency_min=after.xpath("node[node-id='analyzer']/data/interfaces-state/interface[name='xe0']/traffic-analyzer/testframe-stats/latency/min")[0].text
		latency_max=after.xpath("node[node-id='analyzer']/data/interfaces-state/interface[name='xe0']/traffic-analyzer/testframe-stats/latency/max")[0].text

		pdv=int(latency_max)-int(latency_min)
		print("SM LAT_MIN=%d ns"%(int(latency_min)))
		print("SM LAT_MAX=%d ns"%(int(latency_max)))
		print("SM PDV=%d ns"%(pdv))

		assert(delta["analyzer"]['xe0'].out_pkts>=1000000)
		sum=0;
		for interface in {"ge0", "ge1", "ge2", "ge3", "ge4", "ge5", "ge6", "ge7", "ge8", "ge9"}:
			sum=sum+delta["local"][interface].fusion_ep_to_np1_sm_buf_overflows
			sum=sum+delta["local"][interface].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows
		print("sum(fusion_ep_to_np1_sm_buf_overflows+fusion_np1_to_ep_sm_drop_reinsert_buf_overflows)=%d"%(sum))
		if(step>=2):
			assert(delta["analyzer"]['xe0'].out_pkts==delta["analyzer"]['xe0'].in_pkts+sum)
			#assert(delta["analyzer"]['xe0'].testframe_sequence_errors==sum)
		else:
			assert(delta["analyzer"]['xe0'].out_pkts==delta["analyzer"]['xe0'].in_pkts)
			assert(sum==0)
			assert(delta["analyzer"]['xe0'].testframe_sequence_errors<=1)

	if(with_gst):
		assert(delta["analyzer"]['ge0'].testframe_payload_errors==0)
		assert(delta["analyzer"]['ge0'].out_pkts>=1000000)
		assert(delta["analyzer"]['ge0'].in_pkts>=1000000)
		assert((delta["analyzer"]['ge0'].in_pkts+delta["local"]['ge15'].fusion_np_tx_gst_multicast_contentions)==delta["analyzer"]['ge0'].out_pkts)
		sum=0;
		for interface in {"ge1", "ge2", "ge3", "ge4", "ge5", "ge6", "ge7", "ge8", "ge9"}:
			sum=sum+delta["local"][interface].fusion_ep_to_np0_gst_multicast_contentions

		print("sum(fusion_ep_to_np0_gst_multicast_contentions)=%d"%(sum))
		assert(step==2 or delta["analyzer"]['ge0'].out_pkts==(sum/(step-2)))
		latency_min=after.xpath("node[node-id='analyzer']/data/interfaces-state/interface[name='ge0']/traffic-analyzer/testframe-stats/latency/min")[0].text
		latency_max=after.xpath("node[node-id='analyzer']/data/interfaces-state/interface[name='ge0']/traffic-analyzer/testframe-stats/latency/max")[0].text
		pdv=int(latency_max)-int(latency_min)
		print("GST LAT_MIN=%d ns"%(int(latency_min)))
		print("GST LAT_MAX=%d ns"%(int(latency_max)))
		print("GST PDV=%d ns"%(pdv))
		assert(pdv<400)


	print("OK!")
def validate_step_1(before, after):
    mylinks = tntapi.parse_network_links(before)
    t1 = tntapi.parse_network_nodes(before)
    t2 = tntapi.parse_network_nodes(after)
    delta = tntapi.get_network_counters_delta(before, after)

    testsuiteapi.print_state(before, after)
    after = tntapi.strip_namespaces(after)

    print("#1.1 - Validate all packets are received at their destinations.")

    assert (delta["analyzer"]["ge0"].in_unicast_pkts == 0
            )  #total-frames not always implemented
    assert (delta["analyzer"]["ge1"].in_unicast_pkts == 0
            )  #total-frames not always implemented
    assert (delta["analyzer"]["xe0"].out_unicast_pkts >= 1000000)
    assert (delta["analyzer"]["xe1"].out_unicast_pkts >= 1000000)
    assert (delta["analyzer"]["xe1"].out_unicast_pkts -
            delta["analyzer"]["xe0"].in_unicast_pkts == delta["local"]
            ["ge0"].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows)
    assert (delta["analyzer"]["xe0"].out_unicast_pkts -
            delta["analyzer"]["xe1"].in_unicast_pkts == delta["remote"]
            ["ge0"].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows)
    pkt_loss_remote_local = 100 * float(
        delta["analyzer"]["xe1"].out_unicast_pkts - delta["analyzer"]
        ["xe0"].in_unicast_pkts) / delta["analyzer"]["xe1"].out_unicast_pkts
    print("pkt_loss_remote_local=%f" % (pkt_loss_remote_local))
    assert (pkt_loss_remote_local < 0.5)
    pkt_loss_local_remote = 100 * float(
        delta["analyzer"]["xe0"].out_unicast_pkts - delta["analyzer"]
        ["xe1"].in_unicast_pkts) / delta["analyzer"]["xe0"].out_unicast_pkts
    print("pkt_loss_local_remote=%f" % (pkt_loss_local_remote))
    assert (pkt_loss_local_remote < 0.5)

    print(
        "#1.2 - Validate there are no testframe payload errors and testframe sequence errors are <=1."
    )
    assert (delta["analyzer"]["xe0"].testframe_pkts == delta["analyzer"]
            ["xe0"].in_unicast_pkts)
    assert (delta["analyzer"]["xe0"].testframe_sequence_errors <= (
        delta["local"]["ge0"].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows +
        1))
    assert (delta["analyzer"]["xe0"].testframe_payload_errors == 0)
    assert (delta["analyzer"]["xe1"].testframe_pkts == delta["analyzer"]
            ["xe1"].in_unicast_pkts)
    assert (
        delta["analyzer"]["xe1"].testframe_sequence_errors <=
        (delta["remote"]["ge0"].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows
         + 1))
    assert (delta["analyzer"]["xe1"].testframe_payload_errors == 0)

    return (pkt_loss_remote_local, pkt_loss_local_remote)
Example #11
0
def validate_step_common(before, after, step):
    mylinks = tntapi.parse_network_links(before)
    t1 = tntapi.parse_network_nodes(before)
    t2 = tntapi.parse_network_nodes(after)
    delta = tntapi.get_network_counters_delta(before, after)

    testsuiteapi.print_state(before, after)
    after = tntapi.strip_namespaces(after)

    print("#1.1 - Asserts for step_%d." % (step))
    if (step == 2):
        interfaces_off = {"ge5", "ge6", "ge7", "ge8", "ge9"}
        interfaces_on = {"ge0", "ge1", "ge2", "ge3", "ge4"}
    else:
        interfaces_off = {}
        interfaces_on = {
            "ge0", "ge1", "ge2", "ge3", "ge4", "ge5", "ge6", "ge7", "ge8",
            "ge9"
        }

    total_expected_xe0 = 0
    for if_name in interfaces_on:

        print("Checking on: " + if_name)
        assert (delta["remote"][if_name].out_pkts >= 1000000)
        assert (delta["remote"][if_name].out_pkts == delta["remote"]
                [if_name].in_pkts)
        assert (
            (delta["remote"][if_name].in_pkts -
             delta["local"][if_name].out_pkts) == (
                 delta["remote"][if_name].fusion_ep_to_np1_sm_buf_overflows +
                 delta["local"]
                 [if_name].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows))
        if (step == 2):
            assert (delta["remote"][if_name].fusion_ep_to_np1_sm_buf_overflows
                    > 0)
        else:
            assert (delta["remote"][if_name].fusion_ep_to_np1_sm_buf_overflows
                    == 0)

        total_expected_xe0 = total_expected_xe0 + delta["local"][
            if_name].out_pkts

    #assert(total_expected_xe0==delta["local"]["xe0"].out_pkts)

    for if_name in interfaces_off:
        print("Checking off: " + if_name)
        assert (delta["local"][if_name].out_pkts == 0)

    print("Reults!")
    time.sleep(10)
Example #12
0
def main():
    print("""
<test-spec>
===Objective===
Test validating fusion-ep-to-np1-sm-buf-overflows counter registers all SM packets lost due to buffer overflows.
===Procedure===
Generate point-to-point packet streams with TPID=ABCD from remote.ep0-9 to local.ep0-9. Each stream should be as close as possible to the 100% throughput limit so that packet loss due to buf overflow is guaranteed to happen when GST stream with minimal length packets are enabled on remote.ge5-9.
===DUT configuration===
This testcase is enhancing the [[VCU-110_Prototype_r1.6#FPGA_Setup]] configuration by adding identical data paths for ge5-9 interfaces.

====Steps====
# Create near-end loopbacks and generate SM streams of 1500 octet packets and 12 octet interframe gaps from remote.ge0-4 and GST streams of 64 octet frames with 12 octet interframe gaps form remote remote.ge5-ge9
## Assert for name:ge0-4  delta["remot"][name].out_pkts==delta["remote"][name].in_pkts>=1000000
## Assert for name:ge0-4  delta["local"][name].out_pkts==delta["remote"][name].in_pkts
## Assert delta["remote"][name].fusion_ep_to_np1_sm_buf_overflows==0
# Identical to Step 2 but generate SM traffic on all interfaces
## Assert for name:ge0-4  delta["remot"][name].out_pkts==delta["remote"][name].in_pkts>=1000000
## Assert for name:ge0-4  delta["local"][name].out_pkts==delta["remote"][name].in_pkts-delta["remote"][name].fusion_ep_to_np1_sm_buf_overflows
# Repeat the first step.
===Results===
# N.A.
===Acceptance criteria===
# assert((local_pkts_received-remote_pkts_sent==sm_buf_overflows)

</test-spec>
""")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)
    mylinks = tntapi.parse_network_links(network)

    filter = testsuiteapi.get_filter()

    init(network, conns, yconns, filter=filter)
    step_1(network, conns, filter=filter)
    step_2(network, conns, yconns, filter=filter)
    step_3(network, conns, filter=filter)
    terminate(network, conns, yconns, filter=filter)
def validate_step_2_4(before, after, name):
	mylinks = tntapi.parse_network_links(before)
	t1 = tntapi.parse_network_nodes(before)
	t2 = tntapi.parse_network_nodes(after)
	delta = tntapi.get_network_counters_delta(before,after)

        testsuiteapi.print_state(before, after)
	after=tntapi.strip_namespaces(after)

	print("#x.1 - Verify all packets are forwarded to their destinations.")

	assert(delta["analyzer"][name].out_unicast_pkts>=1000000) #total-frames not always implemented
	assert(delta["analyzer"]["ge0"].in_unicast_pkts==delta["analyzer"][name].out_unicast_pkts)

	latency_to_ge0=after.xpath("node[node-id='analyzer']/data/interfaces-state/interface[name='ge0']/traffic-analyzer/testframe-stats/latency/min")[0].text

	return int(latency_to_ge0)
def validate_step1(before, after):
    mylinks = tntapi.parse_network_links(before)
    t1 = tntapi.parse_network_nodes(before)
    t2 = tntapi.parse_network_nodes(after)
    delta = tntapi.get_network_counters_delta(before, after)

    testsuiteapi.print_state(before, after)

    print("#1.1 - Asserts for step_1.")

    assert (delta["analyzer"]["xe0"].out_unicast_pkts >= 1000000)
    assert (delta["analyzer"]["xe1"].out_unicast_pkts >= 1000000)
    assert (delta["analyzer"]["ge0"].in_unicast_pkts >= 1000000)
    assert (
        delta["local"]["ge0"].fusion_ep_to_np0_gst_multicast_contentions == 0)
    #	assert(delta["analyzer"]["ge0"].in_unicast_pkts==delta["analyzer"]["xe0"].out_unicast_pkts+delta["analyzer"]["xe1"].out_unicast_pkts-delta["local"]["ge15"].fusion_np_tx_gst_multicast_contentions)

    #latency_to_xe0=after.xpath("node[node-id='analyzer']/data/interfaces-state/interface[name='xe0']/traffic-analyzer/testframe-stats/latency/min")[0].text

    local_pkts_sent = delta["analyzer"]["xe0"].out_unicast_pkts
    remote_pkts_sent = delta["analyzer"]["xe1"].out_unicast_pkts
    total_pkts_received = delta["analyzer"]["ge0"].in_unicast_pkts
    contentions = delta["local"]["ge15"].fusion_np_tx_gst_multicast_contentions
    return local_pkts_sent, remote_pkts_sent, total_pkts_received, contentions
Example #15
0
def validate_step_1(before, after):
	mylinks = tntapi.parse_network_links(before)
	t1 = tntapi.parse_network_nodes(before)
	t2 = tntapi.parse_network_nodes(after)
	delta = tntapi.get_network_counters_delta(before,after)

        testsuiteapi.print_state(before, after)
	after=tntapi.strip_namespaces(after)

	print("#1.1 - Validate all analyzer interfaces have oper-status=up.")
	for node in {"analyzer"}:
		for if_name in {"ge0", "ge1", "xe0", "xe1"}:
			print "Checking %(node)s[%(if_name)s]"%{'node':node, 'if_name':if_name}
			oper_status=after.xpath("node[node-id='%(node)s']/data/interfaces-state/interface[name='%(if_name)s']/oper-status"%{'node':node, 'if_name':if_name})[0].text
			assert(oper_status=='up')

	print("#1.2 - Validate no counters are being incremented.")
	#validate no counters were incremented
	for node in {"analyzer"}:
		for if_name in {"ge0", "ge1", "xe0", "xe1"}:
			interface = delta[node][if_name]
			for v in dir(interface):
				if not v[0].startswith('_') and not v=='count' and not v=='index':
					value = getattr(interface,v)
					if(value!=None and value!=0):
						print node + ":" + if_name + "." + v + "=" + str(value)
						assert(0)
	for node in {"local", "remote"}:
		for if_name in {"xe0", "ge15", "ge0"}:
			interface = delta[node][if_name]
			for v in dir(interface):
				if not v[0].startswith('_') and not v=='count' and not v=='index':
					value = getattr(interface,v)
					if(value!=None and value!=0):
						print node + ":" + if_name + "." + v + "=" + str(value)
						assert(0)
Example #16
0
	parser.add_argument('--dst-ipv4-address', default="192.168.0.2",help="Destination ipv4 address.")
	parser.add_argument('--src-ipv4-udp-port', default="",help="Source ipv4 UDP port.")
	parser.add_argument('--dst-ipv4-udp-port', default="7",help="Destination ipv4 UDP port.")
	parser.add_argument('--ipv4-ttl', default="10",help="ipv4 TTL field.")
	parser.add_argument('--speed', default="1000000000",help="Maximum interface speed in bits per second e.g 1000000000 for 1Gb Ethernet interface.")
	parser.add_argument('--trial-time', default="2",help="Time each trial takes in seconds.")
	parser.add_argument('--testframe-type', default="dynamic",help="Type of generated testframe e.g. static or dynamic")

	args = parser.parse_args()

	tree=etree.parse(args.config)
	network = tree.xpath('/nc:config/nd:networks/nd:network', namespaces=namespaces)[0]

	conns = tntapi.network_connect(network)
	yconns = tntapi.network_connect_yangrpc(network)
	mylinks = tntapi.parse_network_links(network)

	assert(conns != None)
	assert(yconns != None)

	frame_data = subprocess.check_output(("traffic-generator-make-testframe --frame-size=%(frame_size)s --dst-mac-address=%(dst_mac_address)s --src-mac-address=%(src_mac_address)s --src-ipv4-address=%(src_ipv4_address)s --ipv4-ttl=%(ipv4_ttl)s --src-ipv4-udp-port=49184 --dst-ipv4-address=%(dst_ipv4_address)s --dst-ipv4-udp-port=%(dst_ipv4_udp_port)s"%{'frame_size':args.frame_size, 'dst_mac_address':args.dst_mac_address, 'src_mac_address':args.src_mac_address, 'src_ipv4_address':args.src_ipv4_address, 'ipv4_ttl':args.ipv4_ttl, 'dst_ipv4_address':args.dst_ipv4_address, 'dst_ipv4_udp_port':args.dst_ipv4_udp_port}).split(' '))

	print("#===Throughput===")
	throughput_pps = test_throughput()
	print("#===Latency===")
	test_latency(throughput_pps)
	print("#===Frame loss rate===")
	test_frame_loss_rate()
	print("#===Back to back frames===")
	test_back_to_back_frames()
def main():
    print("""
<test-spec>
===Objective===
Test validating fusion-np-tx-gst-multicast-contentions counter registers all GST packets lost due to contention.
===Procedure===
Generate point-to-point packet streams with TPID=88F7 from both local.ep0 and remote.ep0 to local.n0. Each stream should be above the 50% throughput limit of n0 (1Gb) so that packet loss due to contention is guaranteed to happen.
===DUT configuration===
This testcase is using the [[VCU-110_Prototype_r1.6#FPGA_Setup]] configuration and it is not changed during the test.

====Steps====
# Generate timing critical stream of 1000000 64 octet packets and 640 octet interframe gaps from timing slaves (analyzer.xe0, analyzer.xe1)
## Assert delta["analyzer"]["xe0"].out_unicast_pkts>=1000000
## Assert delta["analyzer"]["xe1"].out_unicast_pkts>=1000000
## Assert delta["analyzer"]["ge0"].in_unicast_pkts>=1000000
## Assert delta["analyzer"]["ge0"].in_unicast_pkts==delta["analyzer"]["xe0"].out_unicast_pkts+delta["analyzer"]["xe1"].out_unicast_pkts-delta["local"]["ge15"].fusion_np_tx_gst_multicast_contentions
## Return local_pkts_sent - delta["analyzer"]["xe0"].out_unicast_pkts
## Return remote_pkts_sent - delta["analyzer"]["xe1"].out_unicast_pkts
## Return total_pkts_received - delta["analyzer"]["ge0"].in_unicast_pkts
## Return contentions - delta["local"]["ge15"].fusion_np_tx_gst_multicast_contentions

===Results===
# N.A.
===Acceptance criteria===
# assert((local_pkts_sent+remote_pkts_sent-total_pkts_received)==contentions)

</test-spec>
""")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    mylinks = tntapi.parse_network_links(network)

    filter = testsuiteapi.get_filter()

    init(network, conns, filter=filter)
    (local_pkts_sent, remote_pkts_sent, total_pkts_received,
     contentions) = step_1(network, conns, filter=filter)

    print("# Test report:")
    print(
        "local-pkts-sent=%(local_pkts_sent)d, remote-pkts-sent=%(remote_pkts_sent)d, total-pkts-received=%(total_pkts_received)d, contentions=%(contentions)d"
        % {
            'local_pkts_sent': local_pkts_sent,
            'remote_pkts_sent': remote_pkts_sent,
            'total_pkts_received': total_pkts_received,
            'contentions': contentions
        })

    #Acceptance criteria
    assert ((local_pkts_sent + remote_pkts_sent -
             total_pkts_received) == contentions)
def main():
    print("""
<test-spec>
#Description: Bulk traffic test
#Procedure:
#1 - Generate bulk traffic stream of 1000000 1500 octet packets and 12 octet interframe gaps to both local.e0 and remote.e0 (analyzer.xe0,xe1)
#1.1 - Validate more that 99.5% of the packets are received at their destinations.
#1.2 - Validate there are no testframe payload errors.
===Objective===
Bulk traffic test. Send bidirectional SM traffic with maximal utilization between the local and remote node. 
===Procedure===
Generate point-to-point packet streams >1000000 frames with TPID=ABCD 1500 octet frames and 12 octets interframe gap. There should be zero packet loss.
===DUT configurations===
This testcase is depending on already loaded [[VCU-110_Prototype_r1.6#FPGA_Setup]] configuration and it is not modified during the test.

====Steps====
# Generate bidirectional bulk traffic stream of 1000000 1500 octet packets and 12 octet interframe gaps TPID=ABCD from-to local.e0 and remote.e0 (analyzer.xe0,xe1)
## Validate more that 99.5% of the packets are received at their destinations.
### Assert delta["analyzer"]["ge0"].in_unicast_pkts==0
### Assert delta["analyzer"]["ge1"].in_unicast_pkts==0
### Assert delta["analyzer"]["xe0"].out_unicast_pkts>=1000000
### Assert delta["analyzer"]["xe1"].out_unicast_pkts>=1000000
### Assert assert(delta["analyzer"]["xe1"].out_unicast_pkts-delta["analyzer"]["xe0"].in_unicast_pkts == delta["local"]["ge0"].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows)
### Assert assert(delta["analyzer"]["xe0"].out_unicast_pkts-delta["analyzer"]["xe1"].in_unicast_pkts == delta["remote"]["ge0"].fusion_np1_to_ep_sm_drop_reinsert_buf_overflows)
### Assert assert(100*float(delta["analyzer"]["xe1"].out_unicast_pkts-delta["analyzer"]["xe0"].in_unicast_pkts)/delta["analyzer"]["xe1"].out_unicast_pkts < 0.5)
## Validate there are no testframe payload errors.
### Assert delta["analyzer"]["xe0"].testframe_pkts==delta["analyzer"]["xe0"].in_unicast_pkts
### Assert delta["analyzer"]["xe0"].testframe_payload_errors==0
### Assert delta["analyzer"]["xe1"].testframe_pkts==delta["analyzer"]["xe1"].in_unicast_pkts
### Assert delta["analyzer"]["xe1"].testframe_payload_errors==0
===Acceptance criteria===
Step validations pass.
===Results===
# Packet loss Local->Remote
# Packet loss Remote->Local
</test-spec>
""")

    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    mylinks = tntapi.parse_network_links(network)

    filter = testsuiteapi.get_filter()

    print("Running ...")
    print(
        "#1 - Generate bulk traffic stream of 1000000 1500 octet packets and 12 octet interframe gaps to both local.e0 and remote.e0 (analyzer.xe0,xe1)"
    )
    (pkt_loss_local_remote, pkt_loss_remote_local) = step_1(network,
                                                            conns,
                                                            filter=filter)

    print("# Test report:")
    print(
        "# Packet loss: pkt_loss_local_remote=%(pkt_loss_local_remote)f, pkt_loss_remote_local=%(pkt_loss_remote_local)f"
        % {
            'pkt_loss_local_remote': pkt_loss_local_remote,
            'pkt_loss_remote_local': pkt_loss_remote_local
        })
def main():

    global test_time
    global args
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    parser.add_argument("--direction",
                        help="--direction=ingress or --direction=egress")
    parser.add_argument(
        '--interface',
        action='append',
        dest='interfaces',
        default=[],
        help=
        "Add interface to be tested e.g --interface='foo.ge0 --interface=bar.xe1'"
    )
    parser.add_argument(
        '--test-internal-loopback',
        help=
        "When direction=='egress' create 'internal' loopback on all interfaces and validate in_octets==out_octets"
    )
    parser.add_argument(
        '--test-analyzer',
        help="Create traffic-analyzer and measure min and max latency")
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)
    mylinks = tntapi.parse_network_links(network)

    assert (conns != None)
    assert (yconns != None)

    step = 1
    bw_expected = {}
    bw_generated = {}

    #1 - Generate maximum traffic load with maximum frame size 98.7% 6+6+2+1500+4 byte packets 7+1+12 byte ifg and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    98.7,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12)
    step = step + 1

    #2 - Generate maximum traffic load with minimum frame size 76.19% 6+6+2+46+4 byte packets 7+1+12 byte ifg and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    76.19,
                                    frame_size=6 + 6 + 2 + 46 + 4,
                                    interframe_gap=7 + 1 + 12)
    step = step + 1

    #3 - Generate 50% traffic load with maximum frame size 6+6+2+1500+4 byte packets 7+1+12+1498 byte ifg and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    50,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12 + 1498,
                                    frames_per_burst=0,
                                    interburst_gap=0)
    step = step + 1

    #4 - Generate 50% traffic load with minimum frame size 6+6+2+46+4 byte packets 7+1+12+44 byte ifg and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    50,
                                    frame_size=6 + 6 + 2 + 46 + 4,
                                    interframe_gap=7 + 1 + 12 + 44)
    step = step + 1

    #5 - Generate 5% traffic load with maximum frame size 6+6+2+1500+4 byte packets 7+1+12+28822 byte ifg and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    5,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12 + 28822)
    step = step + 1

    #6 - Generate 50% burst traffic load 6+6+2+1500+4 byte packets 7+1+12 byte ifg, frames-per-burst=10, interburst-gap=7+1+12+14980 and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    50,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12,
                                    frames_per_burst=10,
                                    interburst_gap=7 + 1 + 14980)
    step = step + 1

    #7 - Generate 5% burst traffic load 6+6+2+1500+4 byte packets 7+1+12 byte ifg, frames-per-burst=10, interburst-gap=7+1+12+288220 and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    5,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12,
                                    frames_per_burst=10,
                                    interburst_gap=7 + 1 + 288220)
    step = step + 1

    #8 - Generate 10% burst traffic load 6+6+2+1500+4 byte packets 7+1+12+27284 byte ifg, frames-per-burst=2, interburst-gap=7+1+12 and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    10,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12 + 27284,
                                    frames_per_burst=2,
                                    interburst_gap=7 + 1 + 12)
    step = step + 1

    #9 - Generate maximum traffic load with minimum frame size 76.19% traffic load 6+6+2+46+4 byte packets 7+1+12 byte ifg, frames-per-burst=2, interburst-gap=7+1+12 and verify counters.
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    76.19,
                                    frame_size=6 + 6 + 2 + 46 + 4,
                                    interframe_gap=7 + 1 + 12,
                                    frames_per_burst=2,
                                    interburst_gap=7 + 1 + 12)
    step = step + 1

    display_table(bw_expected, bw_generated)
    return 0
def validate(network,
             conns,
             yconns,
             inks,
             load_percent=99,
             frame_size=1500,
             interframe_gap=12,
             frames_per_burst=0,
             interburst_gap=0):
    global args
    filter = ""  #"""<filter type="xpath" select="/*[local-name()='interfaces-state' or local-name()='interfaces']/interface/*[local-name()='traffic-analyzer' or local-name()='oper-status' or local-name()='statistics' or local-name()='speed']"/>"""

    config_idle = {}
    nodes = network.xpath('nd:node', namespaces=namespaces)
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""
        print node_id

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            if (not is_interface_test_enabled(node_id, tp_id)):
                continue
            ok = yangcli(
                yconns[node_id],
                """replace /interfaces/interface[name='%(name)s'] -- type=ethernetCsmacd"""
                % {
                    'name': tp_id
                }).xpath('./ok')
            assert (len(ok) == 1)

    tntapi.network_commit(conns)

    state_before = tntapi.network_get_state(network, conns, filter=filter)
    print("Waiting " + "5" + " sec. ...")
    time.sleep(5)
    print("Done.")
    state_after = tntapi.network_get_state(network, conns, filter=filter)

    mylinks = tntapi.parse_network_links(state_before)
    t1 = tntapi.parse_network_nodes(state_before)
    t2 = tntapi.parse_network_nodes(state_after)
    delta = tntapi.get_network_counters_delta(state_before, state_after)

    tntapi.print_state_ietf_interfaces_statistics_delta(
        network, state_before, state_after)

    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            if (not is_interface_test_enabled(node_id, tp_id)):
                continue
            validate_traffic_off(node_id, tp_id, state_before, state_after,
                                 delta, frame_size)

    load = float(load_percent) / 100
    print "ifg=" + str(interframe_gap)

    if (args.test_internal_loopback == "true"):
        print("Enabling internal loopbacks.")
        for node in nodes:
            node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
            termination_points = node.xpath('./nt:termination-point',
                                            namespaces=namespaces)
            for termination_point in termination_points:
                tp_id = termination_point.xpath('nt:tp-id',
                                                namespaces=namespaces)[0].text
                if (not is_interface_test_enabled(node_id, tp_id)):
                    continue
                ok = yangcli(
                    yconns[node_id],
                    """merge /interfaces/interface[name='%(name)s'] -- loopback=internal"""
                    % {
                        'name': tp_id
                    }).xpath('./ok')
                assert (len(ok) == 1)

        tntapi.network_commit(conns)

    if (args.test_analyzer == "true"):
        print("Enabling analyzer.")
        for node in nodes:
            node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
            termination_points = node.xpath('./nt:termination-point',
                                            namespaces=namespaces)
            for termination_point in termination_points:
                tp_id = termination_point.xpath('nt:tp-id',
                                                namespaces=namespaces)[0].text
                if (not is_interface_test_enabled(node_id, tp_id)):
                    continue
                if (args.direction == 'ingress'):
                    ok = yangcli(
                        yconns[node_id],
                        """create /interfaces/interface[name='%(name)s']/traffic-analyzer-egress"""
                        % {
                            'name': tp_id
                        }).xpath('./ok')
                else:
                    ok = yangcli(
                        yconns[node_id],
                        """create /interfaces/interface[name='%(name)s']/traffic-analyzer"""
                        % {
                            'name': tp_id
                        }).xpath('./ok')
                assert (len(ok) == 1)

        tntapi.network_commit(conns)

    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            if (not is_interface_test_enabled(node_id, tp_id)):
                continue
            if (frames_per_burst > 0):
                my_burst_config = """frames-per-burst=%(frames-per-burst)d interburst-gap=%(interburst-gap)d""" % {
                    'frames-per-burst': frames_per_burst,
                    'interburst-gap': interburst_gap - 8
                }
            else:
                my_burst_config = ""

            if (args.direction == 'ingress'):
                generator_direction_suffix = '-ingress'
                analyzer_direction_suffix = '-egress'
            else:
                generator_direction_suffix = ''
                analyzer_direction_suffix = ''

            ok = yangcli(
                yconns[node_id],
                """create /interfaces/interface[name='%(name)s']/traffic-generator%(generator-direction-suffix)s -- ether-type=%(ether-type)d frame-size=%(frame-size)d interframe-gap=%(interframe-gap)d %(burst)s"""
                % {
                    'name': tp_id,
                    'generator-direction-suffix': generator_direction_suffix,
                    'frame-size': frame_size,
                    'ether-type': 0x1234,
                    'interframe-gap': interframe_gap - 8,
                    'burst': my_burst_config
                }).xpath('./ok')
            assert (len(ok) == 1)

    state_before = tntapi.network_get_state(network, conns, filter=filter)
    tntapi.network_commit(conns)

    print("Waiting " + str(test_time) + " sec. ...")
    time.sleep(test_time)

    print("Stopping generators ...")
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            if (not is_interface_test_enabled(node_id, tp_id)):
                continue
            ok = yangcli(
                yconns[node_id],
                """delete /interfaces/interface[name='%(name)s']/traffic-generator%(generator-direction-suffix)s"""
                % {
                    'name': tp_id,
                    'generator-direction-suffix': generator_direction_suffix
                }).xpath('./ok')
            assert (len(ok) == 1)

    tntapi.network_commit(conns)
    print("Done.")

    state_after = tntapi.network_get_state(network, conns, filter=filter)

    t1 = tntapi.parse_network_nodes(state_before)
    t2 = tntapi.parse_network_nodes(state_after)
    delta = tntapi.get_network_counters_delta(state_before, state_after)

    tntapi.print_state_ietf_interfaces_statistics_delta(
        network, state_before, state_after)

    load_generated = {}
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            if (not is_interface_test_enabled(node_id, tp_id)):
                continue
            load_generated[node_id, tp_id] = validate_traffic_on(
                node_id, tp_id, state_before, state_after, delta, test_time,
                load_percent, frame_size, interframe_gap, frames_per_burst,
                interburst_gap)

    if (args.test_analyzer == "true"):
        print("Disabling analyzer.")
        for node in nodes:
            node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
            termination_points = node.xpath('./nt:termination-point',
                                            namespaces=namespaces)
            for termination_point in termination_points:
                tp_id = termination_point.xpath('nt:tp-id',
                                                namespaces=namespaces)[0].text
                if (not is_interface_test_enabled(node_id, tp_id)):
                    continue
                ok = yangcli(
                    yconns[node_id],
                    """delete /interfaces/interface[name='%(name)s']/traffic-analyzer%(analyzer-direction-suffix)s"""
                    % {
                        'name': tp_id,
                        'analyzer-direction-suffix': analyzer_direction_suffix
                    }).xpath('./ok')
                assert (len(ok) == 1)

        tntapi.network_commit(conns)

    if (args.test_internal_loopback == "true"):
        print("Disabling internal loopbacks.")
        for node in nodes:
            node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
            termination_points = node.xpath('./nt:termination-point',
                                            namespaces=namespaces)
            for termination_point in termination_points:
                tp_id = termination_point.xpath('nt:tp-id',
                                                namespaces=namespaces)[0].text
                if (not is_interface_test_enabled(node_id, tp_id)):
                    continue
                ok = yangcli(
                    yconns[node_id],
                    """delete /interfaces/interface[name='%(name)s']/loopback"""
                    % {
                        'name': tp_id
                    }).xpath('./ok')
                assert (len(ok) == 1)

        tntapi.network_commit(conns)

    return (load_percent, load_generated)
Example #21
0
def validate(network,
             conns,
             yconns,
             inks,
             load_percent=99,
             frame_size=1500,
             interframe_gap=12,
             frames_per_burst=0,
             interburst_gap=0):
    filter = """<filter type="xpath" select="/interfaces-state/interface/*[local-name()='traffic-analyzer' or local-name()='oper-status' or local-name()='statistics' or local-name()='speed']"/>"""
    #	config_idle="""
    #<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    #</config>
    #"""
    config_idle = {}
    nodes = network.xpath('nd:node', namespaces=namespaces)
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            ok = yangcli(
                yconns[node_id],
                """replace /interfaces/interface[name='%(name)s'] -- type=ethernetCsmacd"""
                % {
                    'name': tp_id
                }).xpath('./ok')
            assert (len(ok) == 1)

    tntapi.network_commit(conns)

    state_before = tntapi.network_get_state(network, conns, filter=filter)
    print("Waiting " + "5" + " sec. ...")
    time.sleep(5)
    print("Done.")
    state_after = tntapi.network_get_state(network, conns, filter=filter)

    mylinks = tntapi.parse_network_links(state_before)
    t1 = tntapi.parse_network_nodes(state_before)
    t2 = tntapi.parse_network_nodes(state_after)
    delta = tntapi.get_network_counters_delta(state_before, state_after)

    tntapi.print_state_ietf_interfaces_statistics_delta(
        network, state_before, state_after)

    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            validate_traffic_off(node_id, tp_id, state_before, state_after,
                                 delta)

    load = float(load_percent) / 100
    print "ifg=" + str(interframe_gap)

    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            if (frames_per_burst > 0):
                my_burst_config = """frames-per-burst=%(frames-per-burst)d interburst-gap=%(interburst-gap)d""" % {
                    'frames-per-burst': frames_per_burst,
                    'interburst-gap': interburst_gap - 8
                }
            else:
                my_burst_config = ""

            ok = yangcli(
                yconns[node_id],
                """create /interfaces/interface[name='%(name)s']/traffic-generator -- frame-size=%(frame-size)d interframe-gap=%(interframe-gap)d %(burst)s"""
                % {
                    'name': tp_id,
                    'frame-size': frame_size,
                    'interframe-gap': interframe_gap - 8,
                    'burst': my_burst_config
                }).xpath('./ok')
            assert (len(ok) == 1)

    state_before = tntapi.network_get_state(network, conns, filter=filter)
    tntapi.network_commit(conns)

    print("Waiting " + str(test_time) + " sec. ...")
    time.sleep(test_time)

    print("Stopping generators ...")
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        config = ""

        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            ok = yangcli(
                yconns[node_id],
                """replace /interfaces/interface[name='%(name)s'] -- type=ethernetCsmacd"""
                % {
                    'name': tp_id
                }).xpath('./ok')
            assert (len(ok) == 1)

    tntapi.network_commit(conns)
    print("Done.")

    state_after = tntapi.network_get_state(network, conns, filter=filter)

    t1 = tntapi.parse_network_nodes(state_before)
    t2 = tntapi.parse_network_nodes(state_after)
    delta = tntapi.get_network_counters_delta(state_before, state_after)

    tntapi.print_state_ietf_interfaces_statistics_delta(
        network, state_before, state_after)

    load_generated = {}
    for node in nodes:
        node_id = node.xpath('nd:node-id', namespaces=namespaces)[0].text
        termination_points = node.xpath('./nt:termination-point',
                                        namespaces=namespaces)
        for termination_point in termination_points:
            tp_id = termination_point.xpath('nt:tp-id',
                                            namespaces=namespaces)[0].text
            load_generated[node_id, tp_id] = validate_traffic_on(
                node_id, tp_id, state_before, state_after, delta, test_time,
                load_percent, frame_size, interframe_gap, frames_per_burst,
                interburst_gap)

    return (load_percent, load_generated)
Example #22
0
def main():

    global test_time
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)
    mylinks = tntapi.parse_network_links(network)

    assert (conns != None)
    assert (yconns != None)

    step = 1
    bw_expected = {}
    bw_generated = {}
    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    98.7,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12)
    step = step + 1

    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    76.19,
                                    frame_size=6 + 6 + 2 + 46 + 4,
                                    interframe_gap=7 + 1 + 12)
    step = step + 1

    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    50.165,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 1500)
    step = step + 1

    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    4.0452,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 36000)
    step = step + 1

    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    49.757,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12,
                                    frames_per_burst=10,
                                    interburst_gap=7 + 1 + 15120)
    step = step + 1

    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    3.0344,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 1 + 12,
                                    frames_per_burst=10,
                                    interburst_gap=7 + 1 + 484880)
    step = step + 1

    (bw_expected[step],
     bw_generated[step]) = validate(network,
                                    conns,
                                    yconns,
                                    mylinks,
                                    7.7719,
                                    frame_size=6 + 6 + 2 + 1500 + 4,
                                    interframe_gap=7 + 36000 + 12,
                                    frames_per_burst=2,
                                    interburst_gap=7 + 1 + 12)
    step = step + 1

    display_table(bw_expected, bw_generated)
    return 0
Example #23
0
def netconfNet():
    "Create network from scratch using netconfd instance on each node."

    info("*** Creating nodes\n")
    h0 = Node('h0', inNamespace=True)
    h1 = Node('h1', inNamespace=True)
    b0 = Node('b0', inNamespace=False)
    b1 = Node('b1', inNamespace=False)

    ncproxy = Node('ncproxy', inNamespace=False)

    info("*** Creating links\n")
    b0.cmd("ip link del b0-eth0")
    b0.cmd("ip link del b0-eth1")
    b1.cmd("ip link del b1-eth0")
    b1.cmd("ip link del b1-eth1")
    Link(h0, b0, intfName2="b0-eth0")
    Link(b0, b1, intfName1="b0-eth1", intfName2="b1-eth0")
    Link(h1, b1, intfName2="b1-eth1")

    info("*** Configuring hosts\n")
    h0.setIP('192.168.123.1/24')
    h1.setIP('192.168.123.2/24')
    info(str(h0) + '\n')
    info(str(h1) + '\n')
    info(str(b0) + '\n')
    info(str(b1) + '\n')

    info("*** Starting network\n")
    h0.cmd(
        '''INTERFACE_NAME_PREFIX=h0- ./run-netconfd --module=ietf-interfaces --no-startup --port=8832 --ncxserver-sockname=/tmp/ncxserver.8832.sock --superuser=${USER} &'''
    )
    ncproxy.cmd(
        '''./run-sshd-for-netconfd --port=8832 --ncxserver-sockname=/tmp/ncxserver.8832.sock &'''
    )
    h1.cmd(
        '''INTERFACE_NAME_PREFIX=h1- ./run-netconfd --module=ietf-interfaces --no-startup --port=8833 --ncxserver-sockname=/tmp/ncxserver.8833.sock --superuser=${USER} &'''
    )
    ncproxy.cmd(
        '''./run-sshd-for-netconfd --port=8833 --ncxserver-sockname=/tmp/ncxserver.8833.sock &'''
    )

    #bridge b0
    b0.cmd(
        '''VCONN_ARG=ptcp:16636 ./run-netconfd --module=ietf-network-bridge-openflow --no-startup --superuser=${USER} --port=8830 --ncxserver-sockname=/tmp/ncxserver.8830.sock &'''
    )
    b0.cmd('ovs-vsctl del-br dp0')
    b0.cmd('ovs-vsctl add-br dp0')
    for intf in b0.intfs.values():
        print "Setting: " + str(intf)
        print b0.cmd('ovs-vsctl add-port dp0 %s' % intf)
        print b0.cmd('ifconfig -a')

    # Note: controller and switch are in root namespace, and we
    # can connect via loopback interface
    b0.cmd('ovs-vsctl set-controller dp0 tcp:127.0.0.1:16636')

    info('*** Waiting for switch to connect to controller')
    while 'is_connected' not in quietRun('ovs-vsctl show'):
        sleep(1)
        info('.')
    info('\n')

    #bridge b1
    b1.cmd(
        '''VCONN_ARG=ptcp:16635 ./run-netconfd --module=ietf-network-bridge-openflow --no-startup --superuser=${USER} --port=8831 --ncxserver-sockname=/tmp/ncxserver.8831.sock &'''
    )
    b1.cmd('ovs-vsctl del-br dp1')
    b1.cmd('ovs-vsctl add-br dp1')
    for intf in b1.intfs.values():
        print "Setting: " + str(intf)
        print b1.cmd('ovs-vsctl add-port dp1 %s' % intf)
        print b1.cmd('ifconfig -a')

    # Note: controller and switch are in root namespace, and we
    # can connect via loopback interface
    b1.cmd('ovs-vsctl set-controller dp1 tcp:127.0.0.1:16635')

    sleep(10)
    raw_input("Press Enter to continue...")

    tree = etree.parse("topology.xml")
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)
    mylinks = tntapi.parse_network_links(network)
    print("Done")

    state_before = tntapi.network_get_state(network, conns)
    info("*** Running test\n")

    #create flows configuration
    yangcli_script = """
merge /bridge/ports/port -- name=b0-eth0
merge /interfaces/interface -- name=b0-eth0 type=ethernetCsmacd port-name=b0-eth0
merge /bridge/ports/port -- name=b0-eth1
merge /interfaces/interface -- name=b0-eth1 type=ethernetCsmacd port-name=b0-eth1
create /flows/flow[id='h0-to-h1'] -- match/in-port=b0-eth0 actions/action[order='0']/output-action/out-port=b0-eth1
create /flows/flow[id='h1-to-h0'] -- match/in-port=b0-eth1 actions/action[order='0']/output-action/out-port=b0-eth0
"""
    result = tntapi.yangcli_ok_script(yconns["b0"], yangcli_script)

    yangcli_script = """
merge /bridge/ports/port -- name=b1-eth0
merge /interfaces/interface -- name=b1-eth0 type=ethernetCsmacd port-name=b1-eth0
merge /bridge/ports/port -- name=b1-eth1
merge /interfaces/interface -- name=b1-eth1 type=ethernetCsmacd port-name=b1-eth1
create /flows/flow[id='h0-to-h1'] -- match/in-port=b1-eth0 actions/action[order='0']/output-action/out-port=b1-eth1
create /flows/flow[id='h1-to-h0'] -- match/in-port=b1-eth1 actions/action[order='0']/output-action/out-port=b1-eth0
"""
    result = tntapi.yangcli_ok_script(yconns["b1"], yangcli_script)
    tntapi.network_commit(conns)

    # The commit should cause the netconfd server to execute the OpenFlow equivalent of:
    #switch.cmd( 'ovs-ofctl add-flow dp0 in_port=2,actions=output:1' )
    #switch.cmd( 'ovs-ofctl add-flow dp0 in_port=1,actions=output:2' )

    b0.cmdPrint('ovs-ofctl dump-flows dp0')

    info("*** Running test\n")
    h0.cmdPrint('ping -I h0-eth0 -c10 ' + h1.IP())

    b0.cmdPrint('ovs-ofctl dump-flows dp0')

    state_after = tntapi.network_get_state(network, conns)
    #delta = tntapi.get_network_counters_delta(state_before,state_after)

    tntapi.print_state_ietf_interfaces_statistics_delta(
        network, state_before, state_after)

    raw_input("Press Enter to continue...")

    info("*** Stopping network\n")
    b0.cmd('killall -KILL netconfd')
    b0.cmd('ovs-vsctl del-br dp0')
    b0.deleteIntfs()
    b1.cmd('killall -KILL netconfd')
    b1.cmd('ovs-vsctl del-br dp1')
    b1.deleteIntfs()
    info('\n')
Example #24
0
def main():

    global args
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--config",
        help=
        "Path to the network configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml"
    )
    parser.add_argument('--test-time',
                        default="60",
                        help="Test time for traffic generation in seconds.")
    parser.add_argument('--frame-size', default="64", help="Frame size.")
    parser.add_argument('--interframe-gap',
                        default="20",
                        help="Interframe gap.")
    parser.add_argument('--interburst-gap',
                        default="20",
                        help="Interburst gap.")
    parser.add_argument('--frames-per-burst',
                        default="0",
                        help="Frames per burst.")
    parser.add_argument('--src-node', default=[], help="Transmitting node.")
    parser.add_argument('--src-node-interface',
                        default=[],
                        help="Transmitting node interface e.g. eth0.")
    parser.add_argument('--dst-node', default=[], help="Receiving node.")
    parser.add_argument('--dst-node-interface',
                        default=[],
                        help="Receiving node interface e.g. eth0.")
    parser.add_argument('--src-mac-address',
                        default="01:23:45:67:89:AB",
                        help="Source MAC address.")
    parser.add_argument('--dst-mac-address',
                        default="01:23:45:67:89:AC",
                        help="Destination MAC address.")
    parser.add_argument('--frame-data',
                        default=[],
                        help="Hex string frame data.")
    parser.add_argument('--testframe-type',
                        default="dynamic",
                        help="Type of generated testframe.")
    args = parser.parse_args()

    tree = etree.parse(args.config)
    network = tree.xpath('/nc:config/nd:networks/nd:network',
                         namespaces=namespaces)[0]

    conns = tntapi.network_connect(network)
    yconns = tntapi.network_connect_yangrpc(network)
    mylinks = tntapi.parse_network_links(network)

    assert (conns != None)
    assert (yconns != None)

    (rx_in_pkts, rx_testframe_pkts, generated_pkts, sequence_errors,
     latency_min, latency_max,
     latency_average) = trial(network,
                              conns,
                              yconns,
                              test_time=int(args.test_time),
                              frame_size=long(args.frame_size),
                              interframe_gap=long(args.interframe_gap),
                              interburst_gap=long(args.interburst_gap),
                              frames_per_burst=long(args.frames_per_burst),
                              src_node=args.src_node,
                              src_node_interface=args.src_node_interface,
                              dst_node=args.dst_node,
                              dst_node_interface=args.dst_node_interface,
                              src_mac_address=args.src_mac_address,
                              dst_mac_address=args.dst_mac_address,
                              frame_data=args.frame_data,
                              testframe_type=args.testframe_type)
    print("Test time:                      %8u" % (int(args.test_time)))
    print("Generated packets:              %8u" % (generated_pkts))
    print("Received  packets:              %8u" % (rx_testframe_pkts))
    #print("Generated octets MB/s:          %8f"%(generated_pkts*float(args.frame_size)/(test_time*1024*1024))
    print("Lost packets:                   %8u" %
          (generated_pkts - rx_testframe_pkts))
    print("Lost packets percent:           %2.6f" %
          (100 * float(generated_pkts - rx_testframe_pkts) / generated_pkts))
    if (sequence_errors != None):
        print("Sequence errors:                %8u" % (sequence_errors))
        print("Sequence errors percent:        %2.6f" %
              (100 * float(sequence_errors) / generated_pkts))
    if (latency_min != None and rx_testframe_pkts > 0):
        print("Latency Min[nanoseconds]:       %8u" % (latency_min))
        print("Latency Max[nanoseconds]:       %8u" % (latency_max))
    else:
        print("Latency Min[nanoseconds]:       NA")
        print("Latency Max[nanoseconds]:       NA")

    return 0
def main():
	print("""
<test-spec>
===Objective===
Delay symmetry requirements test. Validate the forward and return paths master-slave are symmetric in terms of delay for all possible master-slave traffic paths.
===Procedure===
Generate point-to-point packet streams with TPID=88F7. There should be enough interframe gap to avoid contention and validate zero packet loss.
===DUT configuration===
This testcase is using the [[VCU-110_Prototype_r1.6#FPGA_Setup]] configuration and it is not changed during the test.

====Steps====
# Generate timing critical stream of 1000000 64 octet packets and 1024 octet interframe gaps from timing master (analyzer.ge0) and measure the min and max latencies at the timing slave ports (analyzer.xe0,xe1,analyzer.ge1)
## Assert delta["analyzer"]["ge0"].out_unicast_pkts>=1000000
## Assert delta["analyzer"]["xe0"].in_unicast_pkts==delta["analyzer"]["ge0"].out_unicast_pkts
## Assert delta["analyzer"]["xe1"].in_unicast_pkts==delta["analyzer"]["ge0"].out_unicast_pkts
## Assert delta["analyzer"]["ge1"].in_unicast_pkts==delta["analyzer"]["ge0"].out_unicast_pkts
## Return lat_ge0_xe[0-1]_min, lat_ge0_ge1_min - Minimum latencies from ge0 to xe0, xe1, ge1.
# Generate timing critical stream of 1000000 64 octet packets and 10240 octet interframe gaps from timing slave (analyzer.xe0) and measure the min and max latencies at the timing master port (analyzer.ge0)
## Assert delta["analyzer"][name].out_unicast_pkts>=1000000.
## Assert delta["analyzer"]["ge0"].in_unicast_pkts==delta["analyzer"]["xe0"].out_unicast_pkts.
## Return lat_xe0_ge0_min - Minimum latency measured from xe0 to ge0
# Same as Step 2 for xe1.
# Same as Step 2 for ge1 and generate interframe gap of 1024 octets instead of 10240.

===Results===
# Local,Remote,Remote NP0  abs-[to/from]-delay - absolute delay for the forward path from timing master to local slave.
# Local,Remote,Remote NP0 asymmetry-delta-delay - difference between the to and from paths.

===Acceptance criteria===
# abs(lat_ge0_xe0_min-lat_xe0_ge0_min)<500)
# abs(lat_ge0_xe1_min-lat_xe1_ge0_min)<500)
</test-spec>
""")

	parser = argparse.ArgumentParser()
	parser.add_argument("--config", help="Path to the netconf configuration *.xml file defining the configuration according to ietf-networks, ietf-networks-topology and netconf-node models e.g. ../networks.xml")
	args = parser.parse_args()


	tree=etree.parse(args.config)
	network = tree.xpath('/nc:config/nd:networks/nd:network', namespaces=namespaces)[0]

	conns = tntapi.network_connect(network)
	mylinks = tntapi.parse_network_links(network)

	filter = testsuiteapi.get_filter()


        init(network, conns, filter=filter)
	(lat_ge0_xe0_min, lat_ge0_xe1_min, lat_ge0_ge1_min)=step_1(network, conns, filter=filter)
	lat_xe0_ge0_min=step_2(network, conns, filter=filter)
	lat_xe1_ge0_min=step_3(network, conns, filter=filter)
	lat_ge1_ge0_min=step_4(network, conns, filter=filter)

        print("# Test report:")
        print("# Local edge port: abs-to-delay=%(to)d ns, abs-from-delay=%(from)d ns, asymmetry-delta-delay=%(delta)d ns"%{'to':lat_ge0_xe0_min,'from':lat_xe0_ge0_min,'delta':abs(lat_ge0_xe0_min-lat_xe0_ge0_min)})
        print("# Remote edge port: abs-to-delay=%(to)d ns, abs-from-delay=%(from)d ns, asymmetry-delta-delay=%(delta)d ns"%{'to':lat_ge0_xe1_min,'from':lat_xe1_ge0_min,'delta':abs(lat_ge0_xe1_min-lat_xe1_ge0_min)})
        print("# Remote network 0: abs-to-delay=%(to)d ns, abs-from-delay=%(from)d ns, asymmetry-delta-delay=%(delta)d ns"%{'to':lat_ge0_ge1_min,'from':lat_ge1_ge0_min,'delta':abs(lat_ge0_ge1_min-lat_ge1_ge0_min)})

	#Acceptance criteria
	assert(abs(lat_ge0_xe0_min-lat_xe0_ge0_min)<500)
	assert(abs(lat_ge0_xe1_min-lat_xe1_ge0_min)<500)