Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
| 1 |
__author__ = "rsherman, vnitinv" |
| 2 |
|
| 3 |
try: |
| 4 |
import unittest2 as unittest |
| 5 |
except ImportError: |
| 6 |
import unittest |
| 7 |
|
| 8 |
from jnpr.junos.op.routes import RouteTable |
| 9 |
import json |
| 10 |
|
| 11 |
|
| 12 |
class TestTable(unittest.TestCase): |
| 13 |
@classmethod |
| 14 |
def setUpClass(self): |
| 15 |
from jnpr.junos import Device |
| 16 |
|
| 17 |
self.dev = Device(host="xxxx", user="jenkins", password="password") |
| 18 |
self.dev.open() |
| 19 |
|
| 20 |
@classmethod |
| 21 |
def tearDownClass(self): |
| 22 |
self.dev.close() |
| 23 |
|
| 24 |
def test_table_union(self): |
| 25 |
tbl = RouteTable(self.dev) |
| 26 |
tbl.get() |
| 27 |
self.assertEqual(tbl[0].via, "em0.0") |
| 28 |
|
| 29 |
def test_table_json(self): |
| 30 |
tbl = RouteTable(self.dev) |
| 31 |
tbl.get("10.48.21.71") |
| 32 |
self.assertEqual( |
| 33 |
json.loads(tbl.to_json())["10.48.21.71/32"]["protocol"], "Local" |
| 34 |
) |