print(" Buckets :") print(" [0] actions: Output (%s)") % out_port1 print(" [1] actions: Output (%s)") % out_port2 print(" [2] actions: Output (%s)") % out_port3 time.sleep(rundelay) # Allocate a placeholder for the group entry group_entry = GroupEntry(group_id, group_type) group_entry.set_group_name(group_name) # Fill in group entry with action buckets # --------- bucket_id = 0 bucket1 = GroupBucket(bucket_id) action = OutputAction(order=0, port=out_port1) bucket1.add_action(action) group_entry.add_bucket(bucket1) # --------- bucket_id += 1 bucket2 = GroupBucket(bucket_id) action = OutputAction(order=0, port=out_port2) bucket2.add_action(action) group_entry.add_bucket(bucket2) # --------- bucket_id += 1 bucket3 = GroupBucket(bucket_id) action = OutputAction(order=0, port=out_port3) bucket3.add_action(action) group_entry.add_bucket(bucket3)
print (" Buckets :") print (" [0] actions: Output (%s)") % out_port1 print (" [1] actions: Output (%s)") % out_port2 print (" [2] actions: Output (%s)") % out_port3 time.sleep(rundelay) # Allocate a placeholder for the group entry group_entry = GroupEntry(group_id, group_type) group_entry.set_group_name(group_name) # Fill in group entry with action buckets # --------- bucket_id = 0 bucket1 = GroupBucket(bucket_id) action = OutputAction(order = 0, port = out_port1) bucket1.add_action(action) group_entry.add_bucket(bucket1) # --------- bucket_id += 1 bucket2 = GroupBucket(bucket_id) action = OutputAction(order = 0, port = out_port2) bucket2.add_action(action) group_entry.add_bucket(bucket2) # --------- bucket_id += 1 bucket3 = GroupBucket(bucket_id) action = OutputAction(order = 0, port = out_port3) bucket3.add_action(action) group_entry.add_bucket(bucket3)
print (" [0] actions : Pop VLAN") print (" Output (%s)" % (out_port)) time.sleep(rundelay) # Allocate a placeholder for the group entry group_entry = GroupEntry(group_id, group_type) group_entry.set_group_name(group_name) # Fill actions bucket with the set of actions bucket_id = 0 bucket = GroupBucket(bucket_id) action_order = 0 action1 = PopVlanHeaderAction(action_order) bucket.add_action(action1) action_order += 1 action2 = OutputAction(action_order) action2.set_outport(out_port) bucket.add_action(action2) # Add actions bucket to the group entry group_entry.add_bucket(bucket) # Request Controller to create the group print "\n".strip() print ("<<< Group to create:") print group_entry.get_payload() time.sleep(rundelay) result = ofswitch.add_modify_group(group_entry)