All of lore.kernel.org
 help / color / mirror / Atom feed
* [dunfell][Patch 1/7] oeqa/ethernet_ip_connman : add test for network connections
@ 2021-07-29  1:21 Teoh, Jay Shen
  2021-07-29  1:21 ` [dunfell][Patch 2/7] oeqa/runtime : add test for RTC(Real Time Clock) Teoh, Jay Shen
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Teoh, Jay Shen @ 2021-07-29  1:21 UTC (permalink / raw)
  To: openembedded-core

From: Teoh Jay Shen <jay.shen.teoh@intel.com>

This test mimic the ethernet_static_ip_set_in_connman and ethernet_get_IP_in_connman_via_DHCP test case from oeqa/manual/bsp-hw.json.
The ethernet_static_ip_set_in_connman and ethernet_get_IP_in_connman_via_DHCP manual test case should be remove from oeqa/manual/bsp-hw.json if this patch get merged.

(From OE-Core rev: aaabc94dbe353b12297ba4a237f6817b2c6d4a31)

Signed-off-by: Teoh Jay Shen <jay.shen.teoh@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../oeqa/runtime/cases/ethernet_ip_connman.py | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py

diff --git a/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py b/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py
new file mode 100644
index 0000000000..e010612838
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ethernet_ip_connman.py
@@ -0,0 +1,36 @@
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.data import skipIfQemu
+
+class Ethernet_Test(OERuntimeTestCase):
+
+    def set_ip(self, x): 
+        x = x.split(".")
+        sample_host_address = '150'        
+        x[3] = sample_host_address
+        x = '.'.join(x)
+        return x
+    
+    @skipIfQemu('qemuall', 'Test only runs on real hardware')    
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_set_virtual_ip(self):
+        (status, output) = self.target.run("ifconfig eth0 | grep 'inet ' | awk '{print $2}'")
+        self.assertEqual(status, 0, msg='Failed to get ip address. Make sure you have an ethernet connection on your device, output: %s' % output)
+        original_ip = output 
+        virtual_ip = self.set_ip(original_ip)
+        
+        (status, output) = self.target.run("ifconfig eth0:1 %s netmask 255.255.255.0 && sleep 2 && ping -c 5 %s && ifconfig eth0:1 down" % (virtual_ip,virtual_ip))
+        self.assertEqual(status, 0, msg='Failed to create virtual ip address, output: %s' % output)
+        
+    @OETestDepends(['ethernet_ip_connman.Ethernet_Test.test_set_virtual_ip'])  
+    def test_get_ip_from_dhcp(self): 
+        (status, output) = self.target.run("connmanctl services | grep -E '*AO Wired|*AR Wired' | awk '{print $3}'")
+        self.assertEqual(status, 0, msg='No wired interfaces are detected, output: %s' % output)
+        wired_interfaces = output
+        
+        (status, output) = self.target.run("ip route | grep default | awk '{print $3}'")
+        self.assertEqual(status, 0, msg='Failed to retrieve the default gateway, output: %s' % output)
+        default_gateway = output
+
+        (status, output) = self.target.run("connmanctl config %s --ipv4 dhcp && sleep 2 && ping -c 5 %s" % (wired_interfaces,default_gateway))
+        self.assertEqual(status, 0, msg='Failed to get dynamic IP address via DHCP in connmand, output: %s' % output)
\ No newline at end of file
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-29  1:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  1:21 [dunfell][Patch 1/7] oeqa/ethernet_ip_connman : add test for network connections Teoh, Jay Shen
2021-07-29  1:21 ` [dunfell][Patch 2/7] oeqa/runtime : add test for RTC(Real Time Clock) Teoh, Jay Shen
2021-07-29  1:21 ` [dunfell][Patch 3/7] oeqa/runtime/cases: Only disable/enable for current boot Teoh, Jay Shen
2021-07-29  1:21 ` [dunfell][Patch 4/7] oeqa/suspend : add test for suspend state Teoh, Jay Shen
2021-07-29  1:21 ` [dunfell][Patch 5/7] oeqa/runtime: add test for matchbox-terminal Teoh, Jay Shen
2021-07-29  1:21 ` [dunfell][Patch 6/7] oeqa/terminal : improve the test case Teoh, Jay Shen
2021-07-29  1:21 ` [dunfell][Patch 7/7] oeqa/usb_hid.py : add test to check the usb/human interface device status after suspend state Teoh, Jay Shen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.