Ejemplo 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'])
Ejemplo 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'])
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo 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')
Ejemplo n.º 12
0
 def test_check():
     manager = utils.IfaceState('eth10')
     with manager as iface:
         api.check_dhcp_on_eth(iface, 2)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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')
Ejemplo n.º 16
0
 def test_check():
     manager = utils.IfaceState('eth10')
     with manager as iface:
         api.check_dhcp_on_eth(iface, 2)
Ejemplo n.º 17
0
 def test_check():
     manager = utils.IfaceState(['eth10'])
     with manager as ifaces:
         api.check_dhcp_on_eth(ifaces[0], 2)
Ejemplo 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')
Ejemplo 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')
Ejemplo 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)
Ejemplo 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')