Skip to content
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

Merged
merged 1 commit into from Aug 31, 2017

Conversation

mrunalinikankariya
Copy link
Contributor

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

}
if (privateEndPort != null) {
rule.setDestinationPortStart((privatePort == null) ? privateEndPort.intValue() : privatePort.intValue());
rule.setDestinationPortEnd(privateEndPort);

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

Copy link
Contributor Author

@mrunalinikankariya mrunalinikankariya May 11, 2017

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

Copy link

@yvsubhash yvsubhash May 11, 2017

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());

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, will remove it

Copy link

@yvsubhash yvsubhash left a 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);
}

@mrunalinikankariya
Copy link
Contributor Author

Done, please check

@jayapalu
Copy link
Contributor

Code LGTM

@mrunalinikankariya
Copy link
Contributor Author

tag:This is Ready to Merge

from marvin.codes import PASS
from nose.plugins.attrib import attr

class TestPortForwardingRules(cloudstackTestCase):
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@cloudmonger
Copy link

ACS CI BVT Run

Sumarry:
Build Number 1157
Hypervisor xenserver
NetworkType Advanced
Passed=110
Failed=6
Skipped=12

Link to logs Folder (search by build_no): https://www.dropbox.com/sh/r2si930m8xxzavs/AAAzNrnoF1fC3auFrvsKo_8-a?dl=0

Failed tests:

  • test_vm_snapshots.py

  • test_change_service_offering_for_vm_with_snapshots Failed

  • test_routers_network_ops.py

  • test_01_isolate_network_FW_PF_default_routes_egress_true Failing since 22 runs

  • test_02_isolate_network_FW_PF_default_routes_egress_false Failing since 149 runs

  • test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true Failing since 144 runs

  • test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false Failing since 144 runs

  • ContextSuite context=TestRedundantIsolateNetworks>:teardown Failing since 13 runs

Skipped tests:
test_vm_nic_adapter_vmxnet3
test_01_verify_libvirt
test_02_verify_libvirt_after_restart
test_03_verify_libvirt_attach_disk
test_04_verify_guest_lspci
test_05_change_vm_ostype_restart
test_06_verify_guest_lspci_again
test_static_role_account_acls
test_11_ss_nfs_version_on_ssvm
test_nested_virtualization_vmware
test_3d_gpu_support
test_deploy_vgpu_enabled_vm

Passed test suits:
test_deploy_vm_with_userdata.py
test_affinity_groups_projects.py
test_portable_publicip.py
test_over_provisioning.py
test_global_settings.py
test_router_dnsservice.py
test_scale_vm.py
test_service_offerings.py
test_routers_iptables_default_policy.py
test_loadbalance.py
test_routers.py
test_reset_vm_on_reboot.py
test_deploy_vms_with_varied_deploymentplanners.py
test_network.py
test_router_dns.py
test_portforwardingrules.py
test_non_contigiousvlan.py
test_login.py
test_deploy_vm_iso.py
test_list_ids_parameter.py
test_public_ip_range.py
test_multipleips_per_nic.py
test_metrics_api.py
test_regions.py
test_affinity_groups.py
test_network_acl.py
test_pvlan.py
test_volumes.py
test_nic.py
test_deploy_vm_root_resize.py
test_resource_detail.py
test_secondary_storage.py
test_vm_life_cycle.py
test_disk_offerings.py

@SowjanyaPatha
Copy link
Contributor

LGTM for Testing
Able to update Port Forwarding Rules.
First Created PortForwarding rule with private port range (22-22) and public port range (3000-3000) Assigned this PF rule to a VM.
executed updatePortForwrdingRule api
http://localhost:8080/client/api?command=updatePortForwardingRule&id=a75f2c9d-484b-41b0-bf85-59f4a532c9db&privateport=80&privateendport=80
private ports got updated.

1985

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1045

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

@rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-1457)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 32379 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr1985-t1457-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_iso.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Test completed. 56 look OK, 3 have error(s)

Test Result Time (s) Test File
test_01_vpc_remote_access_vpn Failure 60.69 test_vpc_vpn.py
test_04_rvpc_privategw_static_routes Failure 364.80 test_privategw_acl.py
test_05_iso_permissions Failure 0.04 test_iso.py
test_02_edit_iso Failure 0.04 test_iso.py
test_change_service_offering_for_vm_with_snapshots Skipped 0.00 test_vm_snapshots.py
test_09_copy_delete_template Skipped 0.01 test_templates.py
test_06_copy_template Skipped 0.00 test_templates.py
test_static_role_account_acls Skipped 0.01 test_staticroles.py
test_11_ss_nfs_version_on_ssvm Skipped 0.02 test_ssvm.py
test_01_scale_vm Skipped 0.00 test_scale_vm.py
test_01_primary_storage_iscsi Skipped 0.03 test_primary_storage.py
test_vm_nic_adapter_vmxnet3 Skipped 0.00 test_nic_adapter_type.py
test_nested_virtualization_vmware Skipped 0.00 test_nested_virtualization.py
test_06_copy_iso Skipped 0.00 test_iso.py
test_deploy_vgpu_enabled_vm Skipped 0.02 test_deploy_vgpu_enabled_vm.py
test_3d_gpu_support Skipped 0.03 test_deploy_vgpu_enabled_vm.py

@rohityadavcloud
Copy link
Member

rohityadavcloud commented Aug 31, 2017

LGTM, no new regressions found. The errors are known intermittent failures, being handled separately.
Checked, new smoke test passed in Trillian:

@summary: Test to list, create and delete Port Forwarding for ... === TestName: test_01_create_delete_portforwarding_fornonvpc | Status : SUCCESS ===
ok


Ran 1 test in 253.043s

OK

@rohityadavcloud rohityadavcloud merged commit d1e61eb into apache:master Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants