class TestInterfaces(BaseTestCase): def setUp(self): self.results = load_pickle(self, 'results') self.device = load_pickle(self, 'device') self.plugin = Interfaces() def test_process(self): data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals(len(data.maps), 13) eth0 = data.maps[12] self.assertEquals(eth0.adminStatus, 1) self.assertEquals(eth0.description, "Local Area Connection 2") self.assertEquals(eth0.duplex, 0) self.assertEquals(eth0.id, "12-Intel_R_ PRO_1000 MT Network Connection") self.assertEquals(eth0.ifindex, '14') self.assertEquals(eth0.interfaceName, "Intel(R) PRO/1000 MT Network Connection") self.assertEquals(eth0.macaddress, "00:50:56:8D:45:FC") self.assertEquals(eth0.perfmonInstance, "\\Network Interface(Intel[R] PRO_1000 MT Network Connection)") self.assertEquals(eth0.setIpAddresses, ['192.168.240.37/23', 'fe80::a930:96ad:f65e:b3ba/64']) self.assertEquals(eth0.speed, 1000000000) self.assertEquals(eth0.title, "Intel(R) PRO/1000 MT Network Connection") self.assertEquals(eth0.type, "Ethernet 802.3") def test_sanitize_counters(self): counters = Mock() counters.stdout = "a:None|a:a|" self.assertIsNone(self.plugin.sanitize_counters(None)) self.assertEquals(self.plugin.sanitize_counters(counters), {'a': 'a'})
class TestTeamInterfaces(BaseTestCase): def setUp(self): self.device = load_pickle_file(self, 'device') self.plugin = Interfaces() def test_process(self): self.results = load_pickle_file(self, 'Interfaces_process_184038')[0] data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals(data.maps[7].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter)") self.assertFalse(data.maps[7].monitor) self.assertEquals(data.maps[7].speed, 0) self.assertEquals(data.maps[8].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2)") self.assertFalse(data.maps[8].monitor) self.assertEquals(data.maps[8].speed, 0) self.assertEquals(data.maps[12].speed, 1000000000) self.assertEquals(data.maps[13].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter#1)") self.assertFalse(data.maps[13].monitor) self.assertEquals(data.maps[13].speed, 0) self.assertEquals(data.maps[14].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2#1)") self.assertFalse(data.maps[14].monitor) self.assertEquals(data.maps[14].speed, 0) self.results = load_pickle_file(self, 'Interfaces_process_184151')[0] data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals(data.maps[7].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter)") self.assertEquals(data.maps[8].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2)") self.assertEquals(data.maps[12].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter#1)") self.assertEquals(data.maps[13].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2#1)")
def setUp(self): self.results = load_pickle(self, 'results') self.results['win32_pnpentity'] = { 'Win32_PnPEntity': { '12': self.results['Win32_NetworkAdapter'] } } self.device = load_pickle(self, 'device') self.plugin = Interfaces()
class TestTeamInterfaces(BaseTestCase): def setUp(self): self.device = load_pickle_file(self, 'device') self.plugin = Interfaces() def test_process(self): self.results = load_pickle_file(self, 'Interfaces_process_184038')[0] data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals( data.maps[7].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter)" ) self.assertFalse(data.maps[7].monitor) self.assertEquals(data.maps[7].speed, 0) self.assertEquals( data.maps[8].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2)" ) self.assertFalse(data.maps[8].monitor) self.assertEquals(data.maps[8].speed, 0) self.assertEquals(data.maps[12].speed, 1000000000) self.assertEquals( data.maps[13].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter#1)" ) self.assertFalse(data.maps[13].monitor) self.assertEquals(data.maps[13].speed, 0) self.assertEquals( data.maps[14].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2#1)" ) self.assertFalse(data.maps[14].monitor) self.assertEquals(data.maps[14].speed, 0) self.results = load_pickle_file(self, 'Interfaces_process_184151')[0] data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals( data.maps[7].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter)" ) self.assertEquals( data.maps[8].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2)" ) self.assertEquals( data.maps[12].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter#1)" ) self.assertEquals( data.maps[13].perfmonInstance, "\\Network Interface(HP NC382i DP Multifunction Gigabit Server Adapter _2#1)" )
class TestInterfacesCounters(BaseTestCase): def setUp(self): self.results = load_pickle(self, 'interfaces')[0] self.device = load_pickle(self, 'device') self.plugin = Interfaces() def test_process(self): data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals(len(data.maps), 14) self.assertFalse(hasattr(data.maps[7], 'perfmonInstance')) self.assertEquals(data.maps[12].perfmonInstance, "\\Network Interface(RedHat PV NIC Driver _2)") results = load_pickle_file(self, 'Interfaces_process_163512')[0] for i in results['Win32_NetworkAdapter']: i.PhysicalAdapter = 'false' data = self.plugin.process(self.device, results, Mock()) self.assertEquals(data.maps[7].perfmonInstance, "\\Network Interface(AWS PV Network Device _0)")
class TestInterfacesCounters(BaseTestCase): def setUp(self): self.results = load_pickle(self, 'interfaces')[0] self.device = load_pickle(self, 'device') self.plugin = Interfaces() def test_process(self): data = self.plugin.process(self.device, self.results, Mock()) self.assertEquals(len(data.maps), 14) self.assertFalse(hasattr(data.maps[7], 'perfmonInstance')) self.assertEquals(data.maps[12].perfmonInstance, "\\Network Interface(RedHat PV NIC Driver _2)")
class TestNoWMI(BaseTestCase): """Test case for no WMI data, but there was successful powershell collection""" def setUp(self): self.results = load_pickle_file(self, 'Interfaces_process_194131')[0] self.device = load_pickle_file(self, 'device') self.plugin = Interfaces() def test_process(self): m = Mock() data = self.plugin.process(self.device, self.results, m) # We should not return an empty relationship map self.assertEquals(data, None) self.assertTrue('Received incomplete Interface modeling results.' in str(m.mock_calls[1]))
def setUp(self): self.results = load_pickle(self, 'interfaces')[0] self.device = load_pickle(self, 'device') self.plugin = Interfaces()
def setUp(self): self.results = load_pickle_file(self, 'Interfaces_process_194131')[0] self.device = load_pickle_file(self, 'device') self.plugin = Interfaces()
def setUp(self): self.device = load_pickle_file(self, 'device') self.plugin = Interfaces()
def setUp(self): self.results = load_pickle(self, 'results') self.results['win32_pnpentity'] = {'Win32_PnPEntity': {'12': self.results['Win32_NetworkAdapter']}} self.device = load_pickle(self, 'device') self.plugin = Interfaces()