mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-17 01:32:37 +02:00
Added AIX support for ARP, along with AIX ARP test support
This commit is contained in:
@ -236,8 +236,7 @@ def parse(
|
|||||||
'hwtype': splitline[4].lstrip('[').rstrip(']'),
|
'hwtype': splitline[4].lstrip('[').rstrip(']'),
|
||||||
'hwaddress': splitline[3],
|
'hwaddress': splitline[3],
|
||||||
}
|
}
|
||||||
# AIX tells what bucket the entry is in, and no interface
|
# Handle permanence and ignore interface in AIX
|
||||||
# information
|
|
||||||
if 'permanent' in splitline:
|
if 'permanent' in splitline:
|
||||||
output_line['permanent'] = True
|
output_line['permanent'] = True
|
||||||
elif 'in' not in splitline[6]:
|
elif 'in' not in splitline[6]:
|
||||||
|
@ -42,6 +42,9 @@ class MyTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-8/arp-a.out'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-8/arp-a.out'), 'r', encoding='utf-8') as f:
|
||||||
centos8_arp_a = f.read()
|
centos8_arp_a = f.read()
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/aix-7.1/arp-a.out'), 'r', encoding='utf-8') as f:
|
||||||
|
aix_7_1_arp_a = f.read()
|
||||||
|
|
||||||
# output
|
# output
|
||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/arp.json'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/arp.json'), 'r', encoding='utf-8') as f:
|
||||||
centos_7_7_arp_json = json.loads(f.read())
|
centos_7_7_arp_json = json.loads(f.read())
|
||||||
@ -76,6 +79,9 @@ class MyTests(unittest.TestCase):
|
|||||||
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-8/arp-a.json'), 'r', encoding='utf-8') as f:
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-8/arp-a.json'), 'r', encoding='utf-8') as f:
|
||||||
centos8_arp_a_json = json.loads(f.read())
|
centos8_arp_a_json = json.loads(f.read())
|
||||||
|
|
||||||
|
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/aix-7.1/arp-a.json'), 'r', encoding='utf-8') as f:
|
||||||
|
aix_7_1_arp_a_json = json.loads(f.read())
|
||||||
|
|
||||||
def test_arp_nodata(self):
|
def test_arp_nodata(self):
|
||||||
"""
|
"""
|
||||||
Test 'arp' with no data
|
Test 'arp' with no data
|
||||||
@ -148,6 +154,12 @@ class MyTests(unittest.TestCase):
|
|||||||
"""
|
"""
|
||||||
self.assertEqual(jc.parsers.arp.parse(self.centos8_arp_a, quiet=True), self.centos8_arp_a_json)
|
self.assertEqual(jc.parsers.arp.parse(self.centos8_arp_a, quiet=True), self.centos8_arp_a_json)
|
||||||
|
|
||||||
|
def test_arp_a_aix_7_1(self):
|
||||||
|
"""
|
||||||
|
Test 'arp -a' on CentOS 8 with incomplete hw addresses
|
||||||
|
"""
|
||||||
|
self.assertEqual(jc.parsers.arp.parse(self.aix_7_1_arp_a, quiet=True), self.aix_7_1_arp_a_json)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Reference in New Issue
Block a user