#!/usr/bin/python import string, sys, operator, getopt # change the version whenever the conf file format or content changes; change ss7box, # sangoma_isup, and sangoma_sccp initializers also # [mike01@ana60 ss7box]$ grep CFG_FILE_FORMAT_REV ../common/*.h # ../common/conf.h:#define CFG_FILE_FORMAT_REV "0.5" this_smgcfg_version = "0.7" # change the subrev for changes that do not affect the format or content of the # conf files subrev = ".0" rev = this_smgcfg_version + subrev # smgcfg.py - converts a .csv file containing SMG configuration information # into the .conf files required by the SMG system # # rev history # ------------------------------------------------------------------------------- # 0.0.1 - initial release # 0.0.2 - 2008-12-11 Th; implement requirement that first SMG interface # activated is a TDM_VOICE_API; # this means that if ss7boxd is running then the first wanpipe started by # ss7boxd must first activate a TDM_VOICE_API interface; this interface must # be either real or an unused dummy; if ss7boxd is not running then the first # SMG wanpipe will activate a TDM_VOICE_API interface by default so nothing # is needed in this program in this case; implementing this requirement means # that ss7box config information is needed before making the wanpipe conf files, # there will be a change in the order of tasks in this program: first collect # info then build conf files # 0.0.3 - 2009-01-21; changed ss7boost.conf default hearbeat rate to 5.00 sec; # wXgY interface names for xmtp2 links must have Y==active channel; this means # the voice wXgY name will have a Y value that is not an SS7 link channel # 0.0.4 - 2009-01-21; extended wXgY concept to ss7boost.conf TRUNK section # 0.1.4 - 2009-04-07 Tu; major re-work; reformatted the configuration spreadsheet to eliminate # redundant entry of information, and to prepare to explict span/chan to # CIC/trunk-group assignment; allow for more than 1 ss7 link per span # 0.1.5 - 2009-05-10 Su; added TDMV_DCHAN and TDMV_HW_DTMF to wanpipe configurations # 0.2.0 - 2009-05-27 We; changed inbound routing sections in ss7box.conf to support # isup and sccp in separate sections # 0.3.0 - 2009-06-18 Th; change ss7boost.conf to sangoma_isupd.conf; create the # tgX_isup_timer.conf files # 0.3.1 - 2009-07-01 We; change SS7BOX section of sangoma_isup.conf to allow two # ss7box connections # 0.4.0 - 2009-08-26 We; add conf file revision field to ss7box.conf and sangoma_isup.conf # 0.4.1 - 2009-09-24 We; add numeric_sort to support lists of t/g and trunks with more than # 10 entries # 0.4.2 - 2009-09-25 Th; changed numeric_sort to lamba; changed tg-trk list building # to support t/g and trunk list with >10 entries # 0.4.3 - 2009-10-27 We: added support for creating wanrouter.rc file # 0.5.0 - 2009-11-07 Sa: added support for PCR/Basic MTP2 error correction option # 0.6.0 - 2009-11-13 Fr: added routing protocol field to outbound routes table in ss7box section # TODO list # 1. HW echo control option # 2. individual span/chan assignment of CIC and t-g # 3. open and read existing /etc/wanpipe/wanrouter.rc and add those wanpipes to # wannrouter.rc created here # 4. change ss7boost references to isupd # 5. change inb isup and inb sccp to m3ua_isup and m3ua_sccp because those tables # are now used for inb and outb m3ua routing def sp_voice_if_name (wp_num, voicechans): #************************************************************************ voicechanseg = voicechans.split('.') voicechanrange = voicechanseg[0].split('-') wXgY_voice = "w" + wp_num + "g" + voicechanrange[0] return wXgY_voice def map_voice_channels ( vcmap_expression, base_cic, trunk_group, vcmap): #************************************************************************ print "MAP_VOICE_CHANNELS" print vcmap_expression print base_cic print vcmap non_vc_cic_assignment = "nvc_cic_not_assign" last_slot = '0' cic = int(base_cic) vcseg = vcmap_expression.split('.') for vcs_entry in vcseg: vcrange = vcs_entry.split('-') print "vcrange" print vcrange if non_vc_cic_assignment == "nvc_cic_assign": if last_slot != '0': cic += (int(vcrange[0]) - int(last_slot) - 1) if len(vcrange) == 1: print "single index" if vcrange[0] < last_slot: print "improper slot order: %s" % vcmap_expression sys.exit(3) last_slot = vcrange[0] i = int(vcrange[0]) - 1 vcmap[i] = (str(cic), trunk_group, 'y', vcmap[i][3]) #vcmap[int(vcrange[0]) - 1] = ("cic-here", trunk_group, 'v') cic += 1 elif len(vcrange) == 2: if (vcrange[0] < last_slot) or (vcrange[0] >= vcrange[1]): print "improper slot order: %s" % vcmap_expression sys.exit(3) last_slot = vcrange[1] i = int(vcrange[0]) - 1 lim = int(vcrange[1]) - 1 while i <= lim: vcmap[i] = (str(cic), trunk_group, 'y', vcmap[i][3]) #vcmap[i] = ("cic-here", trunk_group, 'v') i = i+1 cic += 1 else: print "improper voice channel map expression: %s" % vcmap_expression sys.exit(3) return vcmap def make_ss7_wanpipe_conf_file ( first_smg_wp_ind, port_entry, lslink, wp_vc_map): #************************************************************************ wXgY_voice = [] ss7_if = [] print "this is the first wanpipe being started: %d" % first_smg_wp_ind print "wanpipe voice channel map: %s" % wp_vc_map wp = "wanpipe" + port_entry[1] #wX = "w" + port_entry[1] # make a list of ss7 link interfaces using the lslink list for lslink_entry in lslink: if lslink_entry[4] == port_entry[1]: wXgY_ss7link = "w" + port_entry[1] + "g" + lslink_entry[5] #print "creating ss7 interface: %s" % wXgY_ss7link ss7_if.append([wXgY_ss7link, lslink_entry[5]]) # select a candidate channel for a dummy voice channel # that might be needed later in this routine dummy_vc=1 if port_entry[8] == "E1": dummy_vc_limit=31 elif port_entry[8] == "T1": dummy_vc_limit=24 else: print "port table FE_MEDIA value not allowed" sys.exit(3) while dummy_vc <= dummy_vc_limit: for ss7_if_entry in ss7_if: if str(dummy_vc) == ss7_if_entry[1]: dummy_vc+=1 continue break; if dummy_vc > dummy_vc_limit: print "%s cannot be the first wanpipe started" % wp sys.exit(3) print len(ss7_if) fn = wp + ".conf" print "creating %s" % fn fout = open (fn, 'w') fout.write ("# Created by smgcfg.py, Revision %s\n\n" % rev) fout.write ("[devices]\n") fout.write ("%s = WAN_AFT_TE1, Comment\n" % wp) fout.write ("\n[interfaces]\n") # put TDM_VOICE_API interfaces first if (wp_vc_map == "no_voice_channels"): print "\tVOICE:\tNO" if first_smg_wp_ind: # make a dummy voice channel interface name wXgY_voice = sp_voice_if_name (port_entry[1], str(dummy_vc)) vc_map = dummy_vc fout.write ("%s = %s, , TDM_VOICE_API, Comment\n" % (wXgY_voice, wp)) else: print "\tVOICE:\tYES" # make the voice channel interface name wXgY_voice = sp_voice_if_name (port_entry[1], wp_vc_map) vc_map = wp_vc_map fout.write ("%s = %s, , TDM_VOICE_API, Comment\n" % (wXgY_voice, wp)) if len(ss7_if): print "\tSS7:\tYES" for ss7_if_entry in ss7_if: print ss7_if_entry fout.write ("%s = %s, , XMTP2_API, Comment\n" % (ss7_if_entry[0], wp)) else: print "\tSS7:\tNO" fout.write ("\n[%s]\n" % wp) fout.write ("CARD_TYPE = AFT\n") fout.write ("S514CPU = A\n") fout.write ("CommPort = PRI\n") fout.write ("AUTO_PCISLOT = NO\n") fout.write ("PCISLOT = %s\n" % port_entry[2]) fout.write ("PCIBUS = %s\n" % port_entry[3]) fout.write ("FE_MEDIA = %s\n" % port_entry[8]) fout.write ("FE_LCODE = %s\n" % port_entry[9]) fout.write ("FE_FRAME = %s\n" % port_entry[10]) fout.write ("FE_LINE = %s\n" % port_entry[4]) fout.write ("TE_CLOCK = %s\n" % port_entry[11].strip()) fout.write ("TE_REF_CLOCK = 0\n") fout.write ("TE_HIGHIMPEDANCE = NO\n") if port_entry[8] == "T1": fout.write ("LBO = 0DB\n") else: fout.write ("LBO = 120OH\n") fout.write ("FE_TXTRISTATE = NO\n") fout.write ("MTU = 1500\n") fout.write ("UDPPORT = 9000\n") fout.write ("TTL = 255\n") fout.write ("IGNORE_FRONT_END = NO\n") if (wp_vc_map == "no_voice_channels"): if first_smg_wp_ind: # write a dummy TDMV_SPAN value for the dummy voice channels fout.write ("TDMV_SPAN = 100\n") else: fout.write ("TDMV_SPAN = %s\n" % port_entry[5]) fout.write ("TDMV_DCHAN = 0\n") fout.write ("TDMV_HW_DTMF = 0\n") if ((wp_vc_map == "no_voice_channels") and (first_smg_wp_ind)) or (wp_vc_map != "no_voice_channels"): fout.write ("\n[%s]\n" % wXgY_voice) fout.write ("ACTIVE_CH = %s\n" % vc_map) fout.write ("TDMV_ECHO_OFF = NO\n") fout.write ("TDMV_HWEC = YES\n") fout.write ("MTU = 80\n") # create the ss7 link stanzas for ss7_if_entry in ss7_if: fout.write ("\n[%s]\n" % ss7_if_entry[0]) fout.write ("ACTIVE_CH = %s\n" % ss7_if_entry[1]) fout.write ("MTU = 80\n") fout.write ("MRU = 80\n") fout.write ("TDMV_ECHO_OFF = NO\n") fout.write ("TDMV_HWEC = NO\n") fout.write ("\n[%sxmtp2]\n" % ss7_if_entry[0]) fout.write ("\n[%s.xmtp2]\n" % ss7_if_entry[0]) fout.close () def write_ss7box_conf ( protocol, spc, ac, lslink, ls, path, outb_route, inb_routes_isup, inb_routes_sccp): #************************************************************************ print "\n------------------------------\n" print "write ss7box.conf: spc %s ac %s" % (spc, ac) fout = open ("ss7box.conf", 'w') fout.write ("# ss7box.conf\n") fout.write ("# Created by smgcfg.py, Revision %s\n\n" % rev) fout.write ("[GLOBAL]\n") fout.write ("# cfg-rev/SS7ProtSpec/SelfPointCode/NodeName/AuthorizationCode/VerboseGroupInd\n") fout.write (" %s %s %s %s %s %s\n" % (this_smgcfg_version, protocol, spc, "nodeName", ac, "1")) fout.write ("\n[CLI]\n") fout.write ("# local address/port\n") fout.write (" 127.0.0.104 55063\n" % ()) fout.write ("# remote address/port\n") fout.write (" 127.0.0.105 55063\n") fout.write ("\n[CROSSLINK]\n") fout.write ("# mode/local-address/local-port/remote-address/remote-port\n") fout.write (" SIMPLEX na na na na\n") fout.write ("\n[FACILITIES]\n") fout.write ("# index/wanpipeX/frames-per-packet/clear-channel\n") # write the facility entries; only need one entry per wanpipe fac_dict={} fac_index = 0 for lslink_entry in lslink: if not fac_dict.has_key(lslink_entry[4]): fac_dict[lslink_entry[4]]=fac_index print "\t\twanpipe %s slot %s has an ss7 link" % (lslink_entry[4], lslink_entry[5]) fout.write (" %s %s 80 %s\n" % (fac_index, lslink_entry[4], lslink_entry[6])) fac_index += 1 fout.write ("end\n") #print ss7_wanpipe link_index = 0 fout.write ("\n[MTP2LINKS]\n") fout.write ("# index/fac-index/slot/lset/link/error/T1/T2/T3/T4e/T4n/T5/T6/T7\n") for lslink_entry in lslink: if lslink_entry[7] == 'y': # basic error correction method lslink_entry[7] = 0 elif lslink_entry[7] == 'n': # PCR error correction method lslink_entry[7] = 1 else: print "FATAL: invalid value for error correction on mtp2 : bad value is %s" % lslink_entry[7] sys.exit(3) fout.write ( " %s %s %s %s %s %s 13.00 11.50 11.50 0.60 2.30 0.12 3.00 1.00\n" % ( lslink_entry[1], fac_dict[lslink_entry[4]], str(int(lslink_entry[5])-1), lslink_entry[2], lslink_entry[3], lslink_entry[7])) fout.write ("end\n") fout.write ("\n[MTP3TIMERS]\n") fout.write ("# timer-id/value\n") fout.write (" 1\t0.80\n") fout.write (" 2\t1.40\n") fout.write (" 3\t0.80\n") fout.write (" 4\t0.80\n") fout.write (" 5\t0.80\n") fout.write (" 6\t0.80\n") fout.write (" 7\t1.50\n") fout.write (" 8\t1.20\n") fout.write (" 9\t0.00\n") fout.write (" 10\t30.00\n") fout.write (" 11\t30.00\n") fout.write (" 12\t1.50\n") fout.write (" 13\t1.50\n") fout.write (" 14\t3.00\n") fout.write (" 15\t3.00\n") fout.write (" 16\t2.00\n") fout.write (" 17\t1.50\n") fout.write (" 18\t20.00\n") fout.write (" 19\t600.00\n") fout.write (" 20\t120.00\n") fout.write (" 21\t120.00\n") fout.write (" 22\t15.00\n") fout.write (" 23\t15.00\n") fout.write (" 24\t15.00\n") fout.write (" 25\t35.00\n") fout.write (" 26\t15.00\n") fout.write (" 27\t5.00\n") fout.write (" 28\t35.00\n") fout.write (" 29\t65.00\n") fout.write (" 30\t35.00\n") fout.write (" 31\t120.00\n") fout.write (" 32\t120.00\n") fout.write (" 33\t600.00\n") fout.write (" 34\t120.00\n") fout.write ("# Periodic Facility Check Timer\n") fout.write (" 35\t20.00\n") fout.write ("# Periodic Signaling Link Test Message Timer\n") fout.write (" 36\t20.00\n") fout.write ("# Crosslink Test Acknowledge Timer (must be less the timer 35 Periodic Facility Check Timer\n") fout.write ("# that controls the Crosslink Test Message)\n") fout.write (" 37\t5.00\n") fout.write ("\n[MTP3LINKSETS]\n") if protocol == "ANSI": fout.write ("# ls-id/APC-net/APC-clu/APC-mem/slt/prio/ni/SLC-link-index-list\n") else: fout.write ("# ls-id/APC/slt/prio/ni/SLC-link-index-list\n") for ls_entry in ls: fout.write ( " %s %s %s %s %s" % ( ls_entry[1], ls_entry[2], ls_entry[3], ls_entry[4], ls_entry[5].strip())) slc_list = ['na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na', 'na'] for lslink_entry in lslink: if lslink_entry[2] == ls_entry[1]: slc_list[int(lslink_entry[3])] = lslink_entry[1] for slc in slc_list: fout.write (" %s" % slc) fout.write ("\n") fout.write ("end\n") fout.write ("\n[PATHS]\n") fout.write ("# Index/Linkset-A/Linkset-B (optional)\n") for path_entry in path: print "path_entry length: %d" % len(path_entry) print "path_entry" print path_entry if len(path_entry) < 3: print "FATAL: path entry ill-formed" sys.exit(3) elif len(path_entry) == 3: path_entry[2] = path_entry[2].strip() path_entry.append ("na") else: if path_entry[3] == "": path_entry[3] = "na" fout.write ( " %s %s %s\n" % (path_entry[1], path_entry[2], path_entry[3])) fout.write ("end\n") fout.write ("\n[OUTB_ROUTES]\n") fout.write ("# Index/DPC/Protocol/P-Path/A-Path/Crosslink\n") for outb_route_entry in outb_route: if outb_route_entry[4] == "": outb_route_entry[4] = "na" if (outb_route_entry[3] != "MTP3") and (outb_route_entry[3] != "M3UA"): print "FATAL: outb route entry ill-formed protocol value" print outb_route_entry sys.exit(3) outb_route_entry[6] = outb_route_entry[6].strip() fout.write ( " %s %s %s %s %s %s\n" % ( outb_route_entry[1], outb_route_entry[2], outb_route_entry[3], outb_route_entry[4], outb_route_entry[5], outb_route_entry[6].upper())) fout.write ("end\n") fout.write ("\n[INB_ROUTES_ISUP]\n") fout.write ("# Index/DPC/OPC/CIC-start/CIC-end/lcl-addr/lcl-port/rmt-addr/rmt-port\n") for inb_route_entry in inb_routes_isup: fout.write ( " %2s %4s %4s %5s %5s %15s %5s %15s %5s\n" % ( inb_route_entry[1], inb_route_entry[2], inb_route_entry[3], inb_route_entry[4], inb_route_entry[5], inb_route_entry[6], inb_route_entry[7], inb_route_entry[8], inb_route_entry[9] )) fout.write ("end\n") fout.write ("\n[INB_ROUTES_SCCP]\n") fout.write ("# Index/DPC/OPC/lcl-addr/lcl-port/rmt-addr/rmt-port\n") for inb_routes_sccp_entry in inb_routes_sccp: fout.write ( " %2s %4s %4s %15s %5s %15s %5s\n" % ( inb_routes_sccp_entry[1], inb_routes_sccp_entry[2], inb_routes_sccp_entry[3], inb_routes_sccp_entry[6], inb_routes_sccp_entry[7], inb_routes_sccp_entry[8], inb_routes_sccp_entry[9] )) fout.write ("end\n") fout.close () return def write_sangoma_isup_conf ( protocol, spc, sysid, ss7box_ap, port, trunk_group, cic_trk_grp, vc_dict): #************************************************************************ trunk = [] print "\n------------------------------\n" print "write sangoma_isup.conf" fout = open ("sangoma_isup.conf", 'w') fout.write ("# sangoma_isup.conf\n") fout.write ("# Created by smgcfg.py, Revision %s\n\n" % rev) fout.write ("\n[SANGOMA_ISUP]\n") if protocol == "ANSI": fout.write ("# cfg-rev/SS7-Protocol/SPC-net/SPC-clu/SPC-mem/System-Id/Verbose-Grp-ID\n") else: fout.write ("# cfg-rev/SS7-Protocol/SPC/System-Id/Verbose-Grp-ID\n") fout.write (" %s %s %s %s 1\n" % (this_smgcfg_version, protocol, spc, sysid)) fout.write ("\n[SS7BOX]\n") # fout.write ("# lcl-addr/lcl-port\n") # fout.write (" %s %s\n" % (ss7box_ap[2], ss7box_ap[3])) # fout.write ("# rmt-addr/rmt-port\n") # fout.write (" %s %s\n" % (ss7box_ap[4], ss7box_ap[5])) ss7box_config = 1 fout.write ("# ss7box configuration\n") if len(ss7box_ap) == 6: fout.write (" SIMPLEX\n") else: fout.write (" DUPLEX\n") ss7box_config = 2 fout.write ("# lcl-addr/lcl-port/rmt-addr/rmt-port\n") fout.write (" %15s %5s %15s %5s\n" % ( ss7box_ap[2], ss7box_ap[3], ss7box_ap[4], ss7box_ap[5])) if ss7box_config == 2: fout.write (" %15s %5s %15s %5s\n" % ( ss7box_ap[6], ss7box_ap[7], ss7box_ap[8], ss7box_ap[9])) fout.write ("\n[SANGOMA_MGD]\n") fout.write ("# lcl-addr/lcl-port\n") fout.write (" 127.0.0.66 53000\n") fout.write ("# rmt-addr/rmt-port\n") fout.write (" 127.0.0.65 53000\n") fout.write ("\n[CLI]\n") fout.write ("# lcl-addr/lcl-port\n") fout.write (" 127.0.0.92 55000\n") fout.write ("# rmt-addr/rmt-port\n") fout.write (" 127.0.0.93 55000\n") fout.write ("\n[CDR]\n") fout.write ("# Automatic CDR Logging at Startup\n") fout.write (" n\n") fout.write ("# lcl-addr/lcl-port\n") fout.write (" 127.0.0.92 55001\n") fout.write ("# rmt-addr/rmt-port\n") fout.write (" 127.0.0.93 55001\n") fout.write ("\n[CALL_ENGINE_API]\n") fout.write ("# lcl-addr/lcl-port\n") fout.write (" 127.0.0.92 55002\n") fout.write ("# rmt-addr/rmt-port\n") fout.write (" 127.0.0.93 55002\n") fout.write ("\n[SYSTEM_TIMERS]\n") fout.write ("# index/timer\n") fout.write (" 0 0.00 # base, unused\n") fout.write (" 1 5.00 # heartbeat rate\n") fout.write (" 2 45.00 # call stop\n") fout.write (" 3 1.00 # circuit maintenance gap timer\n") fout.write (" 4 20.00 # automatic call gap timer\n") fout.write (" 5 60.00 # circuit quarantine timer; timer 2 + n\n") fout.write (" 6 0.00 # last, unused\n") fout.write ("\n[TRUNK]\n") fout.write ("# index/voice-trk-grp/facility-type/cic-base/non-voice-channels\n") # the voice trunk list is a subset of the port list, and is sorted on the # ss7boost trunk ID number for port_entry in port: if port_entry[6] != "": trunk.append (port_entry) trunk.sort(lambda x, y:cmp(int(x[6]), int(y[6]))) print "voice trunk list:" for trunk_entry in trunk: if len(trunk_entry) != 15: print "FATAL: port entry missing appended information" print trunk_entry sys.exit (3) print trunk_entry fout.write (" % 2s % 6s %s % 6s " % ( trunk_entry[6], # trunk index trunk_entry[12],# column 12 is appended in this program; it's the if name trunk_entry[8], # facility type trunk_entry[14] # column 14 is appended in this program; it's the cic base )) # make list of voice and non-voice channels channel_map = [ "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv", "nv" ] if trunk_entry[8] == "T1": num_chans = 24 else: num_chans = 31 vc_seg = trunk_entry[13].split(".") #column 13 is appended in this program; it's the voice chan map print "voice channel segements" for vc_seg_entry in vc_seg: #print vc_entry vc_range = vc_seg_entry.split("-") range_begin = int(vc_range[0]) if len(vc_range) == 2: range_end = int(vc_range[1]) else: range_end = int(vc_range[0]) #print "range begin: %d end: %d" % (range_begin, range_end) i = range_begin - 1 # decrease because ss7boost range is 0..n while i < range_end: channel_map[i] = "v" i = i + 1 #print channel_map i = 0 while i < num_chans: if channel_map[i] == "nv": fout.write (" %s" % str(i)) i += 1 fout.write (" end\n") fout.write (" end\n") # distill the cic/trunk-group table into an ordered list of # trunk groups and their member ss7boost trunks tg=[] trk=[] tg_trk=[] for cic_tg_entry in cic_trk_grp: print "tg: %s member trk: %s" % (cic_tg_entry[5], cic_tg_entry[2]) if not cic_tg_entry[5] in tg: tg.append(cic_tg_entry[5]) if not cic_tg_entry[2] in trk: trk.append(cic_tg_entry[2]) #tg.sort(numeric_sort) #trk.sort(numeric_sort) #tg.sort() #trk.sort() tg.sort(lambda x, y:cmp(int(x), int(y))) trk.sort(lambda x, y:cmp(int(x), int(y))) print "trunk group list: " print tg print "trunk list: " print trk # ensure sequentiality of trunk and trunk group lists i=0 for tg_entry in tg: if tg_entry != str(i): print "FATAL: gap in trunk group index sequence, expected %s and found %s" % (str(i), tg_entry) sys.exit(3) i += 1 i=0 for trk_entry in trk: if trk_entry != str(i): print "FATAL: gap in trunk index sequence, expected %s and found %s" % (str(i), trk_entry) sys.exit(3) i += 1 # create a new list of trunk lists associated with each trunk group for tg_entry in tg: print "tg %s contains: " % tg_entry a=[] for cic_tg_entry in cic_trk_grp: if tg_entry == cic_tg_entry[5]: print "trunk %s" % cic_tg_entry[2] if not cic_tg_entry[2] in a: a.append (cic_tg_entry[2]) print "tg-trk entry so far:" print a tg_trk.append(a) print "tg-trk list" print tg_trk # use set operations to ensure that a trunk is a member of one and # only one trunk group fout.write ("\n[TRUNK_GROUP]\n") if protocol == "ANSI": fout.write ("# A/B-net/B-clu/B-mem/C/D/E/F/G/H/I/J/K/L/Z\n") else: fout.write ("# A/B/C/D/E/F/G/H/I/J/K/L/Z\n") for tg_entry in trunk_group: #print tg_entry if tg_entry[5] == "up": tg_entry[5] = "n" else: tg_entry[5] = "y" fout.write ( " %s %s %s %s %s %s %s %s %s %s %s %s begin" % ( tg_entry[1], tg_entry[2], tg_entry[3], tg_entry[4], tg_entry[5], tg_entry[6], tg_entry[7], tg_entry[8], tg_entry[9], tg_entry[10], tg_entry[11], tg_entry[12].strip() )) for t in tg_trk[int(tg_entry[1])]: fout.write (" %s" % t) fout.write (" end\n") fout.write (" end\n") hi=0 fout.write ("\n[TG_CIC_SPAN_CHAN_ASSOC]\n") fout.write ("# index/voice-ind/tg/cic/span/chan\n") for vc_dict_key, vc_dict_entry in vc_dict.iteritems(): print vc_dict_key, vc_dict_entry for channel_cic_tg in vc_dict_entry[3]: fout.write (" %4u %2s %2s %5s %2s %2s\n" % ( hi, channel_cic_tg[2], channel_cic_tg[1], channel_cic_tg[0], vc_dict_entry[5], channel_cic_tg[3] )) hi += 1 fout.write (" end\n") if protocol == "ANSI": fout.write ("\n[GTT_TYPE]\n") fout.write ("# GTT-Type/SSN/Function-ID\n") fout.write (" 11 210 5 # CNAM\n") fout.write (" 20 106 6 # LNP\n") fout.write (" 30 107 7 # TFS\n") fout.write (" 40 108 8 # LIDB\n") fout.write (" 50 109 9 # MAP\n") fout.write (" 60 110 10 # HLR\n") fout.write (" 70 111 11 # VLR\n") fout.write ("end\n") fout.write ("\n[CAPABILITY_CODES]\n") fout.write ("# Index/Cap-PC-net/Cap-PC-clu/Cap-PC-mem/Message-Priority/Network-Indicator\n") fout.write (" 0 5 128 5 0 2 # CNAM\n") fout.write (" 1 5 128 6 0 2 # LIDB\n") fout.write (" 2 5 128 7 0 2 # LNP\n") fout.write (" 3 5 128 8 0 2 # Free Call\n") fout.write ("end\n") fout.close () return def write_tg_timer_conf (tg_id): #************************************************************************ fn = "tg" + str(tg_id) + "_isup_timer.conf" print "%s" % fn fout = open (fn, 'w') fout.write ("# %s\n" % (fn)) fout.write ("# Created by smgcfg%s.py\n\n" % rev) fout.write ("[ISUPTIMERS]\n") fout.write (" 1 20.00\n") fout.write (" 2 180.00\n") fout.write (" 3 120.00\n") fout.write (" 4 300.00\n") fout.write (" 5 300.00\n") fout.write (" 6 20.00\n") fout.write (" 7 25.00\n") fout.write (" 8 12.00\n") fout.write (" 9 180.00\n") fout.write (" 10 5.00 # best if T10 < T8\n") fout.write (" 11 17.00\n") fout.write (" 12 30.00\n") fout.write (" 13 300.00\n") fout.write (" 14 30.00\n") fout.write (" 15 300.00\n") fout.write (" 16 30.00\n") fout.write (" 17 300.00\n") fout.write (" 18 30.00\n") fout.write (" 19 300.00\n") fout.write (" 20 30.00\n") fout.write (" 21 300.00\n") fout.write (" 22 30.00\n") fout.write (" 23 300.00\n") fout.write (" 24 1.00\n") fout.write (" 25 2.00\n") fout.write (" 26 60.00\n") fout.write (" 27 240.00\n") fout.write (" 28 10.00\n") fout.write (" 29 0.60\n") fout.write (" 30 5.00\n") fout.write (" 31 365.00\n") fout.write (" 32 3.00\n") fout.write (" 33 12.00\n") fout.write (" 34 4.00\n") fout.write (" 35 17.00\n") fout.write (" 36 12.00\n") fout.write (" 37 2.00\n") fout.write (" 38 120.00\n") fout.write (" 39 30.00\n") fout.write (" 40 20.00 # T-ccr-complete\n") fout.close () def write_wanrouter_rc( port, lslink): #************************************************************************ flag=0; wanpipeX=[]; wanpipeX_entry=""; wpstart=""; port_entry=""; lslink_entry=""; print "\n------------------------------\n" print "write wanrouter.rc" for port_entry in port: #try to find the ports wanpipe# in the list of sig links for lslink_entry in lslink: if lslink_entry[4] == port_entry[1]: flag=1; #if the flag is still down we have a voice only link if flag == 0: wanpipeX.append(port_entry[1]) print "wanpipe%s is a voice only link" % (port_entry[1]) #reset our temp varaibles flag=0; #sort the list of wanpipeX numbers...to keep things nice and proper wanpipeX.sort(lambda x, y:cmp(int(x), int(y))) #create the string that will go in the wanrouter.rc file for wanpipeX_entry in wanpipeX: wpstart=wpstart+"wanpipe"+wanpipeX_entry+" " #debug: print the string for wanrouter.rc print wpstart fout = open("wanrouter.rc",'w') fout.write("#!/bin/sh\n") fout.write ("# Created by smgcfg%s.py\n\n" % rev) fout.write("# router.rc WAN router meta-configuration file.\n") fout.write("ROUTER_BOOT=YES\n") fout.write("WAN_CONF_DIR=/etc/wanpipe\n") fout.write("WAN_INTR_DIR=/etc/wanpipe/interfaces\n") fout.write("WAN_LOG=/var/log/wanrouter\n") fout.write("WAN_LOCK=/var/lock/subsys/wanrouter\n") fout.write("WAN_LOCK_DIR=/var/lock/subsys\n") fout.write("WAN_IP_FORWARD=NO\n") fout.write("NEW_IF_TYPE=NO\n") fout.write("WAN_LIB_DIR=/etc/wanpipe/lib\n") fout.write("WAN_ADSL_LIST=/etc/wanpipe/wan_adsl.list\n") fout.write("WAN_ANNEXG_LOAD=NO\n") fout.write("WAN_LIP_LOAD=YES\n") fout.write("WAN_DYN_WANCONFIG=NO\n") fout.write("WAN_SCRIPTS_DIR=/etc/wanpipe/scripts\n") fout.write("WAN_FIRMWARE_DIR=/etc/wanpipe/firmware\n") fout.write("WAN_DEVICES_REV_STOP_ORDER=YES\n") fout.write("WAN_DEVICES=\"%s\"\n" % wpstart) fout.close () def usage(): #************************************************************************ print sys.stderr.write('Usage:\n') sys.stderr.write(' smgcfg.py -h // help\n'); sys.stderr.write(' smgcfg.py -f \n') sys.stderr.write('\n') sys.exit(2) return #************************************************************************ # main #************************************************************************ try: optList, args = getopt.getopt(sys.argv[1:], 'f:h', ['help']) except getopt.GetoptError: usage() fn = "" for o, a in optList: if o in ("-h", "--help"): usage() elif o == "-f": fn = a else: usage() if fn == "": usage() found_ports_section = 0 found_ss7box_section = 0 found_ss7boost_section = 0 collect_ss7box_data = 0 collect_ss7boost_data = 0 port = [] protocol = "" ss7box_spc = "" ac = "" lslink = [] lslink_cnt = 0 ls = [] ls_cnt = 0 path = [] path_cnt = 0 outb_route = [] outb_route_cnt = 0 inb_routes_isup = [] inb_routes_isup_cnt = 0 inb_routes_sccp = [] inb_routes_sccp_cnt = 0 ss7boost_spc = "" ss7boost_sysid = "" ss7boost_ss7box_ap = [] tg_cnt = 0 trunk_group = [] cic_trunk_group = [] print print "The contents of %s follows:" % fn print try: fin = open (fn) except IOError: print "Could not open file: %s" % fn print sys.exit(1) L = fin.readline () while len(L) != 0: var_list = L.split (",") #var_list_len = len(var_list) #print var_list_len #print var_list #print "-%s-" % var_list[0] if var_list[0].strip() == "end": if found_ports_section: print "PORTS END" print port found_ports_section = 0 if found_ss7box_section: found_ss7box_section = 0 print "SS7BOX END" if found_ss7boost_section: found_ss7boost_section = 0 print "SS7BOOST END" if found_ports_section: if var_list[7] == "ss7": if len(var_list) > 12: print "FATAL: port table entry is ill-formed" print var_list sys.exit (3) var_list[11] = var_list[11].strip() print "wanpipe%s controlled by SS7" % var_list[1] port.append(var_list) if found_ss7box_section: if collect_ss7box_data == 1: # ss7box spc if var_list[1] == "SPC": print "\tget spc" ss7box_spc = var_list[2].strip() print ss7box_spc collect_ss7box_data = collect_ss7box_data + 1 else: print "malformed ss7box SPC section" print var_list sys.exit(3) elif collect_ss7box_data == 2: # ss7box authcode if (len(var_list) < 3): print "authcode missing" sys.exit(3) if (var_list[2] == ""): print "authcode incorrect" sys.exit(3) print "\tget authcode" ac = var_list[2].strip() print ac collect_ss7box_data = collect_ss7box_data + 1 elif collect_ss7box_data == 3: # ss7box linkset-links if len(var_list) < 2: print "\t\tempty line before linkset-link section" elif var_list[1] == "linkset-links": print "\tget linkset link data" elif var_list[1].strip() == "end": collect_ss7box_data = collect_ss7box_data + 1 print lslink elif var_list[1] == str(lslink_cnt): #print "\t\tlinkset-link %s" % var_list[1] # adjust slot to ss7boost 0..n numbering #var_list[5] = str(int(var_list[5]) - 1) #print "\t\tmodified linkset-link entry" #print var_list var_list[7]=var_list[7].strip() lslink.append(var_list) lslink_cnt = lslink_cnt + 1 elif var_list[1] == "": print "\t\tempty line in linkset-link section" else: print "\t\tpoorly formed linkset-link section" print var_list elif collect_ss7box_data == 4: # ss7box linksets if len(var_list) < 2: print "\t\tempty line before linkset section" elif var_list[1] == "linkset": print "\tget linkset data" elif var_list[1].strip() == "end": collect_ss7box_data = collect_ss7box_data + 1 elif var_list[1] == str(ls_cnt): print "\t\tlinkset %s" % var_list[1] ls.append(var_list) #print ls ls_cnt = ls_cnt + 1 elif var_list[1] == "": print "\t\tempty line in linkset section" else: print "\t\tpoorly formed linkset section" print var_list elif collect_ss7box_data == 5: # ss7box paths if len(var_list) < 2: print "\t\tempty line before path section" elif var_list[1] == "path": print "\tget path data" elif var_list[1].strip() == "end": collect_ss7box_data = collect_ss7box_data + 1 elif var_list[1] == str(path_cnt): print "\t\tpath %s" % var_list[1] path.append(var_list) #print path path_cnt = path_cnt + 1 elif var_list[1] == "": print "\t\tempty line in path section" else: print "FATAL: poorly formed path section" print var_list sys.exit(3) elif collect_ss7box_data == 6: # ss7box routes if len(var_list) < 2: print "\t\tempty line before outbound route section" elif var_list[1] == "outbound rte": print "\tget outbound route data" elif var_list[1].strip() == "end": collect_ss7box_data = collect_ss7box_data + 1 elif var_list[1] == str(outb_route_cnt): print "\t\toutbound route %s" % var_list[1] var_list[5]=var_list[5].strip() outb_route.append(var_list) #print outb_route outb_route_cnt = outb_route_cnt + 1 elif var_list[1] == "": print "\t\tempty line in outbound route section" else: print "FATAL: poorly formed outbound route section" print var_list sys.exit(3) elif collect_ss7box_data == 7: # ss7box isup routes if len(var_list) < 2: print "\t\tempty line before inbound isup route section" elif var_list[1] == "inb rtes isup": print "\tget inbound isup route data" elif var_list[1].strip() == "end": collect_ss7box_data = collect_ss7box_data + 1 elif var_list[1] == str(inb_routes_isup_cnt): print "\t\tinbound isup route %s" % var_list[1] var_list[9]=var_list[9].strip() inb_routes_isup.append(var_list) #print inb_route inb_routes_isup_cnt = inb_routes_isup_cnt + 1 elif var_list[1] == "": print "\t\tempty line in inbound isup route section" else: print "FATAL: poorly formed inbound isup route section" print var_list sys.exit(3) elif collect_ss7box_data == 8: # ss7box sccp routes if len(var_list) < 2: print "\t\tempty line before inbound sccp route section" elif var_list[1] == "inb rtes sccp": print "\tget inbound sccp route data" elif var_list[1].strip() == "end": collect_ss7box_data = collect_ss7box_data + 1 elif var_list[1] == str(inb_routes_sccp_cnt): print "\t\tinbound sccp route %s" % var_list[1] var_list[9]=var_list[9].strip() inb_routes_sccp.append(var_list) #print inb_route inb_routes_sccp_cnt = inb_routes_sccp_cnt + 1 elif var_list[1] == "": print "\t\tempty line in inbound sccp route section" else: print "FATAL: poorly formed inbound sccp route section" print var_list sys.exit(3) else: print "extra stuff at the end of the ss7box section" if found_ss7boost_section: if collect_ss7boost_data == 1: if var_list[1] == "sysid": print "\tget sysid" ss7boost_sysid = var_list[2].strip() collect_ss7boost_data = collect_ss7boost_data + 1 else: print "FATAL: poorly formed ss7boost section; missing sysid" print var_list sys.exit(3) elif collect_ss7boost_data == 2: if var_list[1] == "addr-port": print "\tget addr-port data" collect_ss7boost_data = collect_ss7boost_data + 1 else: print "FATAL: ss7boost section, missing addr-port header line" print var_list sys.exit(3) elif collect_ss7boost_data == 3: if var_list[1] == "ss7box": print "\tget ss7box addr-port data" ss7boost_ss7box_ap = var_list collect_ss7boost_data = collect_ss7boost_data + 1 else: print "\t\tFATAL: ss7boost section, addr-port, missing ss7box section" print var_list sys.exit(3) elif collect_ss7boost_data == 4: if var_list[1] == "t/g": print "\tget trunk group data" elif var_list[1].strip() == "end": collect_ss7boost_data = collect_ss7boost_data + 1 elif var_list[1] == str(tg_cnt): print "\t\ttrunk group: %s" % var_list[1] trunk_group.append(var_list) #print inb_route tg_cnt = tg_cnt + 1 elif var_list[1] == "": print "\t\tempty line in trunk group section" else: print "FATAL: poorly formed trunk group section" print var_list sys.exit(3) elif collect_ss7boost_data == 5: if len(var_list) < 2: print "\t\tempty line before CIC/trunk group assignment section" elif var_list[1] == "cic-tg": print "\tget CIC/trunk group assignment data" elif var_list[1].strip() == "end": collect_ss7boost_data = collect_ss7boost_data + 1 elif var_list[2] != "": var_list[5] = var_list[5].strip() cic_trunk_group.append(var_list) elif var_list[1] == "": print "\t\tempty line in CIC/trunk group assignment section" else: print "FATAL: poorly formed CIC/trunk group assignment section" print var_list sys.exit(3) else: print "extra stuff at the end of the ss7boost section" print var_list #print var_list #sys.stderr.write(L) if var_list[0] == "protocol": protocol = var_list[1].strip() if len(var_list) < 5: smgcfg_version = "0.0" else: smgcfg_version = var_list[4].strip() if smgcfg_version != this_smgcfg_version: print "input file revision %s not compatible with smgcfg revision %s" % (smgcfg_version, this_smgcfg_version) sys.exit(3) print "protocol: %s; smgcfg version: %s" % (protocol, smgcfg_version) if var_list[0] == "ports": if protocol == "": print "protocol not defined" sys.exit(3) print "PORTS BEGIN" found_ports_section = 1 if var_list[0] == "ss7box": print "SS7BOX BEGIN" ss7box_on_this_node = var_list[2].strip() if ss7box_on_this_node.lower() == "yes": print "\tss7box running on this node" collect_ss7box_data = 1 else: print "\tss7box not running on this node" found_ss7box_section = 1 if var_list[0] == "ss7boost": print "SS7BOOST BEGIN" found_ss7boost_section = 1 collect_ss7boost_data = 1 if var_list[1] == "SPC": ss7boost_spc = var_list[2].strip() else: print "poorly formed ss7boost SPC section" sys.exit(3) L = fin.readline () # modify the port list; add the voice chan summary expression, and the voice chan interface name # using the cic_tg list voice_chan_dict = {} for cic_tg_entry in cic_trunk_group: dict_locate_success = 0 if voice_chan_dict.has_key(cic_tg_entry[2]): # if cic_tg_entry[2] in voice_chan_dict: print "modifying voice chan dict entry for ss7boost trunk %s" % cic_tg_entry[2] # get dictionary entry vc_dict_entry = voice_chan_dict[cic_tg_entry[2]] # modify vc_map from dictionary entry vc_dict_entry[3] = map_voice_channels ( cic_tg_entry[3], # channel range cic_tg_entry[4], # CIC base for range cic_tg_entry[5], # trunk group vc_dict_entry[3])# per channel assign. of CIC and t/g # put new entry for this dictionary item voice_chan_dict[cic_tg_entry[2]] = vc_dict_entry dict_locate_success = 1 else: # try to add entry to dictionary # port index mods for port_entry in port: # match the port entry to the cic t/g entry by ss7boost trunk number print "wanpipe %s ss7boost trunk %s compared to cic-tg ss7boost trunk %s" % ( port_entry[1], port_entry[6], cic_tg_entry[2]) if port_entry[6] == cic_tg_entry[2]: if port_entry[7] == "ss7": if port_entry[8] == 'E1': #vc_range = "1-31" voice_chan_dict[cic_tg_entry[2]] = [ port_entry[1], # wanpipe N "E1", "1-31", [ # each tuple is the channel assignment of (cic, t/g, voice-ind, chan) ('c',"tg",'n',"0"), ('c',"tg",'n',"1"), ('c',"tg",'n',"2"), ('c',"tg",'n',"3"), ('c',"tg",'n',"4"), ('c',"tg",'n',"5"), ('c',"tg",'n',"6"), ('c',"tg",'n',"7"), ('c',"tg",'n',"8"), ('c',"tg",'n',"9"), ('c',"tg",'n',"10"), ('c',"tg",'n',"11"), ('c',"tg",'n',"12"), ('c',"tg",'n',"13"), ('c',"tg",'n',"14"), ('c',"tg",'n',"15"), ('c',"tg",'n',"16"), ('c',"tg",'n',"17"), ('c',"tg",'n',"18"), ('c',"tg",'n',"19"), ('c',"tg",'n',"20"), ('c',"tg",'n',"21"), ('c',"tg",'n',"22"), ('c',"tg",'n',"23"), ('c',"tg",'n',"24"), ('c',"tg",'n',"25"), ('c',"tg",'n',"26"), ('c',"tg",'n',"27"), ('c',"tg",'n',"28"), ('c',"tg",'n',"29"), ('c',"tg",'n',"30") ], "a-b", port_entry[5] # span ] elif port_entry[8] == 'T1': #vc_range = "1-24" voice_chan_dict[cic_tg_entry[2]] = [ port_entry[1], # wanpipe N "T1", "1-24", [ # each tuple is the channel assignment of (cic, t/g, voice-ind, chan) ('c',"tg",'n',"0"), ('c',"tg",'n',"1"), ('c',"tg",'n',"2"), ('c',"tg",'n',"3"), ('c',"tg",'n',"4"), ('c',"tg",'n',"5"), ('c',"tg",'n',"6"), ('c',"tg",'n',"7"), ('c',"tg",'n',"8"), ('c',"tg",'n',"9"), ('c',"tg",'n',"10"), ('c',"tg",'n',"11"), ('c',"tg",'n',"12"), ('c',"tg",'n',"13"), ('c',"tg",'n',"14"), ('c',"tg",'n',"15"), ('c',"tg",'n',"16"), ('c',"tg",'n',"17"), ('c',"tg",'n',"18"), ('c',"tg",'n',"19"), ('c',"tg",'n',"20"), ('c',"tg",'n',"21"), ('c',"tg",'n',"22"), ('c',"tg",'n',"23"), ('c',"tg",'n',"24"), ('c',"tg",'n',"25"), ('c',"tg",'n',"26"), ('c',"tg",'n',"27"), ('c',"tg",'n',"28"), ('c',"tg",'n',"29"), ('c',"tg",'n',"30") ], "a-b", port_entry[5] # span ] else: print "wanpipe %s has misconfigured FE_MEDIA" % port_entry[1] sys.exit(3) # get dictionary entry vc_dict_entry = voice_chan_dict[cic_tg_entry[2]] # modify vc_map from dictionary entry map_voice_channels ( cic_tg_entry[3], # channel range cic_tg_entry[4], # CIC base for range cic_tg_entry[5], # trunk group vc_dict_entry[3])# per channel assign. of CIC and t/g # put new entry for this dictionary item voice_chan_dict[cic_tg_entry[2]] = vc_dict_entry print "adding voice chan dict entry for ss7boost trunk %s" % cic_tg_entry[2] dict_locate_success = 1 else: print "ss7boost trunk %s is not configured correctly" % cic_tg_entry[2] sys.exit(3) if not dict_locate_success: print "ss7boost trunk %s cannot be entered into the cic_tg_dictionary" % cic_tg_entry[2] sys.exit(3) print "\ncreate wanpipe_vc_map in each voice_chan_dict entry.....\n" for vc_dict_key, vc_dict_entry in voice_chan_dict.iteritems(): print vc_dict_key print vc_dict_entry print for vc_dict_key, vc_dict_entry in voice_chan_dict.iteritems(): print vc_dict_key, vc_dict_entry i=1 wp_vc_map_init=1 wp_vc_map_restart=0 start_i=last_i=i gap=0 last_i_is_voice=0 for channel_cic_tg in vc_dict_entry[3]: print "span: %s chan: %s cic: %s tg: %s voice: %s" % ( vc_dict_entry[5], #str(i), channel_cic_tg[3], channel_cic_tg[0], channel_cic_tg[1], channel_cic_tg[2]) if channel_cic_tg[0] == 'n': print "channel %s is non-voice" % str(i) if not wp_vc_map_init: if not gap: if (start_i < last_i): wanpipe_vc_map+=('-'+str(last_i)) print "gapped wanpipe voice channel map: %s" % wanpipe_vc_map wp_vc_map_restart=1 gap=1 last_i_is_voice=0 else: gap=0 if wp_vc_map_init: wp_vc_map_init=0 wanpipe_vc_map = str(i) start_i=i print "initial wanpipe voice channel map: %s" % wanpipe_vc_map elif wp_vc_map_restart: start_i=i wp_vc_map_restart=0 gap=0 wanpipe_vc_map+=('.'+str(i)) print "restart wanpipe voice channel map: %s" % wanpipe_vc_map else: print "temp wanpipe voice channel map: %s-%s" % (wanpipe_vc_map, i) last_i_is_voice=1 last_i=i i=i+1 print "start_i: %s last_i: %s last_i_is_voice: %s" % (start_i, last_i, last_i_is_voice) if last_i_is_voice: print "check 1" if (start_i < last_i): print "check 2" wanpipe_vc_map+=('-'+str(last_i)) print "final wanpipe voice channel map: %s" % wanpipe_vc_map # write wanpipe voice channel map string to dictionay entry vc_dict_entry[4] = wanpipe_vc_map voice_chan_dict[vc_dict_key] = vc_dict_entry print "voice channel dictionary end" for vc_dict_key, vc_dict_entry in voice_chan_dict.iteritems(): print vc_dict_key, vc_dict_entry print "do-over: voice channel dictionary end" # write conf files for port_entry in port: # voice_chan_dict key is the ss7boost trunk index 0..n if voice_chan_dict.has_key(port_entry[6]): vc_dict_entry = voice_chan_dict[port_entry[6]] port_entry.append(sp_voice_if_name (port_entry[1], vc_dict_entry[4])) port_entry.append(vc_dict_entry[4]) vc_map = vc_dict_entry[3] for vc_map_entry in vc_map: if vc_map_entry[0] != "n": print "cic base is %s" % vc_map_entry[0] port_entry.append(vc_map_entry[0]) break for port_entry in port: print "PORT ENTRY" print port_entry first_smg_wanpipe=1 for port_entry in port: # voice_chan_dict key is the ss7boost trunk index 0..n if voice_chan_dict.has_key(port_entry[6]): vc_dict_entry = voice_chan_dict[port_entry[6]] wanpipe_vc_map = vc_dict_entry[4] else: wanpipe_vc_map = "no_voice_channels" make_ss7_wanpipe_conf_file ( first_smg_wanpipe, port_entry, lslink, wanpipe_vc_map) first_smg_wanpipe=0 if collect_ss7box_data: write_ss7box_conf ( protocol, ss7box_spc, ac, lslink, ls, path, outb_route, inb_routes_isup, inb_routes_sccp) #print "TEST EXIT" #sys.exit (-4) write_sangoma_isup_conf ( protocol, ss7boost_spc, ss7boost_sysid, ss7boost_ss7box_ap, port, trunk_group, cic_trunk_group, voice_chan_dict) print "Creating tgX_isup_timer.conf files - one for each trunk group" i=0 while i < tg_cnt: write_tg_timer_conf (i) i=i+1 write_wanrouter_rc( port, lslink) print "FINISHED"