def test_cmd_fm_test_mode_params(self): mac = self.txunit.device.getMacAddress() expected = sstring.trimMacAddress("00:00:00:00:00:0a" if self._plinenum == 10 else "00:00:00:00:00:0%s" % self._plinenum) self.assertEqual( mac, expected, "actual mac %s not matched with expected mac %s" % (mac, expected)) productId = self.txunit.device.getProductId() expected = "0x3" self.assertEqual(productId, expected, "product id not matched") regulatoryId = self.txunit.device.getRegulatoryId() expected = "0x1" self.assertEqual(regulatoryId, expected, "regulatory id not matched") wvanName = self.txunit.device.getWvanName() expected = "TEST_LINE_%s" % self._plinenum self.assertEqual(wvanName, expected, "wvan name not matched") (hr, lr, devas, wvan_id) = self.txunit.device._get_umac_sm_show() self.assertEqual(wvan_id, self._plinenum, "wvan id not matched with product line number") self.assertEqual(devas, "Station", "device is not as Station") self.assertEqual(hr, self._expected_HR, "hr not match") self.assertEqual(lr, self._expected_LR, "lr not match")
def test_rx_sendmsg_tx(self): """ 1.set BA'filter ,set filiter through 'echo 2222222> /sys/devices/virtual/video/sii6400/wihd/vendor_msg/recv_filter' 2.set sink filter,same as BA or not 3.send message to source ,through vendor_msg_send 11:11:11 112233445566 2 DD:DD """ vendor_id = recv_filter = "22:22:22" data = "EE:DD:AA" self.txunit.device.setVendorMsgFilter(recv_filter) self.rxunit.device.setVendorMsgFilter(recv_filter) tx_mac_addr = self.txunit.device.getMacAddress() rx_mac_addr = self.rxunit.device.getMacAddress() with self.txunit.uevent.listen("vendor_msg_received") as listener: """ {"event":"vendor_msg_received","data":{"vendor_id":"222222","mac_addr":"0dd694ca4f00","vendor_msg":"eeddaa"}} """ msg = VendorMsg(vendor_id, tx_mac_addr, len(data.split(":")), data) resp = self.rxunit.device.sendVendorMsg(msg) self.assertIn("OK", resp, "RX send vendor message to TX should be OK") event = listener.get(timeout=5) self.assertIsNotNone(event, "TX should receive vendor message in 5s") vendor_id = event.data['vendor_id'] self.assertEqual(vendor_id, vendor_id, "TX received vendor_id should same") mac_addr = sstring.trimMacAddress(event.data['mac_addr']) self.assertEqual(mac_addr, rx_mac_addr, "TX received mac_addr should same") vendor_msg = event.data['vendor_msg'] self.assertEqual(vendor_msg, data.replace(":", "").lower(), "TX received vendor_msg should same")
def getMacAddress(self): mac = self.sendcmd("custparamget 0") if re.search("OK", mac, re.I): # for B&A mac = mac.split("OK")[0].split("=")[1] else: # for Gen3 mac = mac.split("<")[0] return sstring.trimMacAddress(mac)
def getMacAddress(self): mac = self.sendcmd("custparamget 0") if re.search("OK", mac, re.I): #for B&A mac = mac.split("OK")[0].split("=")[1] else: #for Gen3 mac = mac.split("<")[0] return sstring.trimMacAddress(mac)
def recvVendorMsg(self): """<15:40:52.319> 11:11:11 11:22:33:44:55:66 03 AA:BB:CC 0""" resp = self.sendcmd("ss_server getvendormsg") l = resp.split(" ") l = l[1:-1] vendorID = l[0].lower() dstMacAddr = sstring.trimMacAddress(l[1].lower()) length = int(l[2]) data = l[3].lower() return VendorMsg(vendorID, dstMacAddr, length, data)
def test_cmd_custparamsetbulk(self): bulkdata = genBulkData() trsanlatedBulkData = list(bulkdata) trsanlatedBulkData[2] = sstring.quote(bulkdata[2]) trsanlatedBulkData[5] = "%%22%s%%22" % sstring.quote(bulkdata[5]) params = " ".join(trsanlatedBulkData) data = self.txunit.device.sendcmd("custparamsetbulk %s" % params, interval=1, timeout=12) self.assertIn("OK", data, "custparamsetbulk failed") self._test_mode(self.txunit, "off") self._test_mode(self.txunit, "wihd") actual = self.txunit.device.getMacAddress() expected = sstring.trimMacAddress(bulkdata[0]) self.assertEqual(actual, expected, "custparamsetbulk set mac address failed") actual = self.txunit.device.getManuFacturerId() expected = bulkdata[1] self.assertEqual(actual, expected, "custparamsetbulk set manufacturer id failed") actual = self.txunit.device.getDeviceName() expected = bulkdata[2] self.assertEqual(actual, expected, "custparamsetbulk set device name failed") actual = self.txunit.device.getProductId() expected = bulkdata[3] self.assertEqual(actual, expected, "custparamsetbulk set product id failed") actual = self.txunit.device.getRegulatoryId() expected = bulkdata[4] self.assertEqual(actual, expected, "custparamsetbulk set regulatory id failed") actual = self.txunit.device.getWvanName() expected = bulkdata[5] self.assertEqual(actual, expected, "custparamsetbulk set wvan name failed")
def connect(self, dstMacAddr): dstMacAddr = sstring.trimMacAddress(dstMacAddr) self.run("echo %s > /sys/devices/virtual/video/sii6400/wihd/connect" % dstMacAddr.replace(":", ""))
def getMacAddress(self): resp = self.run("cat /sys/devices/virtual/video/sii6400/wihd/self/mac_addr") return sstring.trimMacAddress(resp)
def getMacAddress(self): resp = self.run("cat /sys/devices/virtual/video/sii6400/wihd/self/mac_addr") return sstring.trimMacAddress(resp[1])
def setMacAddress(self, macaddr): resp = self.sendcmd("custparamset 0 %s" % sstring.trimMacAddress(macaddr)) if "OK" not in resp: raise DeviceAdapterError("set mac address failed with value: %s" % macaddr)