def print_ltm(xport, ltm): if ltm is not None: print 'recv: %s' % str(ltm) t = ltm.get_type() if t==LinksAdd.get_type() or t==LinksDel.get_type(): # got request to add/del a link: tell the GUI we've done so xport.write(MPFR_PROTOCOL.pack_with_header(ltm))
def receive_ltm(xport, ltm): if ltm is not None: print 'recv: %s' % str(ltm) t = ltm.get_type() if t==LinksAdd.get_type() or t==LinksDel.get_type(): # got request to add/del a link: tell the GUI we've done so xport.write(MPFR_PROTOCOL.pack_with_header(ltm)) elif t == SetMPFR.get_type(): if(ltm.get_subtype() == SetMPFR.TYPE_MP): for r in rtrs: r.setMultipath(ltm.val) elif(ltm.get_subtype() == SetMPFR.TYPE_FR): for r in rtrs: r.setFastReroute(ltm.val)