etherswitch.py revision 11776:ed89cb178ecd
113168Smatt.horsnell@arm.comdef upgrader(cpt): 213168Smatt.horsnell@arm.com for sec in cpt.sections(): 313168Smatt.horsnell@arm.com if sec == "system": 413168Smatt.horsnell@arm.com options = cpt.items(sec) 513168Smatt.horsnell@arm.com for it in options: 613168Smatt.horsnell@arm.com opt_split = it[0].split('.') 713168Smatt.horsnell@arm.com if len(opt_split) < 2: continue 813168Smatt.horsnell@arm.com new_sec_name = opt_split[1] 913168Smatt.horsnell@arm.com old_opt_name = opt_split[len(opt_split) - 1] 1013168Smatt.horsnell@arm.com if "outputFifo" in new_sec_name: 1113168Smatt.horsnell@arm.com new_sec_name = new_sec_name.rstrip("outputFifo") 1213168Smatt.horsnell@arm.com new_sec_name += ".outputFifo" 1313168Smatt.horsnell@arm.com new_sec_name = "system.system.%s" %(new_sec_name) 1413168Smatt.horsnell@arm.com if not cpt.has_section(new_sec_name): 1513168Smatt.horsnell@arm.com cpt.add_section(new_sec_name) 1613168Smatt.horsnell@arm.com if old_opt_name == "size": 1713168Smatt.horsnell@arm.com cpt.set(new_sec_name, "_size", it[1]) 1813168Smatt.horsnell@arm.com elif old_opt_name == "packets": 1913168Smatt.horsnell@arm.com cpt.set(new_sec_name, "fifosize", it[1]) 2013168Smatt.horsnell@arm.com else: 2113168Smatt.horsnell@arm.com cpt.set(new_sec_name, old_opt_name, it[1]) 2213168Smatt.horsnell@arm.com cpt.remove_option(sec, it[0]) 2313168Smatt.horsnell@arm.com