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

F5 P/O agent code change for Openstack Queens lbaasv2 #1405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions f5_openstack_agent/lbaasv2/drivers/bigip/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@


try:
from neutron.agent.linux import interface
from neutron.common import config as common_config
from neutron.common import rpc as n_rpc
from neutron.conf.agent.common import INTERFACE_OPTS
try:
from neutron.conf.agent import common as config
except Exception:
Expand Down Expand Up @@ -71,7 +71,7 @@ def main():
"""F5 LBaaS agent for OpenStack."""
cfg.CONF.register_opts(OPTS)
cfg.CONF.register_opts(manager.OPTS)
cfg.CONF.register_opts(interface.OPTS)
cfg.CONF.register_opts(INTERFACE_OPTS)
Copy link
Contributor

Choose a reason for hiding this comment

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

this way seems to make it quite complicated. should probably Try this way: copy the content of INTERFACE_OPTS into this file , then this line can be always the same between each branch. each branch has the same and we dont have to consider queens differently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Frankly speaking, I think it would not be that necessary to duplicate code and change the dependency.

Copy link
Contributor

Choose a reason for hiding this comment

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

in that way, we do not need a separate queens branch. we can still use our existing 9.8 branch for queens, as well as the original M N, O. thus, avoid many inconveniences for maintenance work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree


config.register_agent_state_opts_helper(cfg.CONF)
config.register_root_helper(cfg.CONF)
Expand Down
4 changes: 2 additions & 2 deletions f5_openstack_agent/lbaasv2/drivers/bigip/esd_filehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def read_json(self):
self.esdJSONDict.update(fileJSONDict)

except ValueError as err:
LOG.error('ESD JSON File is invalid: %s', err)
raise f5_ex.esdJSONFileInvalidException()
LOG.error('ESD JSON File is invalid: %s', err)
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above.

raise f5_ex.esdJSONFileInvalidException()

return self.esdJSONDict

Expand Down
2 changes: 1 addition & 1 deletion f5_openstack_agent/lbaasv2/drivers/bigip/lbaas_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _assure_monitors_created(self, service):
monitor['provisioning_status'] = constants_v2.F5_ERROR

def _assure_monitors_deleted(self, service):
monitors = service.get("healthmonitors", [])
monitors = service.get("healthmonitors", list())
loadbalancer = service["loadbalancer"]
bigips = self.driver.get_config_bigips()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ def test_VXLANDeleteException():


def test_BigIPNotLicensedForVcmp():
with pytest.raises(exceptions.BigIPNotLicensedForVcmp):
raise getattr(exceptions, 'BigIPNotLicensedForVcmp')()
with pytest.raises(exceptions.BigIPNotLicensedForVcmp):
raise getattr(exceptions, 'BigIPNotLicensedForVcmp')()


if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions f5_openstack_agent/lbaasv2/drivers/bigip/test/test_vcmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def old_setup_vcmp_method_test(mock_mgmt_root, mock_driver, mock_host_obj):
def test___init__(setup_vcmp_mgr):
vcmp = setup_vcmp_mgr
assert vcmp.vcmp_hosts != []
assert len(vcmp.vcmp_hosts) is 2
assert len(vcmp.vcmp_hosts) == 2
Copy link
Contributor

Choose a reason for hiding this comment

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

these are common places which IMO is irrelevant to queens_engineering. put them into a separate commit so that they are submitted into each branch we need?(e.g. 9.6 9.7 etc, if needed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will do it, after I fix the loopback4 things, or you can help me a bit :D

assert vcmp.vcmp_hosts[0]['guests'] != []
assert len(vcmp.vcmp_hosts[0]['guests']) is 1
assert len(vcmp.vcmp_hosts[0]['guests']) == 1


def test___init__no_vcmp_hosts():
Expand Down Expand Up @@ -237,13 +237,13 @@ def test__check_vcmp_host_assignments_bad_platform(setup_vcmp_method_test):
def test__get_vlan_use_count(setup_vcmp_method_test):
vcmp, mock_bigip = setup_vcmp_method_test
use_cnt = vcmp._get_vlan_use_count(vcmp.vcmp_hosts[0], 'test_vlan')
assert use_cnt is 1
assert use_cnt == 1


def test__get_vlan_use_count_zero(setup_vcmp_method_test):
vcmp, mock_bigip = setup_vcmp_method_test
use_cnt = vcmp._get_vlan_use_count(vcmp.vcmp_hosts[0], 'test_vlan_2')
assert use_cnt is 0
assert use_cnt == 0


def test__is_vlan_assoc_with_vcmp_guest(setup_vcmp_method_test):
Expand Down
2 changes: 1 addition & 1 deletion f5_openstack_agent/lbaasv2/drivers/bigip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def strip_cidr_netmask(ip_address):
'''

split_ip = ip_address.split('/')
if len(split_ip) is 2:
if len(split_ip) == 2:
return split_ip[0]
else:
msg = 'The IP address provided was not in CIDR notation.'
Expand Down