config_utils.py
changeset 1 6e9f24fd1b98
child 3 6d8728efcdec
equal deleted inserted replaced
0:215982c73cd6 1:6e9f24fd1b98
       
     1 #!/usr/bin/env python
       
     2 # -*- coding: utf-8 -*-
       
     3 
       
     4 #This file is part of CanFestival, a library implementing CanOpen Stack. 
       
     5 #
       
     6 #Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD
       
     7 #
       
     8 #See COPYING file for copyrights details.
       
     9 #
       
    10 #This library is free software; you can redistribute it and/or
       
    11 #modify it under the terms of the GNU Lesser General Public
       
    12 #License as published by the Free Software Foundation; either
       
    13 #version 2.1 of the License, or (at your option) any later version.
       
    14 #
       
    15 #This library is distributed in the hope that it will be useful,
       
    16 #but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    17 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    18 #Lesser General Public License for more details.
       
    19 #
       
    20 #You should have received a copy of the GNU Lesser General Public
       
    21 #License along with this library; if not, write to the Free Software
       
    22 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    23 
       
    24 from types import *
       
    25 
       
    26 DicoTypes = {"BOOL":0x01, "SINT":0x02, "INT":0x03,"DINT":0x04,"LINT":0x10,
       
    27              "USINT":0x05,"UINT":0x06,"UDINT":0x07,"ULINT":0x1B,"REAL":0x08,
       
    28              "LREAL":0x11,"STRING":0x09,"BYTE":0x02,"WORD":0x03,"DWORD":0x04,
       
    29              "LWORD":0x1B,"WSTRING":0x0B}
       
    30 
       
    31 DictLocations = {}
       
    32 DictCobID = {}
       
    33 DictLocationsNotMapped = {}
       
    34 ListCobIDAvailable = []
       
    35 SlavesPdoNumber = {}
       
    36 
       
    37 # Constants for PDO types 
       
    38 RPDO = 1
       
    39 TPDO = 2
       
    40 SlavePDOType = {"I" : TPDO, "Q" : RPDO}
       
    41 InvertPDOType = {RPDO : TPDO, TPDO : RPDO}
       
    42 
       
    43 DefaultTransmitTypeMaster = 0x01
       
    44 
       
    45 GenerateMasterMapping = lambda x:[None] + [(loc_infos["type"], name) for name, loc_infos in x]
       
    46 
       
    47 TrashVariableSizes = {1 : 0x01, 8 : 0x05, 16 : 0x06, 32 : 0x07, 64 : 0x1B}
       
    48 
       
    49 
       
    50 def GetSlavePDOIndexes(slave, type, parameters = False):
       
    51     indexes = []
       
    52     if type & RPDO:
       
    53         indexes.extend([idx for idx in slave.GetIndexes() if 0x1400 <= idx <= 0x15FF])
       
    54     if type & TPDO:
       
    55         indexes.extend([idx for idx in slave.GetIndexes() if 0x1800 <= idx <= 0x19FF])
       
    56     if not parameters:
       
    57         return [idx + 0x200 for idx in indexes]
       
    58     else:
       
    59         return indexes
       
    60 
       
    61 
       
    62 def LE_to_BE(value, size): # Convert Little Endian to Big Endian
       
    63     data = ("%" + str(size * 2) + "." + str(size * 2) + "X") % value
       
    64     list_car = [data[i:i+2] for i in xrange(0, len(data), 2)]
       
    65     list_car.reverse()
       
    66     return "".join([chr(int(car, 16)) for car in list_car])
       
    67 
       
    68 
       
    69 
       
    70 def SearchSlavePDOMapping(loc_infos, slave): # Search the TPDO or RPDO mapping where location is defined on the slave
       
    71     typeinfos = slave.GetEntryInfos(loc_infos["type"])
       
    72     model = (loc_infos["index"] << 16) + (loc_infos["subindex"] << 8) + typeinfos["size"]
       
    73     slavePDOidxlist = GetSlavePDOIndexes(slave, loc_infos["pdotype"])
       
    74     
       
    75     for PDOidx in slavePDOidxlist:
       
    76         values = slave.GetEntry(PDOidx)
       
    77         if values != None:
       
    78             for subindex, mapping in enumerate(values):
       
    79                 if subindex != 0 and mapping == model:
       
    80                     return PDOidx, subindex
       
    81     return None
       
    82 
       
    83 def GenerateMappingDCF(cobid, idx, pdomapping, mapped): # Build concise DCF
       
    84     
       
    85     # Create entry for RPDO or TPDO parameters and Disable PDO
       
    86     dcfdata = LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE((0x80000000 + cobid), 4)
       
    87     # Set Transmit type synchrone
       
    88     dcfdata += LE_to_BE(idx, 2) + LE_to_BE(0x02, 1) + LE_to_BE(0x01, 4) + LE_to_BE(DefaultTransmitTypeSlave, 1)
       
    89     # Re-Enable PDO
       
    90     #         ---- INDEX -----   --- SUBINDEX ----   ----- SIZE ------   ------ DATA ------
       
    91     dcfdata += LE_to_BE(idx, 2) + LE_to_BE(0x01, 1) + LE_to_BE(0x04, 4) + LE_to_BE(0x00000000 + cobid, 4)
       
    92     nbparams = 3
       
    93     if mapped == False and pdomapping != None:
       
    94     # Map Variables
       
    95         for subindex, (name, loc_infos) in enumerate(pdomapping):
       
    96             value = (loc_infos["index"] << 16) + (loc_infos["subindex"] << 8) + loc_infos["size"]
       
    97             dcfdata += LE_to_BE(idx + 0x200, 2) + LE_to_BE(subindex + 1, 1) + LE_to_BE(0x04, 4) + LE_to_BE(value, 4)
       
    98             nbparams += 1
       
    99     return dcfdata, nbparams
       
   100 
       
   101 def GetNewCobID(nodeid, type): # Return a cobid not used
       
   102     global ListCobIDAvailable, SlavesPdoNumber
       
   103     
       
   104     if len(ListCobIDAvailable) == 0:
       
   105         return None
       
   106     
       
   107     nbSlavePDO = SlavesPdoNumber[nodeid][type]
       
   108     if type == RPDO:
       
   109         if nbSlavePDO < 4:
       
   110             # For the fourth PDO -> cobid = 0x200 + ( numPdo parameters * 0x100) + nodeid
       
   111             newcobid = (0x200 + nbSlavePDO * 0x100 + nodeid)
       
   112             if newcobid in ListCobIDAvailable:
       
   113                 ListCobIDAvailable.remove(newcobid)
       
   114                 return newcobid, 0x1400 + nbSlavePDO
       
   115         return ListCobIDAvailable.pop(0), 0x1400 + nbSlavePDO
       
   116 
       
   117     elif type == TPDO:
       
   118         if nbSlavePDO < 4:
       
   119             # For the fourth PDO -> cobid = 0x180 + (numPdo parameters * 0x100) + nodeid
       
   120             newcobid = (0x180 + nbSlavePDO * 0x100 + nodeid)
       
   121             if newcobid in ListCobIDAvailable:
       
   122                 ListCobIDAvailable.remove(newcobid)
       
   123                 return newcobid, 0x1800 + nbSlavePDO
       
   124         return ListCobIDAvailable.pop(0), 0x1800 + nbSlavePDO
       
   125     
       
   126     for number in xrange(4):
       
   127         if type == RPDO:
       
   128             # For the fourth PDO -> cobid = 0x200 + ( numPdo * 0x100) + nodeid
       
   129             newcobid = (0x200 + number * 0x100 + nodeid)
       
   130         elif type == TPDO:
       
   131             # For the fourth PDO -> cobid = 0x180 + (numPdo * 0x100) + nodeid
       
   132             newcobid = (0x180 + number * 0x100 + nodeid)
       
   133         else:
       
   134             return None
       
   135         if newcobid in ListCobIDAvailable:
       
   136             ListCobIDAvailable.remove(newcobid)
       
   137             return newcobid
       
   138     return ListCobIDAvailable.pop(0)
       
   139         
       
   140         
       
   141 def GenerateConciseDCF(locations, busname, nodelist):
       
   142     global DictLocations, DictCobID, DictLocationsNotMapped, ListCobIDAvailable, SlavesPdoNumber, DefaultTransmitTypeSlave
       
   143 
       
   144     DictLocations = {}
       
   145     DictCobID = {}
       
   146     DictLocationsNotMapped = {}
       
   147     DictSDOparams = {}
       
   148     ListCobIDAvailable = range(0x180, 0x580)
       
   149     SlavesPdoNumber = {}
       
   150     DictNameVariable = { "" : 1, "X": 2, "B": 3, "W": 4, "D": 5, "L": 6, "increment": 0x100, 1:("__I", 0x2000), 2:("__Q", 0x4000)}
       
   151     DefaultTransmitTypeSlave = 0xFF
       
   152     # Master Node initialisation
       
   153     
       
   154     manager = nodelist.Manager
       
   155     masternode = manager.GetCurrentNodeCopy()
       
   156     if not masternode.IsEntry(0x1F22):
       
   157         masternode.AddEntry(0x1F22, 1, "")
       
   158     manager.AddSubentriesToCurrent(0x1F22, 127, masternode)
       
   159     # Adding trash mappable variables for unused mapped datas
       
   160     idxTrashVariables = 0x2000 + masternode.GetNodeID()
       
   161     TrashVariableValue = {}
       
   162     manager.AddMapVariableToCurrent(idxTrashVariables, "trashvariables", 3, len(TrashVariableSizes), masternode)
       
   163     for subidx, (size, typeidx) in enumerate(TrashVariableSizes.items()):
       
   164         manager.SetCurrentEntry(idxTrashVariables, subidx + 1, "TRASH%d" % size, "name", None, masternode)
       
   165         manager.SetCurrentEntry(idxTrashVariables, subidx + 1, typeidx, "type", None, masternode)
       
   166         TrashVariableValue[size] = (idxTrashVariables << 16) + ((subidx + 1) << 8) + size
       
   167     
       
   168     
       
   169     # Extract Master Node current empty mapping index
       
   170     CurrentPDOParamsIdx = {RPDO : 0x1400 + len(GetSlavePDOIndexes(masternode, RPDO)),
       
   171                            TPDO : 0x1800 + len(GetSlavePDOIndexes(masternode, TPDO))}
       
   172 
       
   173     # Get list of all Slave's CobID and Slave's default SDO server parameters
       
   174     for nodeid, nodeinfos in nodelist.SlaveNodes.items():
       
   175         node = nodeinfos["Node"]
       
   176         node.SetNodeID(nodeid)
       
   177         DictSDOparams[nodeid] = {"RSDO" : node.GetEntry(0x1200,0x01), "TSDO" : node.GetEntry(0x1200,0x02)}
       
   178         slaveRpdoIndexes = GetSlavePDOIndexes(node, RPDO, True)
       
   179         slaveTpdoIndexes = GetSlavePDOIndexes(node, TPDO, True)
       
   180         SlavesPdoNumber[nodeid] = {RPDO : len(slaveRpdoIndexes), TPDO : len(slaveTpdoIndexes)}
       
   181         for PdoIdx in slaveRpdoIndexes + slaveTpdoIndexes:
       
   182             pdo_cobid = node.GetEntry(PdoIdx, 0x01)
       
   183             if pdo_cobid > 0x600 :
       
   184                 pdo_cobid -= 0x80000000
       
   185             if pdo_cobid in ListCobIDAvailable:
       
   186                 ListCobIDAvailable.remove(pdo_cobid)
       
   187     
       
   188     # Get list of locations check if exists and mappables -> put them in DictLocations
       
   189     for locationtype, name in locations:    
       
   190         if name in DictLocations.keys():
       
   191             if DictLocations[name]["type"] != DicoTypes[locationtype]:
       
   192                 raise ValueError, "Conflict type for location \"%s\"" % name 
       
   193         else:
       
   194             loc = [i for i in name.split("_") if len(i) > 0]
       
   195             if len(loc) not in (4, 5):
       
   196                 continue
       
   197             
       
   198             prefix = loc[0][0]
       
   199             
       
   200             # Extract and check busname
       
   201             if loc[0][1].isdigit():
       
   202                 sizelocation = ""
       
   203                 busnamelocation = int(loc[0][1:])
       
   204             else:
       
   205                 sizelocation = loc[0][1]
       
   206                 busnamelocation = int(loc[0][2:])
       
   207             if busnamelocation != busname:
       
   208                 continue # A ne pas remplacer par un message d'erreur
       
   209             
       
   210             # Extract and check nodeid
       
   211             nodeid = int(loc[1])
       
   212             if nodeid not in nodelist.SlaveNodes.keys():
       
   213                 continue
       
   214             node = nodelist.SlaveNodes[nodeid]["Node"]
       
   215             
       
   216             # Extract and check index and subindex
       
   217             index = int(loc[2])
       
   218             subindex = int(loc[3])
       
   219             if not node.IsEntry(index, subindex):
       
   220                 continue
       
   221             subentry_infos = node.GetSubentryInfos(index, subindex)
       
   222             
       
   223             if subentry_infos and subentry_infos["pdo"]:
       
   224                 if sizelocation == "X" and len(loc) > 4:
       
   225                     numbit = loc[4]
       
   226                 elif sizelocation != "X" and len(loc) > 4:
       
   227                     continue
       
   228                 else:
       
   229                     numbit = None
       
   230                 
       
   231                 locationtype = DicoTypes[locationtype]
       
   232                 entryinfos = node.GetSubentryInfos(index, subindex)
       
   233                 if entryinfos["type"] != locationtype:
       
   234                     raise ValueError, "Invalid type for location \"%s\"" % name
       
   235                 
       
   236                 typeinfos = node.GetEntryInfos(locationtype)
       
   237                 DictLocations[name] = {"type":locationtype, "pdotype":SlavePDOType[prefix],
       
   238                                        "nodeid": nodeid, "index": index,"subindex": subindex, 
       
   239                                        "bit": numbit, "size": typeinfos["size"], "busname": busname, "sizelocation": sizelocation}
       
   240                   
       
   241     # Create DictCobID with variables already mapped and add them in DictValidLocations
       
   242     for name, locationinfos in DictLocations.items():
       
   243         node = nodelist.SlaveNodes[locationinfos["nodeid"]]["Node"]
       
   244         result = SearchSlavePDOMapping(locationinfos, node)
       
   245         if result != None:
       
   246             index, subindex = result
       
   247             cobid = nodelist.GetSlaveNodeEntry(locationinfos["nodeid"], index - 0x200, 1)
       
   248             if cobid not in DictCobID.keys():
       
   249                 mapping = [None]
       
   250                 values = node.GetEntry(index)
       
   251                 for value in values[1:]:
       
   252                     mapping.append(value % 0x100)
       
   253                 DictCobID[cobid] = {"type" : InvertPDOType[locationinfos["pdotype"]], "mapping" : mapping}
       
   254         
       
   255             DictCobID[cobid]["mapping"][subindex] = (locationinfos["type"], name)
       
   256             
       
   257         else:
       
   258             if locationinfos["nodeid"] not in DictLocationsNotMapped.keys():
       
   259                 DictLocationsNotMapped[locationinfos["nodeid"]] = {TPDO : [], RPDO : []}
       
   260             DictLocationsNotMapped[locationinfos["nodeid"]][locationinfos["pdotype"]].append((name, locationinfos))
       
   261 
       
   262     # Check Master Pdo parameters for cobid already used and remove it in ListCobIDAvailable
       
   263     ListPdoParams = [idx for idx in masternode.GetIndexes() if 0x1400 <= idx <= 0x15FF or  0x1800 <= idx <= 0x19FF]
       
   264     for idx in ListPdoParams:
       
   265         cobid = masternode.GetEntry(idx, 0x01)
       
   266         if cobid not in DictCobID.keys():
       
   267             ListCobIDAvailable.pop(cobid)
       
   268     
       
   269     #-------------------------------------------------------------------------------
       
   270     #                         Build concise DCF for the others locations
       
   271     #-------------------------------------------------------------------------------
       
   272     
       
   273     for nodeid, locations in DictLocationsNotMapped.items():
       
   274         # Get current concise DCF
       
   275         node = nodelist.SlaveNodes[nodeid]["Node"]
       
   276         nodeDCF = masternode.GetEntry(0x1F22, nodeid)
       
   277         
       
   278         if nodeDCF != None and nodeDCF != '':
       
   279             tmpnbparams = [i for i in nodeDCF[:4]]
       
   280             tmpnbparams.reverse()
       
   281             nbparams = int(''.join(["%2.2x"%ord(i) for i in tmpnbparams]), 16)
       
   282             dataparams = nodeDCF[4:]
       
   283         else:
       
   284             nbparams = 0
       
   285             dataparams = ""
       
   286         
       
   287         for pdotype in (TPDO, RPDO):
       
   288             pdosize = 0
       
   289             pdomapping = []
       
   290             for name, loc_infos in locations[pdotype]:
       
   291                 pdosize += loc_infos["size"]
       
   292                 # If pdo's size > 64 bits
       
   293                 if pdosize > 64:
       
   294                     result = GetNewCobID(nodeid, pdotype)
       
   295                     if result:
       
   296                         SlavesPdoNumber[nodeid][pdotype] += 1
       
   297                         new_cobid, new_idx = result
       
   298                         data, nbaddedparams = GenerateMappingDCF(new_cobid, new_idx, pdomapping, False)
       
   299                         dataparams += data
       
   300                         nbparams += nbaddedparams
       
   301                         DictCobID[new_cobid] = {"type" : InvertPDOType[pdotype], "mapping" : GenerateMasterMapping(pdomapping)}
       
   302                     pdosize = loc_infos["size"]
       
   303                     pdomapping = [(name, loc_infos)]
       
   304                 else:
       
   305                     pdomapping.append((name, loc_infos))
       
   306             if len(pdomapping) > 0:
       
   307                 result = GetNewCobID(nodeid, pdotype)
       
   308                 if result:
       
   309                     SlavesPdoNumber[nodeid][pdotype] += 1
       
   310                     new_cobid, new_idx = result
       
   311                     data, nbaddedparams = GenerateMappingDCF(new_cobid, new_idx, pdomapping, False)
       
   312                     dataparams += data
       
   313                     nbparams += nbaddedparams
       
   314                     DictCobID[new_cobid] = {"type" : InvertPDOType[pdotype], "mapping" : GenerateMasterMapping(pdomapping)}
       
   315         
       
   316         dcf = LE_to_BE(nbparams, 0x04) + dataparams
       
   317         masternode.SetEntry(0x1F22, nodeid, dcf)
       
   318 
       
   319         
       
   320     #-------------------------------------------------------------------------------
       
   321     #                         Master Node Configuration
       
   322     #-------------------------------------------------------------------------------
       
   323     
       
   324     # Configure Master's SDO parameters entries
       
   325     for nodeid, SDOparams in DictSDOparams.items():
       
   326         SdoClient_index = [0x1280 + nodeid]
       
   327         manager.ManageEntriesOfCurrent(SdoClient_index,[], masternode)
       
   328         if SDOparams["RSDO"] != None:
       
   329             RSDO_cobid = SDOparams["RSDO"]
       
   330         else:
       
   331             RSDO_cobid = 0x600 + nodeid 
       
   332             
       
   333         if SDOparams["TSDO"] != None:
       
   334             TSDO_cobid = SDOparams["TSDO"]
       
   335         else:
       
   336             TSDO_cobid = 0x580 + nodeid
       
   337             
       
   338         masternode.SetEntry(SdoClient_index[0], 0x01, RSDO_cobid)
       
   339         masternode.SetEntry(SdoClient_index[0], 0x02, TSDO_cobid)
       
   340         masternode.SetEntry(SdoClient_index[0], 0x03, nodeid)
       
   341     
       
   342     # Configure Master's PDO parameters entries and set cobid, transmit type
       
   343     for cobid, pdo_infos in DictCobID.items():
       
   344         current_idx = CurrentPDOParamsIdx[pdo_infos["type"]]
       
   345         addinglist = [current_idx, current_idx + 0x200]
       
   346         manager.ManageEntriesOfCurrent(addinglist, [], masternode)
       
   347         masternode.SetEntry(current_idx, 0x01, cobid)
       
   348         masternode.SetEntry(current_idx, 0x02, DefaultTransmitTypeMaster)
       
   349         if len(pdo_infos["mapping"]) > 2:
       
   350             manager.AddSubentriesToCurrent(current_idx + 0x200, len(pdo_infos["mapping"]) - 2, masternode)
       
   351         
       
   352         # Create Master's PDO mapping
       
   353         for subindex, variable in enumerate(pdo_infos["mapping"]):
       
   354             if subindex == 0:
       
   355                 continue
       
   356             new_index = False
       
   357             
       
   358             if type(variable) != IntType:
       
   359                 
       
   360                 typeidx, varname = variable
       
   361                 indexname = DictNameVariable[DictLocations[variable[1]]["pdotype"]][0] + DictLocations[variable[1]]["sizelocation"] + str(DictLocations[variable[1]]["busname"]) + "_" + str(DictLocations[variable[1]]["nodeid"])
       
   362                 mapvariableidx = DictNameVariable[DictLocations[variable[1]]["pdotype"]][1] +  DictNameVariable[DictLocations[variable[1]]["sizelocation"]] * DictNameVariable["increment"]
       
   363                 
       
   364                 if not masternode.IsEntry(mapvariableidx):
       
   365                     manager.AddMapVariableToCurrent(mapvariableidx, indexname, 3, 1, masternode)
       
   366                     new_index = True
       
   367                     nbsubentries = masternode.GetEntry(mapvariableidx, 0x00)
       
   368                 else:
       
   369                     nbsubentries = masternode.GetEntry(mapvariableidx, 0x00)
       
   370                     mapvariableidxbase = mapvariableidx 
       
   371                     while mapvariableidx < (mapvariableidxbase + 0x1FF) and nbsubentries == 0xFF:
       
   372                         mapvariableidx += 0x800
       
   373                         if not manager.IsCurrentEntry(mapvariableidx):
       
   374                             manager.AddMapVariableToCurrent(mapvariableidx, indexname, 3, 1, masternode)
       
   375                             new_index = True
       
   376                         nbsubentries = masternode.GetEntry(mapvariableidx, 0x00)
       
   377                 
       
   378                 if mapvariableidx < 0x6000:
       
   379                     if DictLocations[variable[1]]["bit"] != None:
       
   380                         subindexname = "_" + str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"]) + "_" + str(DictLocations[variable[1]]["bit"])
       
   381                     else:
       
   382                         subindexname = "_" + str(DictLocations[variable[1]]["index"]) + "_" + str(DictLocations[variable[1]]["subindex"])
       
   383                     if not new_index:
       
   384                         manager.AddSubentriesToCurrent(mapvariableidx, 1, masternode)
       
   385                         nbsubentries += 1
       
   386                     masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"name" : subindexname})
       
   387                     masternode.SetMappingEntry(mapvariableidx, nbsubentries, values = {"type" : typeidx})
       
   388                     
       
   389                     # Map Variable
       
   390                     typeinfos = manager.GetEntryInfos(typeidx)
       
   391                     if typeinfos != None:
       
   392                         value = (mapvariableidx << 16) + ((nbsubentries) << 8) + typeinfos["size"]
       
   393                         masternode.SetEntry(current_idx + 0x200, subindex, value)
       
   394             else:
       
   395                 masternode.SetEntry(current_idx + 0x200, subindex, TrashVariableValue[variable])
       
   396         
       
   397         CurrentPDOParamsIdx[pdo_infos["type"]] += 1
       
   398     #masternode.Print()
       
   399     return masternode
       
   400 
       
   401 if __name__ == "__main__":
       
   402     from nodemanager import *
       
   403     from nodelist import *
       
   404     import sys
       
   405     
       
   406     manager = NodeManager(sys.path[0])
       
   407     nodelist = NodeList(manager)
       
   408     result = nodelist.LoadProject("/home/deobox/Desktop/TestMapping")
       
   409    
       
   410 ##    if result != None:
       
   411 ##        print result
       
   412 ##    else:
       
   413 ##        print "MasterNode :"
       
   414 ##        manager.CurrentNode.Print()
       
   415 ##        for nodeid, node in nodelist.SlaveNodes.items():
       
   416 ##            print "SlaveNode name=%s id=0x%2.2X :"%(node["Name"], nodeid)
       
   417 ##            node["Node"].Print()
       
   418             
       
   419     #filepath = "/home/deobox/beremiz/test_nodelist/listlocations.txt"
       
   420     filepath = "/home/deobox/Desktop/TestMapping/listlocations.txt"
       
   421     
       
   422     file = open(filepath,'r')
       
   423     locations = [location.split(' ') for location in [line.strip() for line in file.readlines() if len(line) > 0]] 
       
   424     file.close()
       
   425     GenerateConciseDCF(locations, 32, nodelist)
       
   426     print "MasterNode :"
       
   427     manager.CurrentNode.Print()
       
   428     #masternode.Print()