Esempio n. 1
0
 def test_dhcp_server_on_eth1(self):
     """Test verifies dhcp server on eth1 iface"""
     response = api.check_dhcp_on_eth('eth1', 2)
     self.assertEqual(len(response), 1)
     # we need to guarantee that received answer has server_ip
     # but dont want to check its real address
     self.assertTrue(response[0]['server_ip'])
Esempio n. 2
0
 def test_dhcp_server_on_eth1(self):
     """Test verifies dhcp server on eth1 iface
     """
     response = api.check_dhcp_on_eth('eth1', 2)
     self.assertEqual(len(response), 1)
     # we need to guarantee that received answer has server_ip
     # but dont want to check its real address
     self.assertTrue(response[0]['server_ip'])
Esempio n. 3
0
    def test_dhcp_server_on_eth2_down(self):
        """iface should be ifuped in case it's down and rolledback after"""
        manager = utils.IfaceState([self.iface_down])
        with manager as ifaces:
            response = api.check_dhcp_on_eth(ifaces[0], 2)

        self.assertEqual(len(response), 1)
        self.assertTrue(response[0]['server_ip'])
        self.assertEqual(manager.pre_iface_state, 'DOWN')
        self.assertEqual(manager.iface_state, 'UP')
        self.assertEqual(manager.post_iface_state, 'DOWN')
Esempio n. 4
0
    def test_dhcp_server_on_eth0_up(self):
        """Test verifies that if iface is up, it won't be touched"""
        manager = utils.IfaceState([self.iface_up])
        with manager as ifaces:
            response = api.check_dhcp_on_eth(ifaces[0], 2)

        self.assertEqual(len(response), 1)
        self.assertTrue(response[0]['server_ip'])
        self.assertEqual(manager.pre_iface_state, 'UP')
        self.assertEqual(manager.iface_state, 'UP')
        self.assertEqual(manager.post_iface_state, 'UP')
Esempio n. 5
0
    def test_dhcp_server_on_eth0_up(self):
        """Test verifies that if iface is up, it won't be touched
        """
        manager = utils.IfaceState(self.iface_up)
        with manager as iface:
            response = api.check_dhcp_on_eth(iface, 2)

        self.assertEqual(len(response), 1)
        self.assertEqual(response[0]['server_ip'], '10.0.2.2')
        self.assertEqual(manager.pre_iface_state, 'UP')
        self.assertEqual(manager.iface_state, 'UP')
        self.assertEqual(manager.post_iface_state, 'UP')
Esempio n. 6
0
    def test_dhcp_server_on_eth1_down(self):
        """Test verifies that iface would be ifuped in case it's down
        and rolledback after
        """
        manager = utils.IfaceState(self.iface_down)
        with manager as iface:
            response = api.check_dhcp_on_eth(iface, 2)

        self.assertEqual(len(response), 1)
        self.assertEqual(response[0]['server_ip'], '10.10.0.8')
        self.assertEqual(manager.pre_iface_state, 'DOWN')
        self.assertEqual(manager.iface_state, 'UP')
        self.assertEqual(manager.post_iface_state, 'DOWN')
Esempio n. 7
0
    def test_dhcp_server_on_eth2_down(self):
        """Test verifies that iface would be ifuped in case it's down
        and rolledback after
        """
        manager = utils.IfaceState(self.iface_down)
        with manager as iface:
            response = api.check_dhcp_on_eth(iface, 2)

        self.assertEqual(len(response), 1)
        self.assertEqual(response[0]['server_ip'], '10.10.0.8')
        self.assertEqual(manager.pre_iface_state, 'DOWN')
        self.assertEqual(manager.iface_state, 'UP')
        self.assertEqual(manager.post_iface_state, 'DOWN')
Esempio n. 8
0
 def test_dhcp_server_on_eth1(self):
     response = api.check_dhcp_on_eth('eth1', 5)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '192.168.0.5')
Esempio n. 9
0
 def test_dhcp_server_on_eth2(self):
     """Test verifies dhcp server on eth2 iface
     """
     response = api.check_dhcp_on_eth('eth2', 2)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '10.10.0.8')
Esempio n. 10
0
 def test_dhcp_server_on_eth2(self):
     response = api.check_dhcp_on_eth('eth2', 5)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '10.10.0.10')
Esempio n. 11
0
 def test_dhcp_server_on_eth1(self):
     """Test verifies dhcp server on eth1 iface
     """
     response = api.check_dhcp_on_eth('eth1', 2)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '192.168.0.5')
Esempio n. 12
0
 def test_check():
     manager = utils.IfaceState('eth10')
     with manager as iface:
         api.check_dhcp_on_eth(iface, 2)
Esempio n. 13
0
 def test_check_dhcp_on_eth_empty_response(self, raw_hwaddr, srp_mock):
     raw_hwaddr.return_value = ('111', '222')
     srp_mock.return_value = ([], [])
     response = api.check_dhcp_on_eth('eth1', timeout=5)
     self.assertEqual([], response)
Esempio n. 14
0
 def test_check_dhcp_on_eth_empty_response(self, raw_hwaddr, srp_mock, *_):
     raw_hwaddr.return_value = ("111", "222")
     srp_mock.return_value = ([], [])
     response = api.check_dhcp_on_eth("eth1", timeout=5)
     self.assertEqual([], response)
Esempio n. 15
0
 def test_dhcp_server_on_eth2(self):
     response = api.check_dhcp_on_eth('eth2', 5)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '10.10.0.10')
Esempio n. 16
0
 def test_check():
     manager = utils.IfaceState('eth10')
     with manager as iface:
         api.check_dhcp_on_eth(iface, 2)
Esempio n. 17
0
 def test_check():
     manager = utils.IfaceState(['eth10'])
     with manager as ifaces:
         api.check_dhcp_on_eth(ifaces[0], 2)
Esempio n. 18
0
 def test_dhcp_server_on_eth2(self):
     """Test verifies dhcp server on eth2 iface
     """
     response = api.check_dhcp_on_eth('eth2', 2)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '10.10.0.8')
Esempio n. 19
0
 def test_dhcp_server_on_eth1(self):
     """Test verifies dhcp server on eth1 iface
     """
     response = api.check_dhcp_on_eth('eth1', 2)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '192.168.0.5')
Esempio n. 20
0
 def test_check_dhcp_on_eth_empty_response(self, raw_hwaddr, srp_mock):
     raw_hwaddr.return_value = ('111', '222')
     srp_mock.return_value = ([], [])
     response = api.check_dhcp_on_eth('eth1', timeout=5)
     self.assertEqual([], response)
Esempio n. 21
0
 def test_dhcp_server_on_eth1(self):
     response = api.check_dhcp_on_eth('eth1', 5)
     self.assertEqual(len(response), 1)
     self.assertEqual(response[0]['server_ip'], '192.168.0.5')