示例#1
0
def Ping_Checker(HOST, VD, PEER, Username, Password):
    print(color.BLUE)
    print('### Start Ping Check!!!! ###')
    print(color.RESET)
    if VD == 'juniper':
        CMD = 'ping ' + PEER + ' count 3 wait 1'
    elif VD == 'arista' or VD == 'cisco':
        CMD = 'ping ' + PEER + ' repeat 3 timeout 1'
    elif VD == 'huawei':
        CMD = 'ping -c 1 ' + PEER
    elif VD == 'dell' or VD == 'cisco-nx' or VD == 'brocade_fabric':
        CMD = 'ping ' + PEER + ' count 3 timeout 1'
    elif VD == 'ubiquoss':
        CMD = 'ping ip ' + PEER + ' repeat 3 timeout 1'
    elif VD == 'foundry':
        CMD = 'ping ' + PEER + ' count 3 timeout 1000'
    Result = '\n'.join(RUN.Run_Command(HOST, VD, CMD, Username, Password))
    if '100% packet loss' in Result or ' rate is 0 percent ' in Result or '100.00% packet loss' in Result or 'No reply from remote host.' in Result:
        print(color.RED)
        print('### Peer is unreachable!!!!!!!!!  ###')
        print(color.RESET)
        return False
    else:
        print(color.GREEN)
        print('### Peer is reachable!!!!!!!!!  ###')
        print(color.RESET)
        return True
