]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Refactor l2_pop code to pass mac/ip info more readably
authorCarl Baldwin <carl.baldwin@hp.com>
Wed, 6 Aug 2014 01:02:09 +0000 (01:02 +0000)
committerCarl Baldwin <carl.baldwin@hp.com>
Wed, 15 Oct 2014 22:17:33 +0000 (22:17 +0000)
commit8f50bc29edf0788dbc6220d56b45334eab9ecdc9
treee50e37faccb889778804be1445426d2ae8c74c14
parent7cb6ca011efb766def95535f1ff2dfb707a7768f
Refactor l2_pop code to pass mac/ip info more readably

Previous code used a 2 element array to represent a mac/ip address
pair.  Code assumed that element 0 was mac and 1 was ip.  This made
the code difficult to read and difficult to maintain.  An attempt was
made to insert a third value that failed miserably because of the
position dependence and other code that assumed not only positions but
also the number of elements.

Using a namedtuple seems to be the best way to get better
maintainability.  Named tuples can be compared with regular tuples.
The json serializer still uses an array to represent it so the on-wire
representation of the object has not changed.  A short snip of code
was required to restore the namedtuple from the RPC message.

Change-Id: I7f8c93b0e12ee0179bb23dfbb3a3d814615b1c2e
Closes-Bug: #1352801
neutron/agent/l2population_rpc.py
neutron/common/constants.py
neutron/plugins/ml2/drivers/l2pop/mech_driver.py
neutron/plugins/ml2/drivers/l2pop/rpc.py
neutron/plugins/ofagent/agent/ofa_neutron_agent.py
neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/unit/agent/l2population_rpc_base.py
neutron/tests/unit/agent/test_l2population_rpc.py
neutron/tests/unit/ml2/drivers/test_l2population.py
neutron/tests/unit/ofagent/test_ofa_neutron_agent.py
neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py