-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLOUDSTACK-9812:Update "updatePortForwardingRule" api to include additional parameter to update the end port in case of port range #1985
Conversation
} | ||
if (privateEndPort != null) { | ||
rule.setDestinationPortStart((privatePort == null) ? privateEndPort.intValue() : privatePort.intValue()); | ||
rule.setDestinationPortEnd(privateEndPort); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not needed. It would have got set already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is for the case when privatePort is null and privateEndPort is not null. Rather else part in conditional if(privateEndport == null) can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, above two can be combined into one "if else" with nested conditions to avoid any duplicate statements
rule.setDestinationPortEnd((privateEndPort == null) ? privatePort.intValue() : privateEndPort.intValue()); | ||
} | ||
if (privateEndPort != null) { | ||
rule.setDestinationPortStart((privatePort == null) ? privateEndPort.intValue() : privatePort.intValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else of part of conditional is redundant. already taken care in previous if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two successive ifs can be written like this
if (privatePort != null) { rule.setDestinationPortStart(privatePort.intValue());
rule.setDestinationPortEnd((privateEndPort == null) ? privatePort.intValue() : privateEndPort.intValue());
}
else if (privateEndPort != null) {
rule.setDestinationPortStart( privateEndPort.intValue());
rule.setDestinationPortEnd(privateEndPort);
}
Done, please check |
Code LGTM |
tag:This is Ready to Merge |
from marvin.codes import PASS | ||
from nose.plugins.attrib import attr | ||
|
||
class TestPortForwardingRules(cloudstackTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this test is rather quick, move it to smoke please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…tional parameter end port
ACS CI BVT RunSumarry: Link to logs Folder (search by build_no): https://www.dropbox.com/sh/r2si930m8xxzavs/AAAzNrnoF1fC3auFrvsKo_8-a?dl=0 Failed tests:
Skipped tests: Passed test suits: |
LGTM for Testing |
@blueorangutan package |
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1045 |
@blueorangutan test |
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
Trillian test result (tid-1457)
|
LGTM, no new regressions found. The errors are known intermittent failures, being handled separately. @summary: Test to list, create and delete Port Forwarding for ... === TestName: test_01_create_delete_portforwarding_fornonvpc | Status : SUCCESS === Ran 1 test in 253.043s OK |
Configure a PF rule Private port : Start port ; 20 ENd POrt 25 || Public Port : Start port 20 ; ENd Port : 25.
Trigger UpdatePortForwardingRule api
ApI fails with following error : " Unable to update the private port of port forwarding rule as the rule has port range "
Solution-
Port range gets modified