Ejemplo n.º 1
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)
Ejemplo n.º 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"
Ejemplo n.º 3
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)
Ejemplo n.º 4
0
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!")
Ejemplo n.º 5
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 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)
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
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
Ejemplo n.º 9
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)