SAI icon indicating copy to clipboard operation
SAI copied to clipboard

[SAI-PTF] how to run the saihostif.py for saithrfitv2 test

Open fan-leo opened this issue 3 years ago • 3 comments

in saihostif.py, the code below can't work well, because the ptf docker can't open the host interface created in the DUT. hif1_socket = open_packet_socket(hostif1_name) Probably because I'm using a wrong test method , So please show me the right method for hostif test, Thanks a lot

fan-leo avatar Oct 08 '22 08:10 fan-leo

such as:

self.hostif = sai_thrift_create_hostif(self.client,name=hostif_name,/* hostif created in DUT*/
                     obj_id=self.iport,type=SAI_HOSTIF_TYPE_NETDEV)
self.assertNotEqual(self.hostif, 0)
self.hif_socket = open_packet_socket(hostif_name)

def open_packet_socket(hostif_name):
    eth_p_all = 3
    sock = socket.socket(socket.AF_PACKET, socket.SOCK_RAW,
                         socket.htons(eth_p_all))
    sock.bind((hostif_name, eth_p_all))/*occur error, hostif created in DUT and not exist in test server, so bind error*/
    sock.setblocking(0)
    return sock

fan-leo avatar Oct 26 '22 10:10 fan-leo