'Verify that switches are connected to the controller specified by cmap'

def connectedTest(self, name, cmap):

    p = pexpect.spawn(('python    -m    %s' % name))
    p.expect(self.prompt)
    p.sendline('pingall')
    p.expect('(\\d+)%    dropped')
    percent = (int(p.match.group(1)) if p.match else (-1))
    self.assertEqual(percent, 0)
    p.expect(self.prompt)
    for switch in cmap:
        p.sendline(('sh    ovs-vsctl    get-controller    %s' % switch))
        p.expect('tcp:([\\d.:]+)')
        actual = p.match.group(1)
        expected = cmap[switch]
        self.assertEqual(actual, expected)
    p.expect(self.prompt)
    p.sendline('exit')
    p.wait()
