def _port_to_octavia_interface(self, compute_id, port): fixed_ips = [utils.convert_fixed_ip_dict_to_model(fixed_ip) for fixed_ip in port.get('fixed_ips', [])] return network_models.Interface(compute_id=compute_id, network_id=port['network_id'], port_id=port['id'], fixed_ips=fixed_ips)
def _nova_interface_to_octavia_interface(self, compute_id, nova_interface): fixed_ips = [utils.convert_fixed_ip_dict_to_model(fixed_ip) for fixed_ip in nova_interface.fixed_ips] return network_models.Interface(compute_id=compute_id, network_id=nova_interface.net_id, port_id=nova_interface.port_id, fixed_ips=fixed_ips)
def _port_to_octavia_interface(self, compute_id, port): fixed_ips = [utils.convert_fixed_ip_dict_to_model(fixed_ip) for fixed_ip in port.get('fixed_ips', [])] return network_models.Interface(compute_id=compute_id, network_id=port['network_id'], port_id=port['id'], fixed_ips=fixed_ips)
def _nova_interface_to_octavia_interface(self, compute_id, nova_interface): fixed_ips = [utils.convert_fixed_ip_dict_to_model(fixed_ip) for fixed_ip in nova_interface.fixed_ips] return network_models.Interface(compute_id=compute_id, network_id=nova_interface.net_id, port_id=nova_interface.port_id, fixed_ips=fixed_ips)
def test_convert_fixed_ip_dict_to_model(self): model_obj = utils.convert_fixed_ip_dict_to_model( t_constants.MOCK_FIXED_IP) assert_dict = dict( subnet_id=t_constants.MOCK_SUBNET_ID, ip_address=t_constants.MOCK_IP_ADDRESS ) self._compare_ignore_value_none(model_obj.to_dict(), assert_dict)
def test_convert_fixed_ip_dict_to_model(self): model_obj = utils.convert_fixed_ip_dict_to_model( t_constants.MOCK_FIXED_IP) assert_dict = dict( subnet_id=t_constants.MOCK_SUBNET_ID, ip_address=t_constants.MOCK_IP_ADDRESS ) self._compare_ignore_value_none(model_obj.to_dict(), assert_dict)