iApp Lab 5 - Priority Group Activation¶
We need to support priority group activation in this iApp.¶
Sometimes a template almost does what a customer wants, but needs just
that little bit extra. In this lab, you are going to take the http
iApp template and add the ability for the user to use Priority Group
Activation for their pool members. This task will involve adding a new
question and two new optional elements containing inputs, one of them
in a table, to the server_pools section and a small amount of code in
the implementation section to handle that input and alter the pool to
allow for priority group activation, if the user wants it.
Note: When it comes to editing your template, you have a choice as to
how you want to do it.
1. You can edit the template on the BIG-IP in TMSH, using vi.
2. You can export the entire template as a file, load that file into
your code editor for editing, and then import it back into the BIG-IP
when you are finished.
3. You can cut-and-paste the contents of the section that you are
working on into the code editor of your choice, work on it there, and
cut-and-paste it back.
4. You can make your edits in the BIG-IP iApp Template UI, although
this option is really not recommended.
Part 1: Copy the iApp template¶
1. Navigate to the iApp -> Templates screen.
2. Select the f5.http template to view it.
3. Scroll down to the bottom of the screen and click the Copy button.
4. Name your new template and save it.
Part 2: Edit the Presentation Section¶
The following is a series of tasks that need to be accomplished. If
you are uncertain how to complete a task, you can look for examples of
similar things being done in other templates.
1. Add a new no/yes question in the server_pools section, after the
lb_method_choice question that asks if the user wants to enable
priority group activation.
2. Add a new optional that displays when the above question is set to
true.
a. It should contain a string input for the min active members value
of Priority Group Activation. This should have a NonNegativeNumber
validate set on it and a default value of 0.
3. Now, inside the servers table, add a new optional that displays
when the enable priority group activation question is set to true.
a. It should contain a string input for the pool member priority.
This should have a NonNegativeNumber validate set on it and a default
value of 0.
4. Remember to save and test your presentation section before going
on.
Part 3: Edit the Implementation Section¶
The following is a series of tasks that need to be accomplished. If
you are uncertain how to complete a task, you can look for examples of
similar things being done in other templates.
1. Your first task is to create a copy of the create_pool proc from
the f5.app_utils include file into your template and edit it to create
a custom version. This will require the following steps
- Cut-and-paste the proc into your new template.
b. Rename the proc to create_pool_with_pga so that there is no name
conflict
c. Add two new input parameters to the proc named enable_pga and
min_active_members.
d. Change all examples of do_tmsh_create to tmsh_create and all
examples of do_tmsh_modify to tmsh_modify.
e. Add a global variable named PRIORITY_FIELD and set it equal to the
name of the input you created for pool member priority.
f. Right after the line “tmsh_modify “/ ltm pool” “$pool_name monitor
$monitor_name”” you are going to need to add a check to see if
enable_pga is equal to Yes.
i. If it is, modify the pool to set its min-active-members option
equal to the min_active_members parameter to this proc.
ii. If it is no, modify the pool to set its min-active-members option
equal to zero.
g. Next, find the places in this proc when the conn_limin_value
variable is set to -1 and add a new line in both places setting a
variable named priority_value to -1 as well.
h. Make a copy of the if block started with this if statement, “if {
$element == $::CONNECTION_LIMIT_FIELD } {” and edit the copy so that
it checks if $element is equal to $::PRIORITY_FIELD and sets the
priority_value instead of the conn_limit_value.
i. Finally, make a copy of the if block started by the statement “if
{ $conn_limit_value != “-1” } {” and edit the copy so that it is
checking the priority_value and setting the priority-group option.
2. Now do a search to find the place where the create_pool was being
called inside the configure_http_deployment proc.
3. Change this line so that it calls your new proc instead.
4. Don’t forget to add the two extra parameters. You should send it
the answers to the two new questions that you asked about enabling
priority group activation and about the min-active-members.
a. Note: when the enable priority group activation question is no,
there is not going to be a value available for the min active members
question. You will need to check on this and only try to access the
answer to the second question if it is set to Yes.
Part 4: Edit the Help Section¶
Go into the Help section and add some guidance for your new template
feature.
Part 5: Testing:¶
1. Enter the template and verify that all of the visual elements,
questions, and labels look as they should.
2. Make sure that the template still works as expected if you elect to
not to enable priority group activation.
3. Reenter the template and activate priority group activation.
a. Make sure that the min_active_members field shows up and that the
priority appears in the pool member add line.
- Enter the details and submit
c. After you have finished, go to the pool page and make sure that
priority group activation was enabled and that the priorities are
properly set on the pool members.
4. Make sure that the help section looks right.
Solution Attached Below¶
The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.