def _update_hp_sw_lag_id(self, context, lag_dict): """Update hp switch lag_id .""" switch_ports = db.get_hp_ironic_swport_map_by_id(context, lag_dict) for switch_port in switch_ports: sw_port_id = switch_port.switch_port_id rec_dict = {'id': sw_port_id, 'lag_id': lag_dict['id']} db.update_hp_switch_ports_with_lag_id(context, rec_dict)
def test_update_hp_swport_with_lag_id(self): """Test update_hp_swport_with_lag_id method.""" self._add_switch_and_lag_port() lag_dict = {'id': "lag1234", 'lag_id': "1234"} db.update_hp_switch_ports_with_lag_id(self.ctx, lag_dict) result = db.get_hp_switch_port_by_id( self.ctx, {'id': "1234"}) self.assertEqual("lag1234", result.lag_id)