+
+ @keyword('Get link data useful in circular topology test from tg "${tgen}"'
+ ' dut1 "${dut1}" dut2 "${dut2}"')
+ def get_links_dict_from_nodes(self, tgen, dut1, dut2):
+ """Returns link combinations used in tests in circular topology.
+
+ For the time being it returns links from the Node path:
+ TG->DUT1->DUT2->TG
+ :param tg: traffic generator node data
+ :param dut1: DUT1 node data
+ :param dut2: DUT2 node data
+ :type tg: dict
+ :type dut1: dict
+ :type dut2: dict
+ :return: dictionary of possible link combinations
+ the naming convention until changed to something more general is
+ implemented is this:
+ DUT1_DUT2_LINK: link name between DUT! and DUT2
+ DUT1_TG_LINK: link name between DUT1 and TG
+ DUT2_TG_LINK: link name between DUT2 and TG
+ TG_TRAFFIC_LINKS: list of link names that generated traffic is sent
+ to and from
+ DUT1_BD_LINKS: list of link names that will be connected by the bridge
+ domain on DUT1
+ DUT2_BD_LINKS: list of link names that will be connected by the bridge
+ domain on DUT2
+ """
+ # TODO: replace with generic function.
+ dut1_dut2_link = self.get_first_active_connecting_link(dut1, dut2)
+ dut1_tg_link = self.get_first_active_connecting_link(dut1, tgen)
+ dut2_tg_link = self.get_first_active_connecting_link(dut2, tgen)
+ tg_traffic_links = [dut1_tg_link, dut2_tg_link]
+ dut1_bd_links = [dut1_dut2_link, dut1_tg_link]
+ dut2_bd_links = [dut1_dut2_link, dut2_tg_link]
+ topology_links = {'DUT1_DUT2_LINK': dut1_dut2_link,
+ 'DUT1_TG_LINK': dut1_tg_link,
+ 'DUT2_TG_LINK': dut2_tg_link,
+ 'TG_TRAFFIC_LINKS': tg_traffic_links,
+ 'DUT1_BD_LINKS': dut1_bd_links,
+ 'DUT2_BD_LINKS': dut2_bd_links}
+ return topology_links
+
+ @staticmethod
+ def is_tg_node(node):
+ """Find out whether the node is TG
+
+ :param node: node to examine
+ :return: True if node is type of TG; False otherwise
+ """
+ return node['type'] == NodeType.TG
+
+ @staticmethod
+ def get_node_hostname(node):
+ """
+ :param node: node dictionary
+ :return: host name as 'str' type
+ """
+ return node['host']
\ No newline at end of file