Skip to content
Snippets Groups Projects
Commit 3c9b9ad0 authored by Erik Reid's avatar Erik Reid
Browse files

use junosspace data for test router list

parent 7f4ad457
No related branches found
No related tags found
No related merge requests found
import os
import re
from lxml import etree
from inventory_provider import config
import inventory_provider
......@@ -10,9 +12,14 @@ TEST_DATA_DIRNAME = os.path.realpath(os.path.join(
def pytest_generate_tests(metafunc):
filename = os.path.join(TEST_DATA_DIRNAME, "routers_community.conf")
filename = os.path.join(TEST_DATA_DIRNAME, "junosspace-devices.xml")
with open(filename) as f:
routers = config._load_routers(f)
doc = etree.fromstring(f.read().encode('utf-8'))
routers = []
for name in doc.xpath('//devices/device/name/text()'):
m = re.match('^(mx[1|2].*)\.re0', name)
if m:
routers.append({'hostname': m.group(1) + '.geant.net'})
metafunc.parametrize(
"router",
list([r['hostname'] for r in routers]))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment