Merging upstream version 2.3~rc1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
972d2d9aa2
commit
ca2ec6771a
37 changed files with 1946 additions and 407 deletions
|
@ -1,11 +1,12 @@
|
|||
#!/usr/bin/python3
|
||||
import json
|
||||
import shutil
|
||||
import socket
|
||||
import logging
|
||||
import unittest
|
||||
import ipaddress
|
||||
import subprocess
|
||||
from staslib import iputil, log, trid
|
||||
from staslib import iputil, log, stas, trid
|
||||
|
||||
IP = shutil.which('ip')
|
||||
|
||||
|
@ -39,6 +40,12 @@ class Test(unittest.TestCase):
|
|||
|
||||
self.assertEqual('', iputil.get_interface('255.255.255.255'))
|
||||
|
||||
def test_mac2iface(self):
|
||||
for iface in self.ifaces:
|
||||
address = iface.get('address', None)
|
||||
if address:
|
||||
self.assertEqual(iface['ifname'], iputil.mac2iface(address))
|
||||
|
||||
def test_remove_invalid_addresses(self):
|
||||
good_tcp = trid.TID({'transport': 'tcp', 'traddr': '1.1.1.1', 'subsysnqn': '', 'trsvcid': '8009'})
|
||||
bad_tcp = trid.TID({'transport': 'tcp', 'traddr': '555.555.555.555', 'subsysnqn': '', 'trsvcid': '8009'})
|
||||
|
@ -51,7 +58,7 @@ class Test(unittest.TestCase):
|
|||
any_fc,
|
||||
bad_trtype,
|
||||
]
|
||||
l2 = iputil.remove_invalid_addresses(l1)
|
||||
l2 = stas.remove_invalid_addresses(l1)
|
||||
|
||||
self.assertNotEqual(l1, l2)
|
||||
|
||||
|
@ -61,6 +68,11 @@ class Test(unittest.TestCase):
|
|||
self.assertNotIn(bad_tcp, l2)
|
||||
self.assertNotIn(bad_trtype, l2)
|
||||
|
||||
def test__data_matches_ip(self):
|
||||
self.assertFalse(iputil._data_matches_ip(None, None, None))
|
||||
self.assertFalse(iputil._data_matches_ip(socket.AF_INET, None, None))
|
||||
self.assertFalse(iputil._data_matches_ip(socket.AF_INET6, None, None))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue