From Fedora Project Wiki
No edit summary
Line 9: Line 9:
* Mob: +91 8087850104
* Mob: +91 8087850104
* Mentor: William Brown (firstyear)
* Mentor: William Brown (firstyear)


=== Abstract: ===
=== Abstract: ===
Line 17: Line 18:
* lib389 is a python library that uses LDAP to communicate with 389-ds-server. This library exposes its functionality with the help of two command line tools dsconf and dsctl (earlier it was “dsadm”, renamed due to naming conflict with “dsidm” ). In lib389 most of the base classes that communicate with 389-ds-server are already written.
* lib389 is a python library that uses LDAP to communicate with 389-ds-server. This library exposes its functionality with the help of two command line tools dsconf and dsctl (earlier it was “dsadm”, renamed due to naming conflict with “dsidm” ). In lib389 most of the base classes that communicate with 389-ds-server are already written.
* This project aims to add new modules in lib389 to replace the legacy tools (perl scripts, java console application) and extend command line python tool “dsconf” to support its enabling / disabling / configuration.
* This project aims to add new modules in lib389 to replace the legacy tools (perl scripts, java console application) and extend command line python tool “dsconf” to support its enabling / disabling / configuration.


=== Benefits to Community: ===
=== Benefits to Community: ===
Line 34: Line 36:


=== Implementation Details: ===
=== Implementation Details: ===
----
[[File:communication_flow.png]]
==== 1. Adding new modules in lib389: ====
* DSLdapObject is a python class abstract of Relative Distinguished Names (RDN). Each RDN in a DN corresponds to a branch in the directory Information tree (DIT).
* DSLdapObjects is a python class abstract of Distinguished Names (DN). A DN is a unique name that unambiguously identifies a single entry.
* DSLdapObjects and DSLdapObject also implement the core logic to interact with Directory Server via LDAP protocol using python2 ldap client library.
* New modules will inherit from the classes DSLdapObjects and DSLdapObject so that they can interact with Directory Server by calling functions of class DSLdapObjects and DSLdapObject from file lib389/_mapped_object.py (LDAP ORM).
* These new module’s functionality will replace some of the legacy tools (Perl scripts and Shell scripts).
==== 2. Write test for modules in folder lib389/tests/: ====
* lib389 tests uses pytest tests, pytest is a python module to write easy and scalable tests.
* pytest has some features like detailed info on failing native python assert statements, auto-discovery of tests and modular fixtures for parameterized test resources.
* To write pytest tests for new modules in lib389, we can define a module scope fixture “topology”.
* This topology fixture will create the Directory Server instances required for running the tests. Fixture “topology” will be passed as an argument to each test case.
* Since we are using pytest tests we can use native python assert statements to confirm the test output with expected output.
==== 3. Adding a new command line module using previous module in lib389/cli_conf/: ====
* In this module we will have to create a parser for command line arguments.
* This module will make use of generic and reusable functions defined in file lib389/cli_base/__init__.py. These functions are defined with a motive to reuse the code.
* These generic functions will accept one of its arguments as manager class (manager class can be backend class, plugin class or new modules ).
* Manager class is a module selected by user while using “dsconf”. In our case it will be 1 of 2  modules that needs to be added.
* These generic functions call the manager class for module specific functionality.
==== 4. Write tests for command line module:: ====
* Since in lib389 we are using pytest to run our test modules, native python assert statements can be used.
* Command line modules can be tested by intercepting the logs and making assertions of search query of keywords in intercepted logs.
* LogCapture class is for intercepting the logs.
* To test the command line module, we will use the class LogCapture from file lib389/cli_base/__init__.py
* We will make assertions of search query of keywords in logs.


=== Timeline: ===
=== Timeline: ===

Revision as of 12:19, 3 April 2017

Contact Information:


  • Name: Ankit Yadav
  • Time Zone: UTC + 5:30
  • Email: ankitwrk AT gmail DOT com
  • IRC Nick: ankity10, ankity10_
  • Mob: +91 8087850104
  • Mentor: William Brown (firstyear)


Abstract:


  • Administration of 389-ds-server is a complex task. Currently there are some perl scripts that are installed with 389-ds-server instance which administer specific parts of server. But the server cannot be managed from these perl scripts alone. To simplify this complex Directory Server management, new tools are being developed.
  • lib389 is a python library that uses LDAP to communicate with 389-ds-server. This library exposes its functionality with the help of two command line tools dsconf and dsctl (earlier it was “dsadm”, renamed due to naming conflict with “dsidm” ). In lib389 most of the base classes that communicate with 389-ds-server are already written.
  • This project aims to add new modules in lib389 to replace the legacy tools (perl scripts, java console application) and extend command line python tool “dsconf” to support its enabling / disabling / configuration.


Benefits to Community:


  • Successful completion of this project will help administrators to manage 389-ds-server in effortless way and “dsconf” will be the one stop solution for all the configuration related tasks.


Tasks:


  • Add two new modules to extend the command line tool “dsconf” that will inherit the core base classes DSLdapObjects and DSLdapObject which are in file lib389/_mapped_object.py.
  • Write pytest tests for the above modules.
  • Adding new command line module for two newly added modules in lib389/cli_conf/ so that “dsconf” can be used to call module specific functionality.
  • Write pytest tests for above command line modules in folder lib389/tests/cli/.


Implementation Details:



1. Adding new modules in lib389:

  • DSLdapObject is a python class abstract of Relative Distinguished Names (RDN). Each RDN in a DN corresponds to a branch in the directory Information tree (DIT).
  • DSLdapObjects is a python class abstract of Distinguished Names (DN). A DN is a unique name that unambiguously identifies a single entry.
  • DSLdapObjects and DSLdapObject also implement the core logic to interact with Directory Server via LDAP protocol using python2 ldap client library.
  • New modules will inherit from the classes DSLdapObjects and DSLdapObject so that they can interact with Directory Server by calling functions of class DSLdapObjects and DSLdapObject from file lib389/_mapped_object.py (LDAP ORM).
  • These new module’s functionality will replace some of the legacy tools (Perl scripts and Shell scripts).

2. Write test for modules in folder lib389/tests/:

  • lib389 tests uses pytest tests, pytest is a python module to write easy and scalable tests.
  • pytest has some features like detailed info on failing native python assert statements, auto-discovery of tests and modular fixtures for parameterized test resources.
  • To write pytest tests for new modules in lib389, we can define a module scope fixture “topology”.
  • This topology fixture will create the Directory Server instances required for running the tests. Fixture “topology” will be passed as an argument to each test case.
  • Since we are using pytest tests we can use native python assert statements to confirm the test output with expected output.

3. Adding a new command line module using previous module in lib389/cli_conf/:

  • In this module we will have to create a parser for command line arguments.
  • This module will make use of generic and reusable functions defined in file lib389/cli_base/__init__.py. These functions are defined with a motive to reuse the code.
  • These generic functions will accept one of its arguments as manager class (manager class can be backend class, plugin class or new modules ).
  • Manager class is a module selected by user while using “dsconf”. In our case it will be 1 of 2 modules that needs to be added.
  • These generic functions call the manager class for module specific functionality.

4. Write tests for command line module::

  • Since in lib389 we are using pytest to run our test modules, native python assert statements can be used.
  • Command line modules can be tested by intercepting the logs and making assertions of search query of keywords in intercepted logs.
  • LogCapture class is for intercepting the logs.
  • To test the command line module, we will use the class LogCapture from file lib389/cli_base/__init__.py
  • We will make assertions of search query of keywords in logs.


Timeline:


Date Tasks Deliverable
May 4 - May 16 Understand the codebase and ask questions to clarify concepts. -