Setup tests

This commit is contained in:
ramnes 2020-02-02 20:08:56 +01:00 committed by Guillaume Gelin
commit bab2d26ad0
46 changed files with 11717 additions and 117 deletions

View file

@ -1,8 +1,8 @@
import re
import subprocess
from netbox_agent.raid.base import Raid, RaidController
from netbox_agent.misc import get_vendor
from netbox_agent.raid.base import Raid, RaidController
REGEXP_CONTROLLER_HP = re.compile(r'Smart Array ([a-zA-Z0-9- ]+) in Slot ([0-9]+)')

View file

@ -1,6 +1,6 @@
import re
import subprocess
import xml.etree.ElementTree as ET # NOQA
import xml.etree.ElementTree as ET # NOQA
from netbox_agent.misc import get_vendor
from netbox_agent.raid.base import Raid, RaidController
@ -43,7 +43,7 @@ class OmreportController(RaidController):
ret = []
output = subprocess.getoutput(
'omreport storage controller controller={} -fmt xml'.format(self.controller_index)
)
)
root = ET.fromstring(output)
et_array_disks = root.find('ArrayDisks')
if et_array_disks is not None:
@ -54,7 +54,7 @@ class OmreportController(RaidController):
'SN': get_field(obj, 'DeviceSerialNumber'),
'Size': '{:.0f}GB'.format(
int(get_field(obj, 'Length')) / 1024 / 1024 / 1024
),
),
'Type': 'HDD' if int(get_field(obj, 'MediaType')) == 1 else 'SSD',
'_src': self.__class__.__name__,
})

View file

@ -1,5 +1,5 @@
import subprocess
import json
import subprocess
from netbox_agent.misc import get_vendor
from netbox_agent.raid.base import Raid, RaidController
@ -47,7 +47,7 @@ class StorcliController(RaidController):
'Size': size,
'Type': media_type,
'_src': self.__class__.__name__,
})
})
return ret