Exemplo n.º 1
0
 def test_0098_teardown(self):
     """Remove the DHCP ip pools of gateway.
      Invokes the delete_pool of the DhcpPool.
     """
     gateway = Environment. \
         get_test_gateway(TestDhcp._client)
     gateway_obj = Gateway(TestDhcp._client,
                           TestDhcp._name,
                           href=gateway.get('href'))
     dhcp_resource = gateway_obj.get_dhcp()
     for ip_pool in dhcp_resource.ipPools.ipPool:
         dhcp_pool_object = DhcpPool(TestDhcp._client, self._name,
                                     ip_pool.poolId)
         dhcp_pool_object.delete_pool()
     dhcp_resource = gateway_obj.get_dhcp()
     self.assertFalse(hasattr(dhcp_resource.ipPools, 'ipPool'))
Exemplo n.º 2
0
    def test_0098_teardown(self):
        """Remove the DHCP bindings of gateway.

         Invokes the delete_binding of the DhcpBinding.
        """
        gateway = Environment. \
            get_test_gateway(TestDhcpBinding._client)
        gateway_obj = Gateway(TestDhcpBinding._client,
                              TestDhcpBinding._name,
                              href=gateway.get('href'))
        dhcp_resource = gateway_obj.get_dhcp()
        for static_binding in dhcp_resource.staticBindings.staticBinding:
            dhcp_binding_object = DhcpBinding(
                TestDhcpBinding._client,
                gateway_name=TestDhcpBinding._name,
                binding_id=static_binding.bindingId)
            dhcp_binding_object.delete_binding()
        dhcp_resource = gateway_obj.get_dhcp()
        self.assertFalse(hasattr(dhcp_resource.staticBindings,
                                 'staticBinding'))
Exemplo n.º 3
0
    def test_0026_add_dhcp_pool(self):
        """Add DHCP pool in the gateway.
         Invokes the add_dhcp_pool of the gateway.
        """

        gateway_obj = Gateway(
            TestGateway._client, self._name,
            Environment.get_test_gateway(
                Environment.get_sys_admin_client()).get('href'))
        gateway_obj.add_dhcp_pool(TestGateway._pool_ip_range)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for ipPool in dhcp_resource.ipPools.ipPool:
            if ipPool.ipRange.text == TestGateway._pool_ip_range:
                matchFound = True
                break
        self.assertTrue(matchFound)
Exemplo n.º 4
0
    def test_0100_add_dhcp_pool(self):
        """Add DHCP pool in the gateway.
         Invokes the add_dhcp_pool of the gateway.
        """

        gateway_obj = Gateway(
            TestGateway._client, self._name,
            Environment.get_test_gateway(Environment.get_sys_admin_client())
            .get('href'))
        gateway_obj.add_dhcp_pool(TestGateway._pool_ip_range)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for ipPool in dhcp_resource.ipPools.ipPool:
            if ipPool.ipRange.text == TestGateway._pool_ip_range:
                matchFound = True
                break
        self.assertTrue(matchFound)
Exemplo n.º 5
0
    def test_0027_add_dhcp_binding(self):
        """Add DHCP Binding in the gateway.

         Invokes the add_dhcp_binding of the gateway.
        """
        gateway_obj = Gateway(
            TestGateway._client, self._name,
            Environment.get_test_gateway(
                Environment.get_sys_admin_client()).get('href'))
        gateway_obj.add_dhcp_binding(TestGateway._mac_address,
                                     TestGateway._host_name,
                                     TestGateway._binding_ip_address)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for static_binding in dhcp_resource.staticBindings.staticBinding:
            if static_binding.macAddress.text == TestGateway._mac_address:
                matchFound = True
                break
        self.assertTrue(matchFound)
Exemplo n.º 6
0
    def test_0105_add_dhcp_binding(self):
        """Add DHCP Binding in the gateway.

         Invokes the add_dhcp_binding of the gateway.
        """
        gateway_obj = Gateway(
            TestGateway._client, self._name,
            Environment.get_test_gateway(Environment.get_sys_admin_client())
            .get('href'))
        gateway_obj.add_dhcp_binding(TestGateway._mac_address,
                                     TestGateway._host_name,
                                     TestGateway._binding_ip_address)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for static_binding in dhcp_resource.staticBindings.staticBinding:
            if static_binding.macAddress.text == TestGateway._mac_address:
                matchFound = True
                break
        self.assertTrue(matchFound)
Exemplo n.º 7
0
    def test_0000_setup(self):
        """Add DHCP pool in the gateway.

        Invokes the add_dhcp_pool of the gateway.
        """
        TestDhcp._client = Environment.get_sys_admin_client()
        TestDhcp._config = Environment.get_config()
        gateway = Environment. \
            get_test_gateway(TestDhcp._client)
        gateway_obj = Gateway(TestDhcp._client,
                              TestDhcp._name,
                              href=gateway.get('href'))
        gateway_obj.add_dhcp_pool(TestDhcp._pool_ip_range)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for ipPool in dhcp_resource.ipPools.ipPool:
            if ipPool.ipRange.text == TestDhcp._pool_ip_range:
                matchFound = True
                break
        self.assertTrue(matchFound)
Exemplo n.º 8
0
    def test_0000_setup(self):
        """Add DHCP binding in the gateway.

        Invokes the add_dhcp_binding of the gateway.
        """
        TestDhcpBinding._client = Environment.get_sys_admin_client()
        TestDhcpBinding._config = Environment.get_config()
        gateway = Environment. \
            get_test_gateway(TestDhcpBinding._client)
        gateway_obj = Gateway(TestDhcpBinding._client,
                              TestDhcpBinding._name,
                              href=gateway.get('href'))
        gateway_obj.add_dhcp_binding(TestDhcpBinding._mac_address,
                                     TestDhcpBinding._host_name,
                                     TestDhcpBinding._binding_ip_address)
        dhcp_resource = gateway_obj.get_dhcp()
        # Verify
        matchFound = False
        for static_binding in dhcp_resource.staticBindings.staticBinding:
            if static_binding.hostname.text == TestDhcpBinding._host_name:
                matchFound = True
                break
        self.assertTrue(matchFound)