LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 7th, 2008, 06:53 AM
ldap2255 ldap2255 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 1 ldap2255 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 56 sec
Reputation Power: 0
Question LDAP data migration: how to convert LDIF file?

Hi,

I am about to prepare LDAP data migration and it contains:
- export of 3 LDAP entries to LDIF file;
- conversion of that LDIF file (attr names change and removal) using the schema file;
- import of converted LDIF file to LDAP.

Every phase is done by sh script.

Export is a query of LDAP for a specified objectClass value
(ie.
Code:
# ldapacmx.pl --direcyQuery "(objectClass=Cluster)"
)
and write to a file.
Result of an export is a following LDIF file:

Code:
cn=Customer 
dn=cn=Customer,ou=manager,ou=scconfig,ou=config,ou=region-987654,ou=regions,ou=company,dc=lab,dc=net 
CustomerId=123456 
CustomerName=ABC 
objectClass=top 
objectClass=Customer 

CompanyTargetId=987654 
cn=Cluster 
CurrentSerialAlphabet=K 
dn=cn=Cluster,ou=manager,ou=scconfig,ou=config,ou=region-987654,ou=regions,ou=company,dc=lab,dc=net 
objectClass=top 
objectClass=Cluster 
ClusterStartAlphabet=K 
ClusterEndAlphabet=K 

cn=Directory 
SystemDefOrderFileDir=OrderAttachments 
dn=cn=Directory,ou=manager,ou=scconfig,ou=config,ou=region-987654,ou=regions,ou=company,dc=lab,dc=net 
SystemDefImportDir=FilesToImport 
objectClass=top 
objectClass=Directory


Schema file is as follows:

Code:
dn: cn=schema 

attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.1 
  NAME 'CustomerId' 
  DESC 'The ID of the customer.' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  ) 
# 
#******************************************************************** 
# 
attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.2 
  NAME 'CustomerName' 
  DESC 'The Name of the customer.' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  ) 
# 
#******************************************************************** 
# 
attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.3 
  NAME 'ClusterStartAlphabet' 
  DESC 'The Start Alphabet for the cluster used in generation of ABC 
files.' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  SINGLE-VALUE 
  ) 
# 
#******************************************************************** 
# 
attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.4 
  NAME 'ClusterEndAlphabet' 
  DESC 'The End Alphabet for the cluster used in generation of ABC 
files.' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  SINGLE-VALUE 
  ) 
# 
#******************************************************************** 
# 
attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.5 
  NAME 'CurrentAlphabet' 
  DESC 'The running alphabet for generation of ABC files' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  SINGLE-VALUE 
  ) 
# 
#******************************************************************** 
# 
attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.8 
  NAME 'CompanyTargetId' 
  DESC 'The Target Id of the Company Cluster' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  SINGLE-VALUE 
  ) 
# 
#******************************************************************** 
# 
attributeTypes: ( 
  1.3.6.1.4.1.94.1.55.10.1.6 
  NAME 'ImportDir' 
  DESC 'The default directory for importing ABC files.' 
  EQUALITY caseIgnoreMatch 
  SUBSTR caseIgnoreSubstringsMatch 
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 
  SINGLE-VALUE 
  ) 
# 
# 
objectClasses: ( 
  1.3.6.1.4.1.94.1.55.10.2.1 
  NAME 'Customer' 
  DESC 'The customer specific details.' 
  SUP top 
  MUST ( cn $ CustomerId $ CustomerName ) 
  ) 
# 
#******************************************************************** 
# 
objectClasses: ( 
  1.3.6.1.4.1.94.1.55.10.2.2 
  NAME 'Cluster' 
  DESC 'The cluster specific details.' 
  SUP top 
  MUST ( cn $ ClusterStartAlphabet $ ClusterEndAlphabet $ 
CurrentAlphabet $ CompanyTargetId) 
  ) 
# 
#******************************************************************** 
# 
objectClasses: ( 
  1.3.6.1.4.1.94.1.55.10.2.3 
  NAME 'Directory' 
  DESC 'The default directories used by ABC application.' 
  SUP top 
  MUST ( cn $ ImportDir ) 
  ) 
# 
#******************************************************************** 
# 
# 
# 
# 
# EOF


I would like to convert exported file using schema file above and get following:

Code:
cn=customer 
dn=cn=customer,ou=manager,ou=scconfig,dc=lab,dc=net 
CustomerId=123456 
CustomerName=ABC 
objectClass=top 
objectClass=Customer 

CompanyTargetId=987654 
cn=cluster 
CurrentAlphabet=K 
dn=cn=cluster,ou=manager,ou=scconfig,dc=lab,dc=net 
objectClass=top 
objectClass=Cluster 
ClusterStartAlphabet=K 
ClusterEndAlphabet=K 

cn=directory 
dn=cn=directory,ou=manager,ou=scconfig,dc=lab,dc=net 
ImportDir=FilesToImport 
objectClass=top 
objectClass=Directory


I got some questions about that operation:
- How to do that? and is it safe to use tools like sed or awk in this case?;
- Is it correct that LDAP entry begins with a line different than "dn=..." because I do not know if I can import a file that is exported and converted in the way above and I do not have to change lines order in the entry then.
I have not found a confirmation anywhere but many examples from web always begin with "dn=..."

Big thanks for support.

With regards,
-XYZ

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesLDAP Programming > LDAP data migration: how to convert LDIF file?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway