def __parse_fanout_connections__(self): device_conn = self.last_device_connection_details retval = [] for key in device_conn.keys(): fanout_port = ansible_stdout_to_str(key) peer_port = ansible_stdout_to_str(device_conn[key]['peerport']) peer_device = ansible_stdout_to_str(device_conn[key]['peerdevice']) speed = ansible_stdout_to_str(device_conn[key]['speed']) string = "{}/{}/{}/{}/{}".\ format(self.ip_address, fanout_port, peer_port, peer_device, speed) retval.append(string) return (retval)
def get_fanout_device_details(self, device_number): """With the help of this function you can select the chassis you want to access. For example get_fanout_device_details(0) selects the first chassis. It just select the chassis but does not return anything. The rest of the function then used to extract chassis information like "get_chassis_ip()" will the return the ip address of chassis 0 - the first chassis in the list. Note: Counting or indexing starts from 0. That is 0 = 1st cassis, 1 = 2nd chassis ... Args: device_number (int): the chassis index (0 is the first) Returns: None """ # Pointer to chassis info self.last_fanout_assessed = device_number # Chassis connection details self.last_device_connection_details = \ self.fanout_list[self.last_fanout_assessed]['device_conn'].values()[0] # Chassis ip details chassis_ip = self.fanout_list[ self.last_fanout_assessed]['device_info']['mgmtip'] self.ip_address = ansible_stdout_to_str(chassis_ip) # List of chassis cards and ports self.current_ixia_port_list = \ self.__parse_fanout_connections__()