def __create_link(self, if1, if2, vlan1, vlan2, sliver_id): """ Generates the SE link in a proper format: Old: <urn_dpid_1>_<port1>_<dpid2>_<port2>_<vlan1>_<vlan2> New: <urn_dpid_1>_<port1>?vlan=<vlan1>-<dpid2>_<port2>?vlan=<vlan2> """ i = if1.rindex("_") n1, port1 = if1[0:i], if1[i+1:len(if1)] i = if2.rindex("_") n2, port2 = if2[0:i], if2[i+1:len(if2)] dpid2 = n2[n2.rindex("+")+1:] # Format of the link # urn:publicid:IDN+fms:psnc:serm+link+<dpid1>_<p1>?vlan=X-<dpid2>_<p2>?vlan=Y # cid = n1 + "_" + port1 + "-" + dpid2 + "_" + port2 # cid = "%s_%s-%s_%s" % (n1, port1, dpid2, port2) cid = "%s_%s?vlan=%s-%s_%s?vlan=%s" % \ (n1, port1, vlan1, dpid2, port2, vlan2) logger.debug("cid=%s, node-id=%s, vlan1=%s, vlan2=%s, \ port-num1=%s, port-num2=%s" % (cid, n1, vlan1, vlan2, port1, port2,)) typee, cm_name = db_sync_manager.get_se_link_info(n1 + "_" + port1) l = SELink(cid, typee, cm_name, sliver=sliver_id) l.add_interface_ref(if1) l.add_interface_ref(if2) return l
def __create_link(self, if1, if2, vlan1, vlan2, sliver_id): """ Generates the SE link in a proper format: <urn_dpid_1>_<port1>_<dpid2>_<port2>_<vlan1>_<vlan2> """ i = if1.rindex("_") n1, num1 = if1[0:i], if1[i+1:len(if1)] i = if2.rindex("_") n2, num2 = if2[0:i], if2[i+1:len(if2)] dpid2 = n2[n2.rindex("+")+1:] cid = n1 + "_" + num1 + "_" + dpid2 + "_" + num2 logger.debug("cid=%s, node-id=%s, port-num1=%s, port-num2=%s" % (cid, n1, num1, num2,)) typee, cm_name = db_sync_manager.get_se_link_info(n1 + "_" + num1) l = SELink(cid, typee, cm_name, sliver=sliver_id) l.add_interface_ref(if1, vlan1) l.add_interface_ref(if2, vlan2) return l