op_topo_connect_count()

Abstract

Obtains number of connectors of the requested type between the specified source and destination objects.

Syntax

op_topo_connect_count (src_objid, dst_objid, conn_objmtype)
Argument Type Description
src_objid, dst_objid Objid object IDs of the connected objects
[An object ID can be obtained from several KPs in the Id package: op_id_self(), op_id_from_userid(), and op_id_from_name(). In addition, object IDs can be obtained from prior invocations of the Topo package KPs op_topo_parent(), op_topo_child(), op_topo_assoc(), and op_topo_connect().]
conn_objmtype int object meta-type of connector
[This value is an integer code that specifies the object type of the connection-of-interest (see Table 69 “Object Type Symbolic Constants“ on page 19).]

Return Type

int

Number of connectors of the requested type between the source and destination objects. The special value represented by the symbolic constant OPC_INT_INVALID will be returned if a recoverable error occurs.

Example

/* Loop through all of the connectors between the source and destination nodes */
/* and find the link with the lowest bit error rate. */
/* Initialize temporary variables. */
best_ber = 1.0; best_link_id = OPC_OBJID_INVALID;
/* Determine the number of connector links between source and destination. */
num_links = op_topo_connect_count (src_node_id, dest_node_id, OPC_OBJMTYPE_LINK);
/* Loop through the connector links and find the best link. */
for (i = 0; i < num_links; i++)
	{
	/* Obtain the link id and ber attribute value and compare with best so far. */
	link_id = op_topo_connect (src_node_id, dest_node_id, OPC_OBJMTYPE_LINK, i);
	op_ima_obj_attr_get (link_id, “ber”, &ber);
	if (ber < best_ber)
		{
		best_link_id = link_id;
		best_ber = ber;
		}
	}

Details

An object is a connector if it connects two other objects. For example, a packet stream may connect two modules or a link may connect two nodes. Refer to the table in the Details section of the KP op_topo_connect() for a list of the valid reference object/connector type combinations.

Purpose

Provides a mechanism for determining the number of connectors between the source and destination objects, which is useful for setting the bounds on a loop that will perform some operation on each connector. In order to obtain the object ID of each connector, the KP op_topo_connect() can be invoked with the source and destination object IDs, the same symbolic constant defining the object type, and the index of the loop.

Errors

  • Recoverable Error: Source object ID (<src_objid>) is out-of-range.
  • Recoverable Error: Destination object ID (<dst_objid>) is out-of-range.
  • Recoverable Error: Object meta-type (<conn_objmtype>) is unrecognized.
  • Recoverable Error: Source object ID (<src_objid>) refers to a restricted object.
  • Recoverable Error: Destination object ID (<dst_objid>) refers to a restricted object.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com