Skip to content

Commit

Permalink
Merge "Extra dhcp options on port"
Browse files Browse the repository at this point in the history
Change-Id: I3c339163d5081f616831505a07e1d793d030cb30
  • Loading branch information
Zuul authored and bailkeri committed Aug 4, 2014
1 parent 2d3a726 commit 4bc0ece
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/config/vnc_openstack/vnc_openstack/neutron_plugin_db.py
Expand Up @@ -1974,6 +1974,19 @@ def _port_neutron_to_vnc(self, port_q, net_obj, oper):
id_perms.enable = port_q['admin_state_up']
port_obj.set_id_perms(id_perms)

if ('extra_dhcp_opts' in port_q):
dhcp_options = []
if port_q['extra_dhcp_opts']:
for option_pair in port_q['extra_dhcp_opts']:
option = \
DhcpOptionType(dhcp_option_name=option_pair['opt_name'],
dhcp_option_value=option_pair['opt_value'])
dhcp_options.append(option)
if dhcp_options:
olist = DhcpOptionsListType(dhcp_options)
port_obj.set_virtual_machine_interface_dhcp_option_list(olist)
else:
port_obj.set_virtual_machine_interface_dhcp_option_list(None)

if (addr_pair.ADDRESS_PAIRS in port_q and
port_q[addr_pair.ADDRESS_PAIRS]):
Expand Down Expand Up @@ -2048,6 +2061,15 @@ def _port_vnc_to_neutron(self, port_obj, port_req_memo=None):
if mac_refs:
port_q_dict['mac_address'] = mac_refs.mac_address[0]

dhcp_options_list = port_obj.get_virtual_machine_interface_dhcp_option_list()
if dhcp_options_list and dhcp_options_list.dhcp_option:
dhcp_options = []
for dhcp_option in dhcp_options_list.dhcp_option:
pair = {"opt_value": dhcp_option.dhcp_option_value,
"opt_name": dhcp_option.dhcp_option_name}
dhcp_options.append(pair)
port_q_dict['extra_dhcp_opts'] = dhcp_options

allowed_address_pairs = port_obj.get_virtual_machine_interface_allowed_address_pairs()
if allowed_address_pairs and allowed_address_pairs.allowed_address_pair:
address_pairs = []
Expand Down

0 comments on commit 4bc0ece

Please sign in to comment.