def test_mpls_ping_success(self): c = Connection(hostname='mlx8', start=['mock_device_cli --os ironware --state exec'], os='ironware', credentials={ 'default': { 'username': '******', 'password': '******' }, 'enable': { 'password': '******' } }) c.mpls_ping(lsp='mlx8.1_to_ces.2') self.assertEqual( "\n".join(c.spawn.match.match_output.splitlines()), """ping mpls rsvp lsp mlx8.1_to_ces.2 Send 5 96-byte MPLS Echo Requests over RSVP LSP mlx8.1_to_ces.2, timeout 5000 msec Type Control-c to abort !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max=0/1/3 ms SSH@mlx8#""")
def test_mpls_ping_failure(self): c = Connection(hostname='mlx8', start=['mock_device_cli --os ironware --state exec'], os='ironware', credentials={ 'default': { 'username': '******', 'password': '******' }, 'enable': { 'password': '******' } }) try: c.mpls_ping(lsp='mlx8.1_to_mlx8.4') except SubCommandFailure: pass self.assertEqual( "\n".join(c.spawn.match.match_output.splitlines()), """ping mpls rsvp lsp mlx8.1_to_mlx8.4 Ping fails: LSP is down SSH@mlx8#""") c.disconnect()