#NEWLINE# def send_arp( self , arp_opcode , vlan_id , src_mac , dst_mac , src_ip , dst_ip , arp_target_mac , in_port , output ) : #NEWLINE# #INDENT# if ( vlan_id != VLANID_NONE ) : #NEWLINE# #INDENT# ether_proto = ether . ETH_TYPE_8021Q #NEWLINE# pcp = 0 #NEWLINE# cfi = 0 #NEWLINE# vlan_ether = ether . ETH_TYPE_ARP #NEWLINE# v = vlan . vlan ( pcp , cfi , vlan_id , vlan_ether ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ether_proto = ether . ETH_TYPE_ARP #NEWLINE# #UNINDENT# hwtype = 1 #NEWLINE# arp_proto = ether . ETH_TYPE_IP #NEWLINE# hlen = 6 #NEWLINE# plen = 4 #NEWLINE# pkt = packet . Packet ( ) #NEWLINE# e = ethernet . ethernet ( dst_mac , src_mac , ether_proto ) #NEWLINE# a = arp . arp ( hwtype , arp_proto , hlen , plen , arp_opcode , src_mac , src_ip , arp_target_mac , dst_ip ) #NEWLINE# pkt . add_protocol ( e ) #NEWLINE# if ( vlan_id != VLANID_NONE ) : #NEWLINE# #INDENT# pkt . add_protocol ( v ) #NEWLINE# #UNINDENT# pkt . add_protocol ( a ) #NEWLINE# pkt . serialize ( ) #NEWLINE# self . send_packet_out ( in_port , output , pkt . data , data_str = str ( pkt ) )