示例#2
0
def JUNOS_BGP_Session_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_BGP_Session[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        LEN = len(RL.split())
        if Regex_IPv4_Host.match(RL) or Regex_IPv6_Host.match(RL):
            if 'Establ' in RL or 'Connect' in RL or 'Idle' in RL or 'Active' in RL or 'OpenConfirm' in RL or 'OpenSent' in RL:
                Status = RL.split()[-1]
                PEER = RL.split()[0]
                if LEN == 8:
                    Flap_Time = RL.split()[-2]
                elif LEN == 9:
                    Flap_Time = ' '.join(RL.split()[-3:-1])
            else:
                Status = 'Establ'
                PEER = RL.split()[0]
                if LEN == 9:
                    Flap_Time = RL.split()[-3]
                elif LEN == 10:
                    Flap_Time = ' '.join(RL.split()[-4:-2])
            if Status == 'Connect' or Status == 'Idle' or Status == 'Active' or Status == 'OpenConfirm' or Status == 'OpenSent':
                DOWN_List[PEER] = Flap_Time
            else:
                UP_List[PEER] = Flap_Time
    return UP_List, DOWN_List
def UBIQ_Interface_Check(Hostname, VD, PT, Username, Password):
	CMD = CMD_Target_Port[VD]+PT
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if 'line protocol is ' in RL:
			if 'down' in RL or 'notpresent' in RL:
				DIC['LS'] = 'down'
			else:
				DIC['LS'] = 'up'
		elif 'Description' in RL:
			DSC = RL.split()[1]
			DIC['DSC'] = DSC
		elif 'Current HW addr:' in RL:
			MAC = RL.split()[-1]
			DIC['MAC'] = MAC
		elif 'CRC,' in RL:
			CRC = RL.split()[0]
			DIC['IE'] = None
			DIC['OE'] = None
			DIC['CRC'] = CRC
		#elif ' packets input,' in RL:
		#	IP = RL.split()[0]
		#elif ' packets output,' in RL:
		#	OP = RL.split()[0]
	DIC['FT'] = None
	return DIC
def Brocade_Interface_Check(Hostname, VD, PT, Username, Password):
	PTNo = Foundry_Port_Number_Regex.findall(PT)[0]
	PTTy = re.findall("[a-zA-Z]+",PT)[0]
	CMD = CMD_Target_Port[VD]+PTTy+' '+PTNo
	print(CMD)
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if 'line protocol is ' in RL:
			if 'down' in RL or 'notpresent' in RL:
				DIC['LS'] = 'down'
			else:
				DIC['LS'] = 'up'
		elif 'Description:' in RL:
			DSC = RL.split()[-1]
			DIC['DSC'] = DSC
		elif 'CRC' in RL:
			CRC = RL.split()[-3].split(',')[0]
			DIC['CRC'] = CRC
		elif 'Hardware is ' in RL and 'address is ' in RL:
			MAC = RL.split()[-1]
			DIC['MAC'] = MAC
		elif 'Time since last interface status change:' in RL:
			FT = RL.split()[-1]
			DIC['FT'] = FT
	IE = str(Result[Result.index(u'Receive Statistics:')+7]).split()[1]
	DIC['IE'] = IE
	OE = str(Result[Result.index(u'Transmit Statistics:')+4]).split()[1]
	DIC['OE'] = OE
	#IP = str(Result[Result.index(u'Receive Statistics:')+1]).split()[0]
	#OP = str(Result[Result.index(u'Transmit Statistics:')+1]).split()[0]
	return DIC
def Dell_Interface_Check(Hostname, VD, PT, Username, Password):
	CMD = CMD_Target_Port[VD]+PT+' | no-more'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if 'line protocol is ' in RL:
			if 'down' in RL or 'notpresent' in RL:
				DIC['LS'] = 'down'
			else:
				DIC['LS'] = 'up'
		elif 'Description:' in RL:
			DSC = RL.split()[-1]
			DIC['DSC'] = DSC
		#elif 'input errors,' in RL:
		#	IE = RL.split()[0]
		#	print('\n###Input errors###\n'+IE)
		#elif 'output errors,' in RL:
		#	OE = RL.split()[0]
		#	print('\n###Output errors###\n'+OE)
		elif 'CRC,' in RL:
			CRC = RL.split()[0]
			DIC['CRC'] = CRC
		elif 'Hardware is ' in RL and 'address is ' in RL:
			MAC = RL.split()[-1]
			DIC['MAC'] = MAC
		elif 'Time since last interface status change:' in RL:
			FT = RL.split()[-1]
			DIC['FT'] = FT
	DIC['IE'] = None
	DIC['OE'] = None
	#IP = str(Result[Result.index(u'Input Statistics:')+1]).split()[0]
	#OP = str(Result[Result.index(u'Output Statistics:')+1]).split()[0]
	return DIC
def CISCO_NXOS_Interface_Check(Hostname, VD, PT, Username, Password):
	CMD = CMD_Target_Port[VD]+PT
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if ' is up' in RL or ' is down' in RL:
			LS = RL.split()[2]
			DIC['LS'] = LS
		elif 'Description' in RL:
			DSC = RL.split()[1]
			DIC['DSC'] = DSC
		elif 'input error' in RL:
			IE = RL.split()[0]
			DIC['IE'] = IE
		elif 'output error' in RL:
			OE = RL.split()[0]
			DIC['OE'] = OE
		elif 'CRC' in RL:
			CRC = RL.split()[4]
			DIC['CRC'] = CRC
		elif 'Hardware:' in RL and 'address:' in RL:
			MAC = RL.split()[-3]
			DIC['MAC'] = MAC
		#elif 'input packets' in RL:
		#	IP = RL.split()[0]
		#elif 'output packets' in RL:
		#	OP = RL.split()[0]
		elif 'Last link flapped' in RL:
			FT = ' '.join(RL.split()[3:])
			DIC['FT'] = FT
	return DIC
def Foundry_Interface_Check(Hostname, VD, PT, Username, Password):
	CMD = CMD_Target_Port[VD]+PT
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if 'line protocol is ' in RL:
			if 'down' in RL or 'notpresent' in RL:
				DIC['LS'] = 'down'
			else:
				DIC['LS'] = 'up'
		elif 'Port name is ' in RL:
			DSC = RL.split()[-1]
			DIC['DSC'] = DSC
		elif 'input errors,' in RL:
			IE = RL.split()[0]
			CRC = RL.split()[3]
			DIC['IE'] = IE
			DIC['CRC'] = CRC
		elif 'output errors,' in RL:
			OE = RL.split()[0]
			DIC['OE'] = OE
		elif 'Hardware is ' in RL and 'address is ' in RL:
			MAC = RL.split()[-3]
			DIC['MAC'] = MAC
		#elif 'packets input,' in RL:
		#	IP = RL.split()[0]
		#elif 'packets output,' in RL:
		#	OP = RL.split()[0]
	DIC['FT'] = None
	return DIC
def EOS_CPU_Check(Host, VD, User, pwd):
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if '%Cpu(s):' in RL:
            RT = float(RL.split()[7])
    return RT
def Dell_CPU_Check(Host, VD, User, pwd):
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if 'Overall' in RL:
            RT = float(RL.split()[-1])
    RT = float('100') - RT
    return RT
def Bro_CPU_Check(Host, VD, User, pwd):
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if 'Current:' in RL:
            RT = float(RL.split()[1].split('%')[0])
    RT = float('100') - RT
    return RT
def JUNOS_CPU_Check(Host, VD, User, pwd):
    RT = []
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if 'Idle ' in RL:
            RT.append(float(RL.split()[-2]))
    return RT
def Foundry_CPU_Check(Host, VD, User, pwd):
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if 'CPU utilization ' in RL:
            Value = RL.split()[-4]
    RT = float('100') - float(CPU_Value.findall(Value)[0].split('%')[0])
    return RT
def Ubi_CPU_Check(Host, VD, User, pwd):
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if 'CPU states:' in RL:
            Value = RL.split()[-2]
    RT = float(CPU_Value.findall(Value)[0])
    return RT
def Huawei_CPU_Check(Host, VD, User, pwd):
    CMD = CMD_CPU[VD]
    Result = RUN.Run_Command(Host, VD, CMD, User, pwd)
    for i in Result:
        RL = str(i)
        if 'CPU utilization for ' in RL:
            RT = float(RL.split()[-1].split('%')[0])
    RT = float('100') - RT
    return RT
def Ubi_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	CMD = CMD_Target_Optic[VD]+PT
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	OP = Result[-2].split()[1]
	RP = Result[-1].split()[1]
	print('\n###Send Power###\n'+OP)
	print('\n###Receive Power###\n'+RP)
	Optic_status[PT] = [OP, RP]
	return Optic_status
def EOS_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	CMD = CMD_Target_Optic[VD]+PT+' transceiver'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if PT in RL:
			OP = RL.split()[4]
			print('\n###Send Power###\n'+OP)
			RP = RL.split()[5]
			print('\n###Receive Power###\n'+RP)
	Optic_status[PT] = [OP, RP]
	return Optic_status
def Brocade_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	CMD = CMD_Target_Optic[VD]+Slot.split('/')[0]
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if Slot in RL:
			OP = ' '.join(RL.split()[3:5])
			RP = ' '.join(RL.split()[5:7])
			print('\n###Send Power###\n'+OP)
			print('\n###Receive Power###\n'+RP)
	Optic_status[PT] = [OP, RP]
	return Optic_status
def CISCO_IOS_Interface_Check(Hostname, VD, PT, Username, Password):
	CMD = CMD_Target_Port[VD]+PT
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if 'line protocol is ' in RL:
			if 'down' in RL or 'notpresent' in RL:
				DIC['LS'] = 'down'
			else:
				DIC['LS'] = 'up'
		elif 'Description' in RL:
			DSC = RL.split()[1]
			DIC['DSC'] = DSC
		elif 'input errors,' in RL:
			IE = RL.split()[0]
			CRC = RL.split()[3]
			DIC['IE'] = IE
			DIC['CRC'] = CRC
		elif 'output errors,' in RL:
			OE = RL.split()[0]
			DIC['OE'] = OE
		elif 'Hardware is ' in RL and 'address is ' in RL:
			MAC = RL.split()[-3]
			DIC['MAC'] = MAC
		#elif 'packets input,' in RL:
		#	IP = RL.split()[0]
		#elif 'packets output,' in RL:
		#	OP = RL.split()[0]
	CMD = 'sh dtp interface '+PT
        Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if 'last link down on ' in RL:
			FT = ' '.join(RL.split()[8:])
			DIC['FT'] = FT
	if not 'FT' in DIC.keys():
		DIC['FT'] = None
	return DIC
def Dell_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	CMD = CMD_Target_Optic[VD]+PT+' transceiver | no-more'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if 'Tx Power' in RL and 'Alarm' not in RL and 'Threshold' not in RL and 'Warning' not in RL:
			OP = RL.split()[-1]
			print('\n###Send Power###\n'+OP)
		elif 'Rx Power' in RL and 'Alarm' not in RL and 'Threshold' not in RL and 'Warning' not in RL:
			RP = RL.split()[-1]
			print('\n###Receive Power###\n'+RP)
	Optic_status[PT] = [OP, RP]
	return Optic_status
def JUNOS_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	Out_P = ''
	In_P = ''
	CMD = CMD_Target_Optic[VD]+PT+' | no-more'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if 'Laser output power' in RL and 'high' not in RL and 'low' not in RL:
			Out_P = RL.split()[7]
		if 'Laser output power high warning threshold' in RL:
			Out_H = RL.split()[10]
		if 'Laser output power low warning threshold' in RL:
			Out_L = RL.split()[10]
		elif 'Laser rx power' in RL and 'high' not in RL and 'low' not in RL:
			In_P = RL.split()[7]
		elif 'Receiver signal average optical power' in RL:
			In_P = RL.split()[9]
		elif 'Laser rx power high warning threshold' in RL:
			In_H = RL.split()[10]
		elif 'Laser rx power low warning threshold' in RL:
			In_L = RL.split()[10]
	if Out_P == '':
		print('No optical port or not support power checker')
	elif In_P == '':
		print('No optical port or not support power checker')
	else:
		Optic_status[PT] = [Out_P, Out_H, Out_L, In_P, In_H, In_L]
                Output_power = float(Out_P)
                Output_high_limit = float(Out_H)
                Output_low_limit = float(Out_L)
                Input_power = float(In_P)
                Input_high_limit = float(In_H)
                Input_low_limit = float(In_L)
                if Output_power < Output_high_limit and Output_power > Output_low_limit:
			Input_error = False			
		else:
			Input_error = True
		Optic_status[PT].append(Input_error)
		if Input_power < Input_high_limit and Input_power > Input_low_limit:
			Output_error = False			
		else:
			Output_error = True
		Optic_status[PT].append(Output_error)
		if Input_error and Output_error:
                	print('Output/Input optical power is normal')
                else:
                	print('Optical issue!!! Need to check physical port and cable!!')

	return Optic_status
def Huawei_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	CMD = CMD_Target_Optic[VD]+PT+' transceiver verbose'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if 'Current RX Power (dBm)' in RL:
			OP = RL.split()[-1]
			print('\n###Send Power###\n'+OP)
		elif 'Current TX Power (dBm)' in RL:
			RP = RL.split()[-1]
			print('\n###Receive Power###\n'+RP)
	Optic_status[PT] = [OP, RP]
	return Optic_status
def CISCO_NXOS_Optical_Check(Hostname, VD, PT, Username, Password):
	Optic_status = {}
	CMD = CMD_Target_Optic[VD]+PT+' transceiver details'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	for i in Result:
		RL = str(i)
		if 'Tx Power' in RL:
			OP = ' '.join(RL.split()[2:4])
			print('\n###Send Power###\n'+OP)
		elif 'Rx Power' in RL:
			RP = ' '.join(RL.split()[2:4])
			print('\n###Receive Power###\n'+RP)
	Optic_status[PT] = [OP, RP]
	return Optic_status
def Brocade_OSPF_Nei_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_OSPF_Neighbor[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        if Regex_IPv4_Host.search(RL):
            Status = RL.split()[3]
            Interface = RL.split()[0:2]
            Neighbor = RL.split()[4]
            if 'FULL' in Status:
                UP_List[Neighbor] = Interface
            else:
                DOWN_List[Neighbor] = Interface
    return UP_List, DOWN_List
def JUNOS_OSPF_Nei_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_OSPF_Neighbor[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        if Regex_IPv4_Host.search(RL) or Regex_IPv6_Host.match(RL):
            Status = RL.split()[2]
            Interface = RL.split()[1]
            Neighbor = RL.split()[0]
            if 'Full' in Status:
                UP_List[Neighbor] = Interface
            else:
                DOWN_List[Neighbor] = Interface
    return UP_List, DOWN_List
def JUNOS_Interface_Check(Hostname, VD, PT, Username, Password):
	if 'Te' in PT:
		PT = PT.replace('Te','xe-')
	elif 'et' in PT:
		PT = PT.replace('et','et-')
	elif 'gi' in PT:
		PT = PT.replace('gi','ge-')
	elif 'Gi' in PT:
		PT = PT.replace('Gi','ge-')
	CMD = CMD_Target_Port[VD]+PT+' | no-more'
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if 'Physical interface:' in RL:
			LS = RL.split()[-1]
			DIC['LS'] = str(LS)
		elif 'Description' in RL:
			DSC = RL.split()[-1]
			DIC['DSC'] = str(DSC)
		elif 'Bit errors' in RL:
			IE = RL.split()[-1]
			DIC['IE'] = IE
			DIC['OE'] = str(None)
		elif 'Errored blocks' in RL:
			CRC = RL.split()[-1]
			DIC['CRC'] = str(CRC)
		elif 'Hardware address:' in RL:
			MAC = RL.split()[-1]
			DIC['MAC'] = str(MAC)
		elif 'Input packets :' in RL:
			IP = RL.split()[-1]
			DIC['IP'] = str(IP)	
		elif 'Output packets:' in RL:
			OP = RL.split()[-1]
			DIC['OP'] = str(OP)	
		elif 'Input rate ' in RL:
			IB = RL.split()[-4]
			DIC['IB'] = str(IB)	
		elif 'Output rate ' in RL:
			OB = RL.split()[-4]
			DIC['OB'] = str(OB)	
		elif 'Last flapped' in RL:
			FT = ' '.join(RL.split()[-3:])[1:-5]
			DIC['FT'] = str(FT)
	return DIC
示例#26
0
def IOS_BGP_Session_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_BGP_Session[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        if Regex_IPv4_Host.match(RL) and 'never' in RL:
            Status = RL.split()[9]
            Flap_Time = RL.split()[8]
            PEER = RL.split()[0]
            DOWN_List[PEER] = Flap_Time
        elif Regex_IPv4_Host.match(RL):
            Status = 'Established'
            Flap_Time = RL.split()[8]
            PEER = RL.split()[0]
            UP_List[PEER] = Flap_Time
    return UP_List, DOWN_List
示例#27
0
def Foundry_BGP_Session_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_BGP_Session[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        if 'CONN' in RL or 'ADMDN' in RL or 'IDLE' in RL:
            Status = RL.split()[2]
            Flap_Time = ' '.join(RL.split()[3:5])
            PEER = RL.split()[0]
            DOWN_List[PEER] = Flap_Time
        elif 'ESTAB' in RL:
            Status = RL.split()[2]
            Flap_Time = ' '.join(RL.split()[3:5])
            PEER = RL.split()[0]
            UP_List[PEER] = Flap_Time
    return UP_List, DOWN_List
示例#28
0
def Huawei_BGP_Session_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_BGP_Session[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        if 'Connect' in RL or 'Idle' in RL or 'Active' in RL:
            Status = RL.split()[8]
            Flap_Time = RL.split()[7]
            PEER = RL.split()[0]
            DOWN_List[PEER] = Flap_Time
        elif 'Estab' in RL:
            Status = RL.split()[8]
            Flap_Time = RL.split()[7]
            PEER = RL.split()[0]
            UP_List[PEER] = Flap_Time
    return UP_List, DOWN_List
def Dell_OSPF_Nei_List(HOST, VD, Username, Password):
    UP_List = {}
    DOWN_List = {}
    CMD = CMD_OSPF_Neighbor[VD]
    Result = RUN.Run_Command(HOST, VD, CMD, Username, Password)
    for i in Result:
        RL = str(i)
        if Regex_IPv4_Host.search(RL):
            Status = RL.split()[2]
            if len(RL.split()) == 8:
                Interface = RL.split()[-3][15:] + ' ' + RL.split()[-2]
            elif len(RL.split()) == 9:
                Interface = ' '.join(RL.split()[-3:-1])
            Neighbor = RL.split()[0]
            if 'FULL' in Status:
                UP_List[Neighbor] = Interface
            else:
                DOWN_List[Neighbor] = Interface
    return UP_List, DOWN_List
def Huawei_Interface_Check(Hostname, VD, PT, Username, Password):
	if 'Fg' in PT:
		PT = PT.replace('Fg','40GE')
	elif 'Te' in PT:
		PT = PT.replace('Te','10GE')
	CMD = CMD_Target_Port[VD]+PT
	Result = RUN.Run_Command(Hostname,VD,CMD, Username, Password)
	DIC = {}
	for i in Result:
		RL = str(i)
		if PT+' current state : ' in RL:
			if 'UP' in RL:
				DIC['LS'] = 'up'
			else:
				DIC['LS'] = 'down'
		elif 'Description:' in RL:
			if len(RL.split()) == 1:
				DSC = None
			else:
				DSC = RL.split()[-1]
			DIC['DSC'] = DSC
		elif 'Total Error:' in RL:
			IE = RL.split()[-1]
			OE = None
			DIC['IE'] = IE
			DIC['OE'] = OE
		elif 'CRC:' in RL:
			CRC = RL.split()[1].split(',')[0]
			DIC['CRC'] = CRC
		elif 'Hardware address is ' in RL:
			MAC = RL.split()[-1]
			DIC['MAC'] = MAC
		#elif 'Input,' in RL and 'packets' in RL:
		#	IP = RL.split()[4]
		#elif 'Output,' in RL and 'packets' in RL:
		#	OP = RL.split()[4]
		elif 'Last physical down time : ' in RL:
			FT = ' '.join(RL.split()[-2:])
			DIC['FT'] = FT
	return DIC