def addQueues(): #print ports log.info('Starting queue configuration...') msg = ofq2.ofp_qos_msg() msg.ofp_header = ofq2.ofp_header() msg.sched_type = ofq2.ofp_qos_type_rev_map['OFP_QOS_SCHED_HTB'] msg.body = ofq2.ofp_qos_sqf() msg.body.ofp_qos_header = ofq2.ofp_qos_header() msg.body.ofp_qos_header.object_type = ofq2.ofp_qos_object_type_rev_map[ 'OFP_QOS_CLASS'] msg.body.ofp_qos_header.action_type = ofq2.ofp_qos_action_type_rev_map[ 'OFP_QOS_ACTION_ADD'] msg.body.port_no = 1 msg.body.class_id = 0 msg.body.perturb = 5 msg.body.quantum = 100 packed = b"" packed += msg.ofp_header.pack() packed += struct.pack('!BpppBBHIII', msg.sched_type, '0', '0', '0', msg.body.ofp_qos_header.object_type, msg.body.ofp_qos_header.action_type, msg.body.port_no, msg.body.class_id, msg.body.perturb, msg.body.quantum) #core.openflow.sendToDPID(str_to_dpid('1'), msg) log.info(' -> queues inicializated')
def addQueues(): #print ports log.info('Starting queue configuration...') for i in graph.nodes(): #print graph.nodes()[0] msg = ofq2.ofp_qos_msg() msg.ofp_header = ofq2.ofp_header() msg.ofp_header.length = 32 msg.sched_type = ofq2.ofp_qos_type_rev_map['OFP_QOS_SCHED_HTB'] msg.body = ofq2.ofp_qos_sqf() msg.body.ofp_qos_header = ofq2.ofp_qos_header() msg.body.ofp_qos_header.object_type = ofq2.ofp_qos_object_type_rev_map[ 'OFP_QOS_CLASS'] msg.body.ofp_qos_header.action_type = ofq2.ofp_qos_action_type_rev_map[ 'OFP_QOS_ACTION_ADD'] for p in [1, 2]: msg.body.port_no = p msg.body.class_id = 1 msg.body.rate = 1800000 msg.body.ceil = 2000000 msg.body.prio = 1 packed = b"" packed += msg.ofp_header.pack() packed += struct.pack('!BpppBBHIIII', msg.sched_type, '0', '0', '0', msg.body.ofp_qos_header.object_type, msg.body.ofp_qos_header.action_type, msg.body.port_no, msg.body.class_id, msg.body.rate, msg.body.ceil, msg.body.prio) core.openflow.sendToDPID(i, packed) msg.body.class_id = 2 msg.body.rate = 80000 msg.body.ceil = 1500000 packed = b"" packed += msg.ofp_header.pack() packed += struct.pack('!BpppBBHIIII', msg.sched_type, '0', '0', '0', msg.body.ofp_qos_header.object_type, msg.body.ofp_qos_header.action_type, msg.body.port_no, msg.body.class_id, msg.body.rate, msg.body.ceil, msg.body.prio) core.openflow.sendToDPID(i, packed) # To recognize the packet msg = of.ofp_flow_mod() msg.command = of.OFPFC_MODIFY msg.match.dl_type = 0x0880 msg.action = of.ofp_action_output(port=7) core.openflow.sendToDPID(1, msg) log.info(' -> queues inicializated')
def addQueues(): #print ports log.info('Starting queue configuration...') for i in graph.nodes(): #print graph.nodes()[0] msg = ofq2.ofp_qos_msg() msg.ofp_header = ofq2.ofp_header() msg.ofp_header.length = 32 msg.sched_type = ofq2.ofp_qos_type_rev_map['OFP_QOS_SCHED_HTB'] msg.body = ofq2.ofp_qos_sqf() msg.body.ofp_qos_header = ofq2.ofp_qos_header() msg.body.ofp_qos_header.object_type = ofq2.ofp_qos_object_type_rev_map['OFP_QOS_CLASS'] msg.body.ofp_qos_header.action_type = ofq2.ofp_qos_action_type_rev_map['OFP_QOS_ACTION_ADD'] for p in [1,2]: msg.body.port_no = p msg.body.class_id = 1 msg.body.rate = 1800000 msg.body.ceil = 2000000 msg.body.prio = 1 packed = b"" packed += msg.ofp_header.pack() packed += struct.pack('!BpppBBHIIII', msg.sched_type, '0', '0', '0', msg.body.ofp_qos_header.object_type, msg.body.ofp_qos_header.action_type, msg.body.port_no, msg.body.class_id, msg.body.rate, msg.body.ceil, msg.body.prio) core.openflow.sendToDPID(i, packed) msg.body.class_id = 2 msg.body.rate = 80000 msg.body.ceil = 1500000 packed = b"" packed += msg.ofp_header.pack() packed += struct.pack('!BpppBBHIIII', msg.sched_type, '0', '0', '0', msg.body.ofp_qos_header.object_type, msg.body.ofp_qos_header.action_type, msg.body.port_no, msg.body.class_id, msg.body.rate, msg.body.ceil, msg.body.prio) core.openflow.sendToDPID(i, packed) # To recognize the packet msg = of.ofp_flow_mod() msg.command = of.OFPFC_MODIFY msg.match.dl_type = 0x0880 msg.action = of.ofp_action_output(port=7) core.openflow.sendToDPID(1, msg) log.info(' -> queues inicializated')
def addQueues(): #print ports log.info('Starting queue configuration...') msg = ofq2.ofp_qos_msg() msg.ofp_header = ofq2.ofp_header() msg.sched_type = ofq2.ofp_qos_type_rev_map['OFP_QOS_SCHED_HTB'] msg.body = ofq2.ofp_qos_sqf() msg.body.ofp_qos_header = ofq2.ofp_qos_header() msg.body.ofp_qos_header.object_type = ofq2.ofp_qos_object_type_rev_map['OFP_QOS_CLASS'] msg.body.ofp_qos_header.action_type = ofq2.ofp_qos_action_type_rev_map['OFP_QOS_ACTION_ADD'] msg.body.port_no = 1 msg.body.class_id = 0 msg.body.perturb = 5 msg.body.quantum = 100 packed = b"" packed += msg.ofp_header.pack() packed += struct.pack('!BpppBBHIII', msg.sched_type, '0', '0', '0', msg.body.ofp_qos_header.object_type, msg.body.ofp_qos_header.action_type, msg.body.port_no, msg.body.class_id, msg.body.perturb, msg.body.quantum) #core.openflow.sendToDPID(str_to_dpid('1'), msg) log.info('Queues inicializated')