'Test connectivity from h1 to router'

def testRouterPing(self):

    p = pexpect.spawn('python    -m    mininet.examples.linuxrouter')
    p.expect(self.prompt)
    p.sendline('h1    ping    -c    1    r0')
    p.expect('(\\d+)%    packet    loss')
    percent = (int(p.match.group(1)) if p.match else (-1))
    p.expect(self.prompt)
    p.sendline('exit')
    p.wait()
    self.assertEqual(percent, 0)